build: update make rules

cute-signatures
Timo Teras 2009-08-05 16:58:12 +03:00
parent f14cbbf4e5
commit 4bedcb02ec
1 changed files with 8 additions and 1 deletions

View File

@ -47,6 +47,8 @@ export srctree objtree
##
# Consult SCM for better version string.
TAGPREFIX ?= v
GIT_REV := $(shell test -d .git && git describe || echo exported)
ifneq ($(GIT_REV), exported)
FULL_VERSION := $(patsubst $(TAGPREFIX)%,%,$(GIT_REV))
@ -152,7 +154,8 @@ escsq = $(subst $(squote),'\$(squote)',$1)
# Find any prerequisites that is newer than target or that does not exist.
# 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.
#
@ -188,6 +191,8 @@ define rule_cc_o_c
rm $(depfile)
endef
$(obj)/%.o: override local-target-prereqs=%
$(obj)/%.o: $(src)/%.c FORCE
$(call if_changed_rule,cc_o_c)
@ -204,6 +209,8 @@ quiet_cmd_ld = LD $@
$(addprefix $(obj)/,$($(@F)-objs)) \
$(LIBS) $(LIBS_$(@F))
$(__progs): override local-target-prereqs=$(addprefix $(obj)/,$($(*F)-objs))
$(__progs): $(obj)/%: $(cobjs) FORCE
$(call if_changed,ld)