summaryrefslogtreecommitdiff
path: root/common.mak
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2016-01-23 11:55:54 +0100
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2016-01-23 21:47:40 +0100
commitf503022ce56a27b217437af6635b191e09ab1ec5 (patch)
treee5147a8e90dcac40b757a5b6082a3ddef4fee4b0 /common.mak
parent0be4377333d8a9104eadd8b297605a6e95b22047 (diff)
build: fix make checkheaders in out-of-tree builds
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Diffstat (limited to 'common.mak')
-rw-r--r--common.mak3
1 files changed, 2 insertions, 1 deletions
diff --git a/common.mak b/common.mak
index bad262747d..5645e2d429 100644
--- a/common.mak
+++ b/common.mak
@@ -47,7 +47,8 @@ LDFLAGS := $(ALLFFLIBS:%=$(LD_PATH)$(DST_PATH)/lib%) $(LDFLAGS)
define COMPILE
$(call $(1)DEP,$(1))
- $(Q)cd $(SRC_PATH); $(subst @,,$($(1))) $($(1)FLAGS) $($(1)_DEPFLAGS:$(@:.o=.d)=$(DST_PATH)/$(@:.o=.d)) $($(1)_C) $($(1)_O:$@=$(DST_PATH)/$@) $(subst $(SRC_PATH)/,,$<)
+ $(Q)cd $(SRC_PATH); if [ -n "$(findstring $(SRC_PATH),$<)" ]; then dest=$(subst $(SRC_PATH)/,,$<); else dest=$(DST_PATH)/$<; fi; \
+ $(subst @,,$($(1))) $($(1)FLAGS) $($(1)_DEPFLAGS:$(@:.o=.d)=$(DST_PATH)/$(@:.o=.d)) $($(1)_C) $($(1)_O:$@=$(DST_PATH)/$@) $$dest
endef
COMPILE_C = $(call COMPILE,CC)