Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F139422861
D12841.id34475.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D12841.id34475.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,55 @@
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"
+.if !defined(OBJDIR_WRITE_${OBJROOT:hash})
+CheckAutoObj= \
+CheckAutoObj() { \
+ if [ -w "$${1}" ]; then \
+ echo yes; \
+ exit 0; \
+ fi; \
+ trap 'CleanupAutoObj' EXIT; \
+ 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>
+.endif
+.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.
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 12, 10:11 PM (11 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26913853
Default Alt Text
D12841.id34475.diff (1 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