Skip to content
Snippets Groups Projects
Commit 4bedcb02 authored by Timo Teräs's avatar Timo Teräs
Browse files

build: update make rules

parent f14cbbf4
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment