From 871c2ef40cad876c481d19cf12ad3c852a9c20a2 Mon Sep 17 00:00:00 2001 From: Jan-Marek Glogowski Date: Wed, 13 May 2020 19:00:40 +0000 Subject: Bug 1637083 Replace pre-dependency with shell hack r=rrelyea Originally I tried multiple variants using make's conditionals to limit DIRS and enforce building the parent directory before the sub-directory. None of them worked for me, most resulting in an infinite recursion, so I used the current pre-depends workaround to fulfill the real dependency. Now I remembered that automake can handle this case for SUBDIRS specifying "." as a directory. The generated Makefile handles it via shell scripting; not nice, but it works. So this gets rid of the workaround, replacing it with a small shell test. Differential Revision: https://phabricator.services.mozilla.com/D74855 --- coreconf/rules.mk | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'coreconf') diff --git a/coreconf/rules.mk b/coreconf/rules.mk index 1bdf08145..dc72e9cef 100644 --- a/coreconf/rules.mk +++ b/coreconf/rules.mk @@ -31,10 +31,21 @@ ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET))) USE_NT_C_SYNTAX=1 endif +# For whatever reason, "." can't be handled using make conditionals. +# Based on automake's SUBDIRS "." handling. ifdef DIRS ifndef IGNORE_DIRS +ifneq (,$(filter .,$(DIRS))) +TARGETS = $(NULL) +ALL_TRASH = $(NULL) +endif + $(DIRS): - $(IGNORE_ERROR)@$(MAKE) -C $@ $(MAKECMDGOALS) + $(IGNORE_ERROR)@if [ "$@" != "." ]; then \ + $(MAKE) -C $@ $(MAKECMDGOALS) ; \ + else \ + IGNORE_DIRS=1 $(MAKE) -C $@ $(MAKECMDGOALS) ; \ + fi @$(CLICK_STOPWATCH) endif endif @@ -73,7 +84,9 @@ endif check: $(DIRS) clean clobber: $(DIRS) +ifneq (,$(ALL_TRASH)) rm -rf $(ALL_TRASH) +endif realclean clobber_all: $(DIRS) rm -rf $(wildcard *.OBJ) dist $(ALL_TRASH) -- cgit v1.2.1