Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F108003767
D12841.id34485.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D12841.id34485.diff
View Options
Index: share/mk/src.sys.obj.mk
===================================================================
--- share/mk/src.sys.obj.mk
+++ share/mk/src.sys.obj.mk
@@ -86,6 +86,63 @@
OBJROOT:= ${OBJTOP}/
.endif
+# Check how to handle default MK_AUTO_OBJ by creating/testing write to all
+# directories needed, and then cleaning up anything we did on exit.
+.if ${MK_AUTO_OBJ} == "no" && empty(.MAKEOVERRIDES:MMK_AUTO_OBJ) && \
+ !defined(WITHOUT_AUTO_OBJ) && !make(showconfig) && !make(print-dir)
+.if !defined(OBJDIR_WRITE_${OBJROOT:hash})
+CheckAutoObj= \
+CheckAutoObj() { \
+ if [ -w "$${1}" ]; then \
+ echo yes; \
+ exit 0; \
+ fi; \
+ trap 'CleanupAutoObj' EXIT HUP INT TERM QUIT; \
+ IFS=/; \
+ d="$${1}"; \
+ set -- $${d}; \
+ for d in "$${@}"; do \
+ dir="$${dir}$${d}/"; \
+ [ -d "$${dir}" ] && continue; \
+ if ! mkdir "$${dir}"; then \
+ echo no; \
+ exit 0; \
+ fi; \
+ created="$${dir} $${created}"; \
+ done; \
+ if [ -w "$${dir}" ]; then \
+ echo yes; \
+ exit 0; \
+ fi; \
+ echo no; \
+ exit 0; \
+}; \
+CleanupAutoObj() { \
+ IFS=" "; \
+ for dir in $${created}; do \
+ rmdir $${dir}; \
+ done; \
+}
+
+OBJDIR_WRITE_${OBJROOT:hash}!= \
+ ${CheckAutoObj}; CheckAutoObj "${OBJROOT}" 2>/dev/null || :
+.export OBJDIR_WRITE_${OBJROOT:hash}
+.endif
+.if ${OBJDIR_WRITE_${OBJROOT:hash}} == "yes"
+# Make AUTO_OBJ default and reevaluate it
+__DEFAULT_YES_OPTIONS+= AUTO_OBJ
+.undef MK_AUTO_OBJ
+.include <bsd.mkopt.mk>
+.if ${MK_AUTO_OBJ} == "yes"
+.export MK_AUTO_OBJ
+.endif
+.endif
+.elif make(showconfig)
+# Lie to showconfig so it gets a proper default displayed. auto.obj.mk won't
+# be loaded with make(showconifg).
+MK_AUTO_OBJ= yes
+.endif # !defined(WITHOUT_AUTO_OBJ)
+
# Assign this directory as .OBJDIR if possible
.if ${MK_AUTO_OBJ} == "no"
# The expected OBJDIR already exists, set it as .OBJDIR.
Index: tools/build/options/WITHOUT_AUTO_OBJ
===================================================================
--- /dev/null
+++ tools/build/options/WITHOUT_AUTO_OBJ
@@ -0,0 +1,3 @@
+.\" $FreeBSD$
+Disable automatic creation of objdirs.
+This is enabled by default if the wanted OBJDIR is writable by the current user.
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jan 21, 10:16 AM (16 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16007639
Default Alt Text
D12841.id34485.diff (2 KB)
Attached To
Mode
D12841: Enable AUTO_OBJ by default if the OBJDIR is writable, only for in-tree builds.
Attached
Detach File
Event Timeline
Log In to Comment