From: Alexander Barton Date: Fri, 15 May 2020 11:04:34 +0000 (+0200) Subject: Refactor recursion logic, add AX_AUTO_RECURSE_DISABLE option X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3fd998ed3ee398d75c1291f289c894d56e69f3a9;p=ax-make.git Refactor recursion logic, add AX_AUTO_RECURSE_DISABLE option This allows to ... - Disable auto-recursion behaviour by setting AX_AUTO_RECURSE_DISABLE=1 - Specifying the default targets (for "make" without any targets listed by overwriting the "default" target) - Building sub-trees by adding support for "make [...]" invocation --- diff --git a/Makefile.ax b/Makefile.ax index 180ce3c..5e1a97f 100644 --- a/Makefile.ax +++ b/Makefile.ax @@ -1,6 +1,6 @@ # # ax-make: Alex' Simple Makefile System -# Copyright (c)2014 Alexander Barton (alex@barton.de) +# Copyright (c)2014-2020 Alexander Barton (alex@barton.de) # # This library is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published @@ -15,9 +15,15 @@ PREFIX ?= /usr/local USER ?= $(shell id -un) GROUP ?= $(shell stat --format=%G $(DESTDIR)$(PREFIX) 2>/dev/null || id -gn) -all: all-ax all-local - -all-ax: $(ALL) $(SUBDIRS) +ifndef AX_AUTO_RECURSE_DISABLE +# Automatically recurse into all $(SUBDIR)s for the default target. +default: $(ALL) $(SUBDIRS) all-local +all: $(ALL) all-ax all-local +else +# Automatic recursion for default target is disabled! +default: $(ALL) all-local +all: $(ALL) all-ax all-local +endif clean: clean-ax clean-local @@ -36,6 +42,10 @@ all-ax clean-ax distclean-ax maintainer-clean-ax check-ax install-ax: $(MAKE) -C $$subdir $$target || exit 1; \ done +$(SUBDIRS): + $(AX_SILENT)echo "Making default in \"$@\" ..."; \ + $(MAKE) -C "$@" || exit 1 + .PHONY: all clean distclean maintainer-clean check install .PHONY: all-ax clean-ax distclean-ax maintainer-clean-ax check-ax install-ax .PHONY: all-local clean-local distclean-local maintainer-clean-local check-local install-local