SRCS += graphics/graphics.cpp
+OBJSDIR := ../objs/
OBJS := ${SRCS:.cpp=.o}
-DEPENDS := ${SRCS:.cpp=.d}
+OBJS := $(addprefix ${OBJSDIR},${OBJS})
+
+DEPSDIR := ../deps/
+DEPS := ${SRCS:.cpp=.d}
+DEPS := $(addprefix ${DEPSDIR},${DEPS})
HRDS := ${SRCS:.cpp=.h}
HRDS := ${HRDS:main.h=} # remove main.h
${Q2}${CXX} ${CXXFLAGS} -o ${TARGET} $^ ${LIBS}
# rule to make a depend file from a .cpp
-%.d: %.cpp
+${DEPSDIR}%.d: %.cpp
${Q1}echo "DEP: $@"
${Q2}${CXX} -M ${CXXFLAGS} $< | sed 's,: , $@: ,' > $@
# rule to make an object file from a .cpp
-%.o: %.cpp
+${OBJSDIR}%.o: %.cpp
${Q1}echo "${CXX}: $@"
${Q2}${CXX} ${CXXFLAGS} -c -o $@ $<
.PHONY: distclean
distclean: clean
- ${Q1}echo "CLEAN: DEPENDS"
- ${Q2}rm -f ${DEPENDS}
+ ${Q1}echo "CLEAN: DEPS"
+ ${Q2}rm -f ${DEPS}
${Q1}echo "CLEAN: tags prof gmon.out"
${Q2}rm -f tags prof gmon.out
gprof -b ${TARGET} > prof
kprof -f prof
--include ${DEPENDS}
+-include ${DEPS}