From: Patrik Gornicz Date: Mon, 18 Aug 2008 00:52:40 +0000 (-0400) Subject: changed Makefile to use deps and objs directories X-Git-Tag: v0.05~18 X-Git-Url: http://gitweb.pgornicz.com/gitweb.cgi?p=physics.git;a=commitdiff_plain;h=f4b779e42fa07ab66aec420e735a559dec1a7a90 changed Makefile to use deps and objs directories --- diff --git a/src/Makefile b/src/Makefile index 2c1cf92..6ab9af2 100644 --- a/src/Makefile +++ b/src/Makefile @@ -49,8 +49,13 @@ SRCS += input/inputManager.cpp 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 @@ -83,12 +88,12 @@ ${TARGET}: ${OBJS} ${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 $@ $< @@ -102,8 +107,8 @@ clean: .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 @@ -141,4 +146,4 @@ prof: all gprof -b ${TARGET} > prof kprof -f prof --include ${DEPENDS} +-include ${DEPS} diff --git a/src/templates/template.cpp b/templates/template.cpp similarity index 100% rename from src/templates/template.cpp rename to templates/template.cpp diff --git a/src/templates/template.h b/templates/template.h similarity index 100% rename from src/templates/template.h rename to templates/template.h