]> rtime.felk.cvut.cz Git - coffee/buildroot.git/commitdiff
Fix makefile include order by using sort/wildcard.
authorPeter Seiderer <ps.report@gmx.net>
Tue, 21 Nov 2017 19:13:30 +0000 (20:13 +0100)
committerPeter Korsgaard <peter@korsgaard.com>
Thu, 30 Nov 2017 07:24:03 +0000 (08:24 +0100)
The 'include' directive in GNU make supports wildcards, but their
expansion has no defined sort order (GLOB_NOSORT is passed to glob()).
Usually this doesn't matter. However, there is at least one case where
it does make a difference: toolchain/*/*.mk includes both the
definitions of the external toolchain packages and
pkg-toolchain-external.mk, but pkg-toolchain-external.mk must be
included first.

For predictability, use ordered 'include $(sort $(wildcard ...))'
instead of unordered direct 'include */*.mk' everywhere.

Fixes [1] reported by Petr Vorel:

  make: *** No rule to make target 'toolchain-external-custom', needed by '.../build/toolchain-external/.stamp_configured'.  Stop.

[1] http://lists.busybox.net/pipermail/buildroot/2017-November/206969.html

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Tested-by: Petr Vorel <petr.vorel@gmail.com>
[Arnout: also sort the one remaining include, of the external docs]
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
(cherry picked from commit b9d2d4cb4ebc7a2290c4683dd9667b8f0a9e3cdf)
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Makefile
package/gstreamer/gstreamer.mk
package/gstreamer1/gstreamer1.mk
toolchain/toolchain-external/toolchain-external.mk

index 6136593c98a4918d317c65918d444c82253db9f5..b3cfa54794ba4ffa1f66c58b6a8c02368b605343 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -483,8 +483,8 @@ include support/dependencies/dependencies.mk
 
 PACKAGES += $(DEPENDENCIES_HOST_PREREQ)
 
-include toolchain/*.mk
-include toolchain/*/*.mk
+include $(sort $(wildcard toolchain/*.mk))
+include $(sort $(wildcard toolchain/*/*.mk))
 
 # Include the package override file if one has been provided in the
 # configuration.
@@ -1071,7 +1071,7 @@ print-version:
        @echo $(BR2_VERSION_FULL)
 
 include docs/manual/manual.mk
--include $(foreach dir,$(BR2_EXTERNAL_DIRS),$(dir)/docs/*/*.mk)
+-include $(foreach dir,$(BR2_EXTERNAL_DIRS),$(sort $(wildcard $(dir)/docs/*/*.mk)))
 
 .PHONY: $(noconfig_targets)
 
index bc886c78a2cdeb4488d6e01ce24f7b3dd365f3ca..22240bceeaea843411e771be8ce49e0b1423bfc2 100644 (file)
@@ -1 +1 @@
-include package/gstreamer/*/*.mk
+include $(sort $(wildcard package/gstreamer/*/*.mk))
index 5b748e33fb155916200cf2e9f7c7a85f7a55e4ab..8530ff027a547c750262627ba22dbf2eb6a3ce3f 100644 (file)
@@ -1 +1 @@
-include package/gstreamer1/*/*.mk
+include $(sort $(wildcard package/gstreamer1/*/*.mk))
index 48de1e71f2f91a39b238da913d79db03134f0422..dd07884c7eef40ce271d41cd9acb3ab66a773663 100644 (file)
@@ -25,4 +25,4 @@ $(error No prefix selected for external toolchain package $(BR2_PACKAGE_PROVIDES
 endif
 endif
 
-include toolchain/toolchain-external/*/*.mk
+include $(sort $(wildcard toolchain/toolchain-external/*/*.mk))