]> rtime.felk.cvut.cz Git - omk.git/blob - snippets/build
4a7318870980d0a38940614d43e455b3a29e47b1
[omk.git] / snippets / build
1
2 ##################### -*- makefile-gmake -*-
3 # Build pseudo-pass #
4 #####################
5 ifneq (,$(filter build,$(MAKECMDGOALS)))
6 rule_targets = $(value $(1)_targets)
7 rule_deps    = $(value $(1)_deps)
8 rule_msg     = $(value $(1)_msg)
9 rule_cmd     = $(value $(1)_cmd)
10
11 # Usage: $(eval $(call build_rule,<target>))
12 define build_rule
13 $(rule_targets): $(rule_deps) #$(omk_inc_file)
14         @$(QUIET_CMD_ECHO) "  "$(rule_msg)"$$@" #"$$(call strip_out,$$@)"
15         $(Q)$(rule_cmd)
16 endef
17
18 # TODO: Include __goals.omk.inc only in the subtree
19 -include $(shell true; find $(BUILD_OMK_DIR) -name '*.omk.inc') # `true' is a hack for MinGW
20 # FIXME: Disable automatic remake of included files
21
22 $(foreach rule,$(prepared_rules),$(eval $(call build_rule,$(rule))))
23
24 .PHONY: build
25
26 build: $(omk_goals)
27
28 endif # (,$(filter build,$(MAKECMDGOALS)))