Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F137407002
D12841.id34633.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D12841.id34633.diff
View Options
Index: UPDATING
===================================================================
--- UPDATING
+++ UPDATING
@@ -51,6 +51,14 @@
****************************** SPECIAL WARNING: ******************************
+20171028:
+ Building in a FreeBSD src checkout will automatically created object
+ directories now rather than store files in the current directory if
+ 'make obj' was not ran. Calling 'make obj' is no longer necesarry.
+ This feature can be disabled by setting WITHOUT_AUTO_OBJ=yes in
+ /etc/src-env.conf (not /etc/src.conf), or passing the option in the
+ environment.
+
20171028:
The default MAKEOBJDIR has changed from /usr/obj/<srcdir> for native
builds, and /usr/obj/<arch>/<srcdir> for cross-builds, to a unified
Index: share/mk/src.sys.mk
===================================================================
--- share/mk/src.sys.mk
+++ share/mk/src.sys.mk
@@ -14,7 +14,7 @@
# Validate that the user didn't try setting an env-only variable in
# their src.conf. This benefits from already including bsd.mkopt.mk.
-.for var in ${__ENV_ONLY_OPTIONS}
+.for var in ${__ENV_ONLY_OPTIONS:O:u}
__presrcconf_${var}:= ${MK_${var}:U-}${WITHOUT_${var}:Uno:Dyes}${WITH_${var}:Uno:Dyes}
.endfor
@@ -22,7 +22,7 @@
_srcconf_included_: .NOTMAIN
# Validate the env-only variables.
-.for var in ${__ENV_ONLY_OPTIONS}
+.for var in ${__ENV_ONLY_OPTIONS:O:u}
__postrcconf_${var}:= ${MK_${var}:U-}${WITHOUT_${var}:Uno:Dyes}${WITH_${var}:Uno:Dyes}
.if ${__presrcconf_${var}} != ${__postrcconf_${var}}
.error Option ${var} may only be defined in ${SRC_ENV_CONF}, environment, or make argument, not ${SRCCONF}.
Index: share/mk/src.sys.obj.mk
===================================================================
--- share/mk/src.sys.obj.mk
+++ share/mk/src.sys.obj.mk
@@ -93,7 +93,68 @@
OBJROOT:= ${OBJTOP}/
.endif
-# Assign this directory as .OBJDIR if possible
+# Try to enable MK_AUTO_OBJ by default if we can write to the OBJROOT. Only
+# do this if AUTO_OBJ is not disabled by the user, not cleaning, and this
+# is the first make ran.
+.if ${.MAKE.LEVEL} == 0 && \
+ ${MK_AUTO_OBJ} == "no" && empty(.MAKEOVERRIDES:MMK_AUTO_OBJ) && \
+ !defined(WITHOUT_AUTO_OBJ) && !make(showconfig) && !make(print-dir) && \
+ !defined(NO_OBJ) && \
+ (${.TARGETS} == "" || ${.TARGETS:Nclean*:N*clean:Ndestroy*} != "")
+# Find the last existing directory component and check if we can write to it.
+# If the last component is a symlink then recurse on the new path.
+CheckAutoObj= \
+DirIsCreatable() { \
+ [ -w "$${1}" ] && return 0; \
+ d="$${1}"; \
+ IFS=/; \
+ set -- $${d}; \
+ unset dir; \
+ while [ $$\# -gt 0 ]; do \
+ d="$${1}"; \
+ shift; \
+ if ! [ -d "$${dir}$${d}/" ]; then \
+ if [ -L "$${dir}$${d}" ]; then \
+ dir="$$(readlink "$${dir}$${d}")/"; \
+ for d in "$${@}"; do \
+ dir="$${dir}$${d}/"; \
+ done; \
+ ret=0; \
+ DirIsCreatable "$${dir%/}" || ret=$$?; \
+ return $${ret}; \
+ else \
+ break; \
+ fi; \
+ fi; \
+ dir="$${dir}$${d}/"; \
+ done; \
+ [ -w "$${dir}" ]; \
+}; \
+CheckAutoObj() { \
+ if DirIsCreatable "$${1}"; then \
+ echo yes; \
+ else \
+ echo no; \
+ fi; \
+}
+.if !empty(MAKEOBJDIRPREFIX)
+WANTED_OBJDIR= ${MAKEOBJDIRPREFIX}${.CURDIR}
+.else
+WANTED_OBJDIR= ${MAKEOBJDIR}
+.endif
+OBJDIR_WRITABLE!= \
+ ${CheckAutoObj}; CheckAutoObj "${WANTED_OBJDIR}" || echo no
+# Export the decision to sub-makes.
+MK_AUTO_OBJ:= ${OBJDIR_WRITABLE}
+.export MK_AUTO_OBJ
+.elif make(showconfig)
+# Need to export for showconfig internally running make -dg1. It is enabled
+# in sys.mk by default.
+.export MK_AUTO_OBJ
+.endif # ${MK_AUTO_OBJ} == "no" && ...
+
+# Assign this directory as .OBJDIR if possible after determining if AUTO_OBJ
+# can be enabled by default.
.if ${MK_AUTO_OBJ} == "no"
# The expected OBJDIR already exists, set it as .OBJDIR.
.if !empty(MAKEOBJDIRPREFIX) && exists(${MAKEOBJDIRPREFIX}${.CURDIR})
Index: share/mk/sys.mk
===================================================================
--- share/mk/sys.mk
+++ share/mk/sys.mk
@@ -20,6 +20,12 @@
__DEFAULT_YES_OPTIONS+= \
UNIFIED_OBJDIR
+# src.sys.obj.mk enables AUTO_OBJ by default if possible but it is otherwise
+# disabled. Ensure src.conf.5 shows it as default on.
+.if make(showconfig)
+__DEFAULT_YES_OPTIONS+= AUTO_OBJ
+.endif
+
# Some options we need now
__DEFAULT_NO_OPTIONS= \
DIRDEPS_BUILD \
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
Mon, Nov 24, 4:04 AM (7 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26047475
Default Alt Text
D12841.id34633.diff (4 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