about summary refs log tree commit diff
path: root/patterns.mk
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-09-05T12·17+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-09-05T12·17+0200
commit075cfe3b97bf0e90577bb7e842ba467524fad0ef (patch)
treed6675899455abe1472c260feb0e7584ab8f9804a /patterns.mk
parentafbdd5533448724aaf32b434fda8478ad5d80a0f (diff)
Add support for using a build directory
Diffstat (limited to 'patterns.mk')
-rw-r--r--patterns.mk9
1 files changed, 6 insertions, 3 deletions
diff --git a/patterns.mk b/patterns.mk
index 6b2cfd017050..3219d9629fbf 100644
--- a/patterns.mk
+++ b/patterns.mk
@@ -1,8 +1,11 @@
-%.o: %.cc
+$(buildprefix)%.o: %.cc
+	@mkdir -p "$(dir $@)"
 	$(trace-cxx) $(CXX) -o $@ -c $< $(GLOBAL_CXXFLAGS) $(GLOBAL_CXXFLAGS_PCH) $(CXXFLAGS) $($@_CXXFLAGS) -MMD -MF $(call filename-to-dep, $@) -MP
 
-%.o: %.cpp
+$(buildprefix)%.o: %.cpp
+	@mkdir -p "$(dir $@)"
 	$(trace-cxx) $(CXX) -o $@ -c $< $(GLOBAL_CXXFLAGS) $(GLOBAL_CXXFLAGS_PCH) $(CXXFLAGS) $($@_CXXFLAGS) -MMD -MF $(call filename-to-dep, $@) -MP
 
-%.o: %.c
+$(buildprefix)%.o: %.c
+	@mkdir -p "$(dir $@)"
 	$(trace-cc) $(CC) -o $@ -c $< $(GLOBAL_CFLAGS) $(CFLAGS) $($@_CFLAGS) -MMD -MF $(call filename-to-dep, $@) -MP