From: Patrik Gornicz Date: Mon, 29 Sep 2008 00:05:38 +0000 (-0400) Subject: using make to create the objs and deps directories X-Git-Tag: v0.07~12 X-Git-Url: http://gitweb.pgornicz.com/gitweb.cgi?p=physics.git;a=commitdiff_plain;h=42f62a7503a4d516020b6222eecb3a30ccc66127 using make to create the objs and deps directories --- diff --git a/.gitignore b/.gitignore index 9f42e7f..20d0e14 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ run_physics +objs +deps diff --git a/deps/.gitignore b/deps/.gitignore deleted file mode 100644 index a438335..0000000 --- a/deps/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.d diff --git a/deps/Effects/.tmp b/deps/Effects/.tmp deleted file mode 100644 index 69d9e5c..0000000 --- a/deps/Effects/.tmp +++ /dev/null @@ -1,2 +0,0 @@ -# This file is needed for git to include the current directory into the -# repository ... ideas? diff --git a/deps/Entities/.tmp b/deps/Entities/.tmp deleted file mode 100644 index 69d9e5c..0000000 --- a/deps/Entities/.tmp +++ /dev/null @@ -1,2 +0,0 @@ -# This file is needed for git to include the current directory into the -# repository ... ideas? diff --git a/deps/GameStates/.tmp b/deps/GameStates/.tmp deleted file mode 100644 index 69d9e5c..0000000 --- a/deps/GameStates/.tmp +++ /dev/null @@ -1,2 +0,0 @@ -# This file is needed for git to include the current directory into the -# repository ... ideas? diff --git a/deps/config/.tmp b/deps/config/.tmp deleted file mode 100644 index 69d9e5c..0000000 --- a/deps/config/.tmp +++ /dev/null @@ -1,2 +0,0 @@ -# This file is needed for git to include the current directory into the -# repository ... ideas? diff --git a/deps/graphics/.tmp b/deps/graphics/.tmp deleted file mode 100644 index 69d9e5c..0000000 --- a/deps/graphics/.tmp +++ /dev/null @@ -1,2 +0,0 @@ -# This file is needed for git to include the current directory into the -# repository ... ideas? diff --git a/deps/input/.tmp b/deps/input/.tmp deleted file mode 100644 index 69d9e5c..0000000 --- a/deps/input/.tmp +++ /dev/null @@ -1,2 +0,0 @@ -# This file is needed for git to include the current directory into the -# repository ... ideas? diff --git a/objs/.gitignore b/objs/.gitignore deleted file mode 100644 index 5761abc..0000000 --- a/objs/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.o diff --git a/objs/Effects/.tmp b/objs/Effects/.tmp deleted file mode 100644 index 69d9e5c..0000000 --- a/objs/Effects/.tmp +++ /dev/null @@ -1,2 +0,0 @@ -# This file is needed for git to include the current directory into the -# repository ... ideas? diff --git a/objs/Entities/.tmp b/objs/Entities/.tmp deleted file mode 100644 index 69d9e5c..0000000 --- a/objs/Entities/.tmp +++ /dev/null @@ -1,2 +0,0 @@ -# This file is needed for git to include the current directory into the -# repository ... ideas? diff --git a/objs/GameStates/.tmp b/objs/GameStates/.tmp deleted file mode 100644 index 69d9e5c..0000000 --- a/objs/GameStates/.tmp +++ /dev/null @@ -1,2 +0,0 @@ -# This file is needed for git to include the current directory into the -# repository ... ideas? diff --git a/objs/config/.tmp b/objs/config/.tmp deleted file mode 100644 index 69d9e5c..0000000 --- a/objs/config/.tmp +++ /dev/null @@ -1,2 +0,0 @@ -# This file is needed for git to include the current directory into the -# repository ... ideas? diff --git a/objs/graphics/.tmp b/objs/graphics/.tmp deleted file mode 100644 index 69d9e5c..0000000 --- a/objs/graphics/.tmp +++ /dev/null @@ -1,2 +0,0 @@ -# This file is needed for git to include the current directory into the -# repository ... ideas? diff --git a/objs/input/.tmp b/objs/input/.tmp deleted file mode 100644 index 69d9e5c..0000000 --- a/objs/input/.tmp +++ /dev/null @@ -1,2 +0,0 @@ -# This file is needed for git to include the current directory into the -# repository ... ideas? diff --git a/src/Makefile b/src/Makefile index 1ebf227..14cc64b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -35,6 +35,9 @@ DEPSDIR := ../deps/ DEPS := ${SRCS:.cpp=.d} DEPS := $(addprefix ${DEPSDIR},${DEPS}) +BLDDIRS := $(addprefix ${DEPSDIR},${DIRS}) $(addprefix ${OBJSDIR},${DIRS}) +BLDDIRS := $(addsuffix /,${BLDDIRS}) + VERBOSE := 0 @@ -53,17 +56,22 @@ endif .PHONY: all all: ${TARGET} +# how to link the main target ${TARGET}: ${OBJS} ${Q1}echo "${CXX}: $@" ${Q2}${CXX} ${CXXFLAGS} -o $@ $^ ${LIBS} +# how to make a directory +${BLDDIRS}: + ${Q2}mkdir -p $@ + # rule to make a depend file from a .cpp -${DEPSDIR}%.d: %.cpp +${DEPSDIR}%.d: %.cpp | ${BLDDIRS} ${Q1}echo "DEP: $@" ${Q2}${CXX} -MM ${CXXFLAGS} $< | sed 's,\(^.*\):,${OBJSDIR}\1 $@:,' > $@ # rule to make an object file from a .cpp -${OBJSDIR}%.o: %.cpp +${OBJSDIR}%.o: %.cpp | ${BLDDIRS} ${Q1}echo "${CXX}: $@" ${Q2}${CXX} ${CXXFLAGS} -c -o $@ $<