]>
Commit | Line | Data |
---|---|---|
88d31d11 L |
1 | SHELL := /bin/bash |
2 | RUNDIR := $(CURDIR) | |
3 | ifndef TOP | |
4 | TOP := $(shell \ | |
5 | top=$(RUNDIR); \ | |
6 | while [ ! -r "$$top/Rules.top" ] && [ "$$top" != "" ]; do \ | |
7 | top=$${top%/*}; \ | |
8 | done; \ | |
9 | echo $$top) | |
10 | endif | |
11 | ||
12 | MK := $(TOP)/mk | |
13 | ||
14 | .PHONY: dir tree all clean clean_all clean_tree dist_clean | |
15 | ||
16 | # Default target when nothing is given on the command line. Reasonable | |
17 | # options are: | |
18 | # "dir" - updates only targets from current directory and its dependencies | |
19 | # "tree" - updates targets (and their dependencies) in whole subtree | |
20 | # starting at current directory | |
21 | # "all" - updates all targets in the project | |
22 | .DEFAULT_GOAL := dir | |
23 | ||
24 | dir : dir_$(RUNDIR) | |
25 | tree : tree_$(RUNDIR) | |
26 | ||
27 | clean : clean_$(RUNDIR) | |
28 | clean_tree : clean_tree_$(RUNDIR) | |
29 | ||
30 | # $(d) keeps the path of "current" directory during tree traversal and | |
31 | # $(dir_stack) is used for backtracking during traversal | |
32 | d := $(TOP) | |
33 | dir_stack := | |
34 | ||
35 | include $(MK)/header.mk | |
36 | include $(MK)/footer.mk | |
37 | ||
38 | # Automatic inclusion of the skel.mk at the top level - that way | |
39 | # Rules.top has exactly the same structure as other Rules.mk | |
40 | include $(MK)/skel.mk | |
41 | ||
42 | .SECONDEXPANSION: | |
43 | $(eval $(value HEADER)) | |
44 | include $(TOP)/Rules.top | |
45 | $(eval $(value FOOTER)) | |
46 | ||
47 | # Optional final makefile where you can specify additional targets | |
48 | -include $(TOP)/final.mk | |
49 | ||
50 | # This is just a convenience - to let you know when make has stopped | |
51 | # interpreting make files and started their execution. | |
52 | $(info Rules generated $(if $(BUILD_MODE),for "$(BUILD_MODE)" mode,)...) |