[Buildroot] [PATCH v3 1/5] Makefile: don't depend on the umask

Guido Martínez guido at vanguardiasur.com.ar
Mon Nov 17 17:19:06 UTC 2014


Some packages and BR itself create files and directories on the target
with cp/mkdir/etc which depend on the umask at the time of building.

To fix this, use a trick inside the Makefile which wraps all rules when
the umask is not 0022. This sets the umask at the top level, and then
the building process continues as usual.

Signed-off-by: Guido Martínez <guido at vanguardiasur.com.ar>
---
 Makefile | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/Makefile b/Makefile
index 471edf9..5ad8235 100644
--- a/Makefile
+++ b/Makefile
@@ -24,6 +24,19 @@
 # You shouldn't need to mess with anything beyond this point...
 #--------------------------------------------------------------
 
+# Trick for always running with a fixed umask
+UMASK=0022
+ifneq ($(shell umask),$(UMASK))
+.PHONY:*
+
+all:
+	@umask $(UMASK) && make --no-print-directory
+
+%:
+	@umask $(UMASK) && make --no-print-directory $@
+
+else # umask
+
 # This is our default rule, so must come first
 all:
 
@@ -932,3 +945,5 @@ include docs/manual/manual.mk
 -include $(BR2_EXTERNAL)/docs/*/*.mk
 
 .PHONY: $(noconfig_targets)
+
+endif #umask
-- 
2.1.3



More information about the buildroot mailing list