|
@@ -29,16 +29,46 @@ SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
|
|
else if [ -x /bin/bash ]; then echo /bin/bash; \
|
|
else if [ -x /bin/bash ]; then echo /bin/bash; \
|
|
else echo sh; fi; fi)
|
|
else echo sh; fi; fi)
|
|
|
|
|
|
-# Trick for always running with a fixed umask
|
|
|
|
-UMASK = 0022
|
|
|
|
-ifneq ($(shell umask),$(UMASK))
|
|
|
|
|
|
+# Set O variable if not already done on the command line;
|
|
|
|
+# or avoid confusing packages that can use the O=<dir> syntax for out-of-tree
|
|
|
|
+# build by preventing it from being forwarded to sub-make calls.
|
|
|
|
+ifneq ("$(origin O)", "command line")
|
|
|
|
+O := output
|
|
|
|
+else
|
|
|
|
+# Other packages might also support Linux-style out of tree builds
|
|
|
|
+# with the O=<dir> syntax (E.G. BusyBox does). As make automatically
|
|
|
|
+# forwards command line variable definitions those packages get very
|
|
|
|
+# confused. Fix this by telling make to not do so.
|
|
|
|
+MAKEOVERRIDES :=
|
|
|
|
+# Strangely enough O is still passed to submakes with MAKEOVERRIDES
|
|
|
|
+# (with make 3.81 atleast), the only thing that changes is the output
|
|
|
|
+# of the origin function (command line -> environment).
|
|
|
|
+# Unfortunately some packages don't look at origin (E.G. uClibc 0.9.31+)
|
|
|
|
+# To really make O go away, we have to override it.
|
|
|
|
+override O := $(O)
|
|
|
|
+endif
|
|
|
|
+
|
|
|
|
+# Check if the current Buildroot execution meets all the pre-requisites.
|
|
|
|
+# If they are not met, Buildroot will actually do its job in a sub-make meeting
|
|
|
|
+# its pre-requisites, which is:
|
|
|
|
+# 1- Permissive enough umask:
|
|
|
|
+# Wrong or too restrictive umask will prevent Buildroot and packages from
|
|
|
|
+# creating files and directories.
|
|
|
|
+
|
|
|
|
+REQ_UMASK = 0022
|
|
|
|
+
|
|
|
|
+# we need to pass O= everywhere we call back into the toplevel makefile
|
|
|
|
+EXTRAMAKEARGS = O=$(O)
|
|
|
|
+
|
|
|
|
+# Check Buildroot execution pre-requisites here.
|
|
|
|
+ifneq ($(shell umask),$(REQ_UMASK))
|
|
.PHONY: _all $(MAKECMDGOALS)
|
|
.PHONY: _all $(MAKECMDGOALS)
|
|
|
|
|
|
$(MAKECMDGOALS): _all
|
|
$(MAKECMDGOALS): _all
|
|
@:
|
|
@:
|
|
|
|
|
|
_all:
|
|
_all:
|
|
- @umask $(UMASK) && $(MAKE) --no-print-directory $(MAKECMDGOALS)
|
|
|
|
|
|
+ @umask $(REQ_UMASK) && $(MAKE) --no-print-directory $(MAKECMDGOALS)
|
|
|
|
|
|
else # umask
|
|
else # umask
|
|
|
|
|
|
@@ -109,27 +139,6 @@ endif
|
|
# Include some helper macros and variables
|
|
# Include some helper macros and variables
|
|
include support/misc/utils.mk
|
|
include support/misc/utils.mk
|
|
|
|
|
|
-# Set O variable if not already done on the command line;
|
|
|
|
-# or avoid confusing packages that can use the O=<dir> syntax for out-of-tree
|
|
|
|
-# build by preventing it from being forwarded to sub-make calls.
|
|
|
|
-ifneq ("$(origin O)", "command line")
|
|
|
|
-O := output
|
|
|
|
-else
|
|
|
|
-# other packages might also support Linux-style out of tree builds
|
|
|
|
-# with the O=<dir> syntax (E.G. BusyBox does). As make automatically
|
|
|
|
-# forwards command line variable definitions those packages get very
|
|
|
|
-# confused. Fix this by telling make to not do so
|
|
|
|
-MAKEOVERRIDES =
|
|
|
|
-# strangely enough O is still passed to submakes with MAKEOVERRIDES
|
|
|
|
-# (with make 3.81 atleast), the only thing that changes is the output
|
|
|
|
-# of the origin function (command line -> environment).
|
|
|
|
-# Unfortunately some packages don't look at origin (E.G. uClibc 0.9.31+)
|
|
|
|
-# To really make O go away, we have to override it.
|
|
|
|
-override O := $(O)
|
|
|
|
-# we need to pass O= everywhere we call back into the toplevel makefile
|
|
|
|
-EXTRAMAKEARGS = O=$(O)
|
|
|
|
-endif
|
|
|
|
-
|
|
|
|
# Set variables related to in-tree or out-of-tree build.
|
|
# Set variables related to in-tree or out-of-tree build.
|
|
ifeq ($(O),output)
|
|
ifeq ($(O),output)
|
|
CONFIG_DIR := $(TOPDIR)
|
|
CONFIG_DIR := $(TOPDIR)
|