]> cloudbase.mooo.com Git - z180-stamp.git/blame - mk/Makefile
Rename dir Z180 --> z180
[z180-stamp.git] / mk / Makefile
CommitLineData
88d31d11
L
1SHELL := /bin/bash
2RUNDIR := $(CURDIR)
3ifndef TOP
4TOP := $(shell \
5 top=$(RUNDIR); \
6 while [ ! -r "$$top/Rules.top" ] && [ "$$top" != "" ]; do \
7 top=$${top%/*}; \
8 done; \
9 echo $$top)
10endif
11
12MK := $(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
24dir : dir_$(RUNDIR)
25tree : tree_$(RUNDIR)
26
27clean : clean_$(RUNDIR)
28clean_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
32d := $(TOP)
33dir_stack :=
34
35include $(MK)/header.mk
36include $(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
40include $(MK)/skel.mk
41
42.SECONDEXPANSION:
43$(eval $(value HEADER))
44include $(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,)...)