about summary refs log tree commit diff
path: root/mk/patterns.mk
diff options
context:
space:
mode:
Diffstat (limited to 'mk/patterns.mk')
-rw-r--r--mk/patterns.mk9
1 files changed, 6 insertions, 3 deletions
diff --git a/mk/patterns.mk b/mk/patterns.mk
index 6b2cfd017050..3219d9629fbf 100644
--- a/mk/patterns.mk
+++ b/mk/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