]> rtime.felk.cvut.cz Git - omk.git/blob - snippets/build.omk
Include __goals.omk.inc only in the approproate subtree
[omk.git] / snippets / build.omk
1
2 #####################
3 # Build pseudo-pass #
4 #####################
5
6 ifneq (,$(filter build,$(MAKECMDGOALS)))
7 rule_targets = $(value $(1)_targets)
8 rule_deps    = $(value $(1)_deps)
9 rule_msg     = $(value $(1)_msg)
10 rule_cmd     = $(value $(1)_cmd)
11
12 # Usage: $(eval $(call build_rule,<target>))
13 define build_rule
14 $(rule_targets): $(rule_deps) #$(omk_inc_file)
15         @$(QUIET_CMD_ECHO) "  "$(rule_msg)"$$@" #"$$(call strip_out,$$@)"
16         $(Q)$(rule_cmd)
17 endef
18
19 # Goals are included only for this directory and all subdirectories
20 # TODO: What if a target depends on a library from different
21 # subtree. Then the library would be remade even if it should not
22 # because its __goals.omk.inc is not included.
23 -include $(shell true; find $(OMK_WORK_DIR) -name '__goals.omk.inc') # `true' is a hack for MinGW
24
25 # Definition of rules is included everywhere to allow multi-directory
26 # targets. 
27 -include $(shell true; find $(BUILD_OMK_DIR) -name '*.omk.inc' -not -name '__goals.omk.inc') # `true' is a hack for MinGW
28
29 # FIXME: Disable automatic remake of included files
30
31 $(foreach rule,$(prepared_rules),$(eval $(call build_rule,$(rule))))
32
33 .PHONY: build
34
35 build: $(omk_goals)
36
37 endif # (,$(filter build,$(MAKECMDGOALS)))