Commit 4bedcb02 authored by Timo Teräs's avatar Timo Teräs
Browse files

build: update make rules

parent f14cbbf4
...@@ -47,6 +47,8 @@ export srctree objtree ...@@ -47,6 +47,8 @@ export srctree objtree
## ##
# Consult SCM for better version string. # Consult SCM for better version string.
TAGPREFIX ?= v
GIT_REV := $(shell test -d .git && git describe || echo exported) GIT_REV := $(shell test -d .git && git describe || echo exported)
ifneq ($(GIT_REV), exported) ifneq ($(GIT_REV), exported)
FULL_VERSION := $(patsubst $(TAGPREFIX)%,%,$(GIT_REV)) FULL_VERSION := $(patsubst $(TAGPREFIX)%,%,$(GIT_REV))
...@@ -152,7 +154,8 @@ escsq = $(subst $(squote),'\$(squote)',$1) ...@@ -152,7 +154,8 @@ escsq = $(subst $(squote),'\$(squote)',$1)
# Find any prerequisites that is newer than target or that does not exist. # Find any prerequisites that is newer than target or that does not exist.
# PHONY targets skipped in both cases. # PHONY targets skipped in both cases.
any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^) local-target-prereqs = %
any-prereq = $(filter $(local-target-prereqs), $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^), $^))
# Execute command if command has changed or prerequisite(s) are updated. # Execute command if command has changed or prerequisite(s) are updated.
# #
...@@ -188,6 +191,8 @@ define rule_cc_o_c ...@@ -188,6 +191,8 @@ define rule_cc_o_c
rm $(depfile) rm $(depfile)
endef endef
$(obj)/%.o: override local-target-prereqs=%
$(obj)/%.o: $(src)/%.c FORCE $(obj)/%.o: $(src)/%.c FORCE
$(call if_changed_rule,cc_o_c) $(call if_changed_rule,cc_o_c)
...@@ -204,6 +209,8 @@ quiet_cmd_ld = LD $@ ...@@ -204,6 +209,8 @@ quiet_cmd_ld = LD $@
$(addprefix $(obj)/,$($(@F)-objs)) \ $(addprefix $(obj)/,$($(@F)-objs)) \
$(LIBS) $(LIBS_$(@F)) $(LIBS) $(LIBS_$(@F))
$(__progs): override local-target-prereqs=$(addprefix $(obj)/,$($(*F)-objs))
$(__progs): $(obj)/%: $(cobjs) FORCE $(__progs): $(obj)/%: $(cobjs) FORCE
$(call if_changed,ld) $(call if_changed,ld)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment