Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Oct 2015 00:07:48 +0000 (UTC)
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r289725 - in head: . share/man/man7
Message-ID:  <201510220007.t9M07mJo062245@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bdrewery
Date: Thu Oct 22 00:07:48 2015
New Revision: 289725
URL: https://svnweb.freebsd.org/changeset/base/289725

Log:
  Let SUBDIR_OVERRIDE with 'make buildworld' be more useful.
  
  Now it can be used to effectively "build in a subdir".  It will use the
  'cross-tools', 'libraries', and 'includes' phases of 'buildworld' to properly
  setup a WORLDTMP to use.  Then it will build 'everything' only in the
  listed SUBDIR_OVERRIDE directories.  It is still required to list custom
  library directories in LOCAL_LIB_DIRS if SUBDIR_OVERRIDE is something
  that contains libraries outside of the normal area (such as
  SUBDIR_OVERRIDE=contrib/ofed needing LOCAL_LIB_DIRS=contrib/ofed/usr.lib)
  
  Without these changes, SUBDIR_OVERRIDE with buildworld was broken or hit
  obscure failures due to missing libraries, includes, or cross compiler.
  
  SUBDIR_OVERRIDE with 'make <target that is not buildworld>' will continue to
  work as it did before although its usefulness is questionable.
  
  With a fully populated WORLDTMP, building with a SUBDIR_OVERRIDE with
  -DNO_CLEAN only takes a few minutes to start building the target
  directories.  This is still much better than building unneeded things via
  'everything' when testing small subset changes.  A BUILDFAST or
  SKIPWORLDTMP might make sense for this as well.
  
  - Add in '_worldtmp' as we still need to create WORLDTMP as later targets,
    such as '_libraries' and '_includes' use it.  This probably was avoiding
    calling '_worldtmp' to not remove WORLDTMP for debugging purposes, but
    -DNO_CLEAN can be used for that.
  
  - '_legacy' must be included since '_build-tools' uses -legacy.
    The SUBDIR_OVERRIDE change came in r95509, while -legacy being part
    of build-tools came in r113136.
  
  - 'bootstrap-tools' is still skipped as this feature is not for
     upgrades.
  
  - Fix buildworld combined with SUBDIR_OVERRIDE not installing all includes.
  
    The original change for SUBDIR_OVERRIDE in r95509 kept '_includes'
    and '_libraries' as building everything possible as the SUBDIR_OVERRIDE
    could need anything from them.  However in r96462 the real 'includes'
    target was changed from manual sub-makes to just recursing 'includes'
    on SUBDIR, thus not all includes have been installed into WORLDTMP since then
    when combined with 'buildworld'.
  
    This is not done unless calling 'make buildworld' as it would be
    unexpected to have it go into all directories when doing 'make
    SUBDIR_OVERRIDE=mydir includes'.
  
  - Also need to build the cross-compiler so it is used with --sysroot.
    If this is burdensome then telling the build to use the local compiler
    as an external compiler (thus using a proper --sysroot to WORLDTMP) is
    possible by setting CC=/usr/bin/cc, CXX=/usr/bin/c++, etc.
  
  - Don't build the lib32 distribution with SUBDIR_OVERRIDE in buildworld
    since it won't contain anything related to SUBDIR_OVERRIDE.  Testing
    of the lib32 build can be done with 'make build32'.
  
  - Document these changes in build.7
  
  Sponsored by:	EMC / Isilon Storage Division
  MFC after:	2 weeks

Modified:
  head/Makefile.inc1
  head/share/man/man7/build.7

Modified: head/Makefile.inc1
==============================================================================
--- head/Makefile.inc1	Wed Oct 21 22:31:17 2015	(r289724)
+++ head/Makefile.inc1	Thu Oct 22 00:07:48 2015	(r289725)
@@ -30,6 +30,8 @@
 #	BUILDENV_SHELL= shell to launch for the buildenv target (def:/bin/sh)
 #	WORLD_FLAGS= additional flags to pass to make(1) during buildworld
 #	KERNEL_FLAGS= additional flags to pass to make(1) during buildkernel
+#	SUBDIR_OVERRIDE="list of dirs" to build rather than everything.
+#	    All libraries and includes, and some build tools will still build.
 
 #
 # The intended user-driven targets are:
@@ -59,7 +61,7 @@
 # system here would require fine-grained ordering of all components based
 # on their dependencies.
 SRCDIR?=	${.CURDIR}
-.if defined(SUBDIR_OVERRIDE)
+.if !empty(SUBDIR_OVERRIDE)
 SUBDIR=	${SUBDIR_OVERRIDE}
 .else
 SUBDIR=	lib libexec
@@ -123,7 +125,7 @@ SUBDIR+=.WAIT
 .endif
 SUBDIR+=etc
 
-.endif	# defined(SUBDIR_OVERRIDE)
+.endif	# !empty(SUBDIR_OVERRIDE)
 
 .if defined(NOCLEAN)
 NO_CLEAN=	${NOCLEAN}
@@ -631,8 +633,16 @@ _includes:
 	@echo "--------------------------------------------------------------"
 	@echo ">>> stage 4.1: building includes"
 	@echo "--------------------------------------------------------------"
+# Special handling for SUBDIR_OVERRIDE in buildworld as they most likely need
+# headers from default SUBDIR.  Do SUBDIR_OVERRIDE includes last.
+	${_+_}cd ${.CURDIR}; ${WMAKE} SUBDIR_OVERRIDE= SHARED=symlinks \
+	    buildincludes
+	${_+_}cd ${.CURDIR}; ${WMAKE} SUBDIR_OVERRIDE= SHARED=symlinks \
+	    installincludes
+.if !empty(SUBDIR_OVERRIDE) && make(buildworld)
 	${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks buildincludes
 	${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks installincludes
+.endif
 _libraries:
 	@echo
 	@echo "--------------------------------------------------------------"
@@ -727,15 +737,13 @@ distribute32 install32: .MAKE .PHONY
 .endif
 
 WMAKE_TGTS=
-.if !defined(SUBDIR_OVERRIDE)
-WMAKE_TGTS+=	_worldtmp _legacy _bootstrap-tools
-.endif
-WMAKE_TGTS+=	_cleanobj _obj _build-tools
-.if !defined(SUBDIR_OVERRIDE)
-WMAKE_TGTS+=	_cross-tools
+WMAKE_TGTS+=	_worldtmp _legacy
+.if empty(SUBDIR_OVERRIDE)
+WMAKE_TGTS+=	_bootstrap-tools
 .endif
+WMAKE_TGTS+=	_cleanobj _obj _build-tools _cross-tools
 WMAKE_TGTS+=	_includes _libraries _depend everything
-.if defined(LIB32TMP) && ${MK_LIB32} != "no"
+.if defined(LIB32TMP) && ${MK_LIB32} != "no" && empty(SUBDIR_OVERRIDE)
 WMAKE_TGTS+=	build32
 .endif
 

Modified: head/share/man/man7/build.7
==============================================================================
--- head/share/man/man7/build.7	Wed Oct 21 22:31:17 2015	(r289724)
+++ head/share/man/man7/build.7	Thu Oct 22 00:07:48 2015	(r289725)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 31, 2014
+.Dd October 21, 2015
 .Dt BUILD 7
 .Os
 .Sh NAME
@@ -463,7 +463,19 @@ for more details.
 .It Va SUBDIR_OVERRIDE
 Override the default list of sub-directories and only build the
 sub-directory named in this variable.
-This variable is useful when debugging failed builds.
+If combined with
+.Cm buildworld
+then all libraries and includes, and some of the build tools will still build
+as well.
+When combined with
+.Cm buildworld
+it is necesarry to override
+.Va LOCAL_LIB_DIRS
+with any custom directories containing libraries.
+This allows building a subset of the system in the same way as
+.Cm buildworld
+does using its sysroot handling.
+This variable can also be useful when debugging failed builds.
 .Bd -literal -offset indent
 make some-target SUBDIR_OVERRIDE=foo/bar
 .Ed



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201510220007.t9M07mJo062245>