using make to create the objs and deps directories
authorPatrik Gornicz <Gornicz.P@gmail.com>
Mon, 29 Sep 2008 00:05:38 +0000 (20:05 -0400)
committerPatrik Gornicz <Gornicz.P@gmail.com>
Mon, 29 Sep 2008 00:05:38 +0000 (20:05 -0400)
16 files changed:
.gitignore
deps/.gitignore [deleted file]
deps/Effects/.tmp [deleted file]
deps/Entities/.tmp [deleted file]
deps/GameStates/.tmp [deleted file]
deps/config/.tmp [deleted file]
deps/graphics/.tmp [deleted file]
deps/input/.tmp [deleted file]
objs/.gitignore [deleted file]
objs/Effects/.tmp [deleted file]
objs/Entities/.tmp [deleted file]
objs/GameStates/.tmp [deleted file]
objs/config/.tmp [deleted file]
objs/graphics/.tmp [deleted file]
objs/input/.tmp [deleted file]
src/Makefile

index 9f42e7f..20d0e14 100644 (file)
@@ -1 +1,3 @@
 run_physics
+objs
+deps
diff --git a/deps/.gitignore b/deps/.gitignore
deleted file mode 100644 (file)
index a438335..0000000
+++ /dev/null
@@ -1 +0,0 @@
-*.d
diff --git a/deps/Effects/.tmp b/deps/Effects/.tmp
deleted file mode 100644 (file)
index 69d9e5c..0000000
+++ /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 (file)
index 69d9e5c..0000000
+++ /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 (file)
index 69d9e5c..0000000
+++ /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 (file)
index 69d9e5c..0000000
+++ /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 (file)
index 69d9e5c..0000000
+++ /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 (file)
index 69d9e5c..0000000
+++ /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 (file)
index 5761abc..0000000
+++ /dev/null
@@ -1 +0,0 @@
-*.o
diff --git a/objs/Effects/.tmp b/objs/Effects/.tmp
deleted file mode 100644 (file)
index 69d9e5c..0000000
+++ /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 (file)
index 69d9e5c..0000000
+++ /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 (file)
index 69d9e5c..0000000
+++ /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 (file)
index 69d9e5c..0000000
+++ /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 (file)
index 69d9e5c..0000000
+++ /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 (file)
index 69d9e5c..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-# This file is needed for git to include the current directory into the
-# repository ... ideas?
index 1ebf227..14cc64b 100644 (file)
@@ -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 $@ $<