dba11f2316
Change-Id: I7fec5f934362600f1dbccb809e7122d8ab612efe Implements: blueprint build-artifacts
44 lines
1022 B
Makefile
44 lines
1022 B
Makefile
define ACTION.COPY
|
|
@mkdir -p $(@D)
|
|
cp $< $@
|
|
endef
|
|
|
|
define ACTION.TOUCH
|
|
@mkdir -p $(@D)
|
|
touch $@
|
|
endef
|
|
|
|
# This macros is to make targets dependent on variables
|
|
# It writes variable value into temporary file varname.tmp,
|
|
# then it compares temporary file with the varname.dep file.
|
|
# If there is a difference between them, varname.dep will be updated
|
|
# and the target which depends on it will be rebuilt.
|
|
# Example:
|
|
# target: $(call depv,varname)
|
|
DEPV_DIR:=$(BUILD_DIR)/depv
|
|
define depv
|
|
$(shell mkdir -p $(DEPV_DIR))
|
|
$(shell echo "$($1)" > $(DEPV_DIR)/$1.tmp)
|
|
$(shell diff >/dev/null 2>&1 $(DEPV_DIR)/$1.tmp $(DEPV_DIR)/$1.dep \
|
|
|| mv $(DEPV_DIR)/$1.tmp $(DEPV_DIR)/$1.dep)
|
|
$(DEPV_DIR)/$1.dep
|
|
endef
|
|
|
|
define NEWLINE
|
|
|
|
|
|
endef
|
|
|
|
$(BUILD_DIR)/%/.dir:
|
|
mkdir -p $(@D)
|
|
@touch $@
|
|
|
|
assert-variable=$(if $($1),,$(error Variable $1 need to be defined))
|
|
find-files=$(shell test -e $1 && find $1 -type f 2> /dev/null)
|
|
|
|
# uppercase conversion routine
|
|
# usage: UPPER_VAR = $(call uc,$(VAR))
|
|
uc = $(shell echo $(1) | tr a-z A-Z)
|
|
|
|
comma:=,
|