diff options
author | Leo C | 2014-04-13 15:29:22 +0200 |
---|---|---|
committer | Leo C | 2014-04-13 15:29:22 +0200 |
commit | 88d31d1177b58a2b2052a837a095b51834a8babf (patch) | |
tree | aeae7c27dd388af93a1fa2be383f1acb149c8fac /mk/Makefile | |
parent | e64eba003f92992057c5a1c8b5eff902e4ddaaa5 (diff) | |
download | z180-stamp-88d31d1177b58a2b2052a837a095b51834a8babf.zip |
Add non-recursive make system from Andrzej Ostruszka.
Copyright (C) 2012 Andrzej Ostruszka <andrzej.ostruszka@gmail.com>
URL: http://github.com/aostruszka/nonrec-make
Diffstat (limited to 'mk/Makefile')
-rw-r--r-- | mk/Makefile | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/mk/Makefile b/mk/Makefile new file mode 100644 index 0000000..7658b42 --- /dev/null +++ b/mk/Makefile @@ -0,0 +1,52 @@ +SHELL := /bin/bash +RUNDIR := $(CURDIR) +ifndef TOP +TOP := $(shell \ + top=$(RUNDIR); \ + while [ ! -r "$$top/Rules.top" ] && [ "$$top" != "" ]; do \ + top=$${top%/*}; \ + done; \ + echo $$top) +endif + +MK := $(TOP)/mk + +.PHONY: dir tree all clean clean_all clean_tree dist_clean + +# Default target when nothing is given on the command line. Reasonable +# options are: +# "dir" - updates only targets from current directory and its dependencies +# "tree" - updates targets (and their dependencies) in whole subtree +# starting at current directory +# "all" - updates all targets in the project +.DEFAULT_GOAL := dir + +dir : dir_$(RUNDIR) +tree : tree_$(RUNDIR) + +clean : clean_$(RUNDIR) +clean_tree : clean_tree_$(RUNDIR) + +# $(d) keeps the path of "current" directory during tree traversal and +# $(dir_stack) is used for backtracking during traversal +d := $(TOP) +dir_stack := + +include $(MK)/header.mk +include $(MK)/footer.mk + +# Automatic inclusion of the skel.mk at the top level - that way +# Rules.top has exactly the same structure as other Rules.mk +include $(MK)/skel.mk + +.SECONDEXPANSION: +$(eval $(value HEADER)) +include $(TOP)/Rules.top +$(eval $(value FOOTER)) + +# Optional final makefile where you can specify additional targets +-include $(TOP)/final.mk + +# This is just a convenience - to let you know when make has stopped +# interpreting make files and started their execution. +$(info Rules generated $(if $(BUILD_MODE),for "$(BUILD_MODE)" mode,)...) |