]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
build: better incremental builds (less depends)
authorMarek Vavruša <marek.vavrusa@nic.cz>
Thu, 10 Dec 2015 23:04:08 +0000 (00:04 +0100)
committerMarek Vavruša <marek.vavrusa@nic.cz>
Thu, 10 Dec 2015 23:04:08 +0000 (00:04 +0100)
platform.mk

index 489a9905543d9f5dd2e4c3e487a832f47a1be7b8..25052238a0b72f8f7e62d2ba1c9eb9c0299b91ee 100644 (file)
@@ -67,6 +67,10 @@ $(1)_OBJ := $$($(1)_SOURCES:.c=.o)
 $(1)_DEP := $$($(1)_SOURCES:.c=.d)
 -include $$($(1)_DEP)
 endef
+define make_objrule
+$(1): $(1:.o=.c)
+       $$(call quiet,CC,$$<) $(2) -MMD -MP -c $$< -o $$@
+endef
 
 # Make target (name,path,ext,ldflags,dst,amalgable)
 define make_target
@@ -82,8 +86,7 @@ else
 $$(eval $$(call make_objs,$(1)))
 endif
 # Rules to generate objects with custom CFLAGS and binary/library
-$$($(1)_OBJ): $$($(1)_SOURCES)
-       $(call quiet,CC,$$(@:%.o=%.c)) $(BUILD_CFLAGS) $$($(1)_CFLAGS) -MMD -MP -c $$(@:%.o=%.c) -o $$@
+$$(foreach obj,$$($(1)_OBJ),$$(eval $$(call make_objrule,$$(obj),$(BUILD_CFLAGS) $$($(1)_CFLAGS))))
 $(1) := $(2)/$(1)$(3)
 $(2)/$(1)$(3): $$($(1)_OBJ) $$($(1)_DEPEND)
 ifeq ($(4),-$(ARTYPE))