svn commit: r288964 - head/share/mk

Simon J. Gerraty sjg at FreeBSD.org
Wed Oct 7 00:24:29 UTC 2015


Author: sjg
Date: Wed Oct  7 00:24:27 2015
New Revision: 288964
URL: https://svnweb.freebsd.org/changeset/base/288964

Log:
  In jobs mode we can use .ORDER to force stage_links to run after other
  stage_* targets.
  In non-jobs mode we can achieve the same result by simply introducing
  the targets in the correct order.
  Thus in bsd*.mk we simply add targets to STAGE_TARGETS which we
  realize in meta.stage.mk
  
  Reviewed by: bdrewery

Modified:
  head/share/mk/bsd.incs.mk
  head/share/mk/bsd.man.mk
  head/share/mk/bsd.nls.mk
  head/share/mk/bsd.sys.mk
  head/share/mk/meta.stage.mk

Modified: head/share/mk/bsd.incs.mk
==============================================================================
--- head/share/mk/bsd.incs.mk	Tue Oct  6 23:42:58 2015	(r288963)
+++ head/share/mk/bsd.incs.mk	Wed Oct  7 00:24:27 2015	(r288964)
@@ -91,9 +91,9 @@ realinstall: installincludes
 
 .if ${MK_STAGING} != "no" && !defined(_SKIP_BUILD)
 .if !defined(NO_STAGE_INCLUDES)
-staging: stage_includes
+STAGE_TARGETS+= stage_includes
 .if !empty(INCSLINKS)
-staging: stage_symlinks
+STAGE_TARGETS+= stage_symlinks
 STAGE_SYMLINKS.INCS= ${INCSLINKS}
 .endif
 .endif

Modified: head/share/mk/bsd.man.mk
==============================================================================
--- head/share/mk/bsd.man.mk	Tue Oct  6 23:42:58 2015	(r288963)
+++ head/share/mk/bsd.man.mk	Wed Oct  7 00:24:27 2015	(r288964)
@@ -128,7 +128,7 @@ ZEXT=		${MCOMPRESS_EXT}
 
 .if defined(MAN) && !empty(MAN)
 .if ${MK_STAGING_MAN} == "yes"
-staging: stage_files
+STAGE_TARGETS+= stage_files
 _mansets:= ${MAN:E:O:u:M*[1-9]:@s at man$s@}
 STAGE_SETS+= ${_mansets}
 .for _page in ${MAN}
@@ -137,7 +137,7 @@ STAGE_DIR.man${_page:T:E}?= ${STAGE_OBJT
 .endfor
 .if !empty(MLINKS)
 STAGE_SETS+= mlinks
-staging: stage_links
+STAGE_TARGETS+= stage_links
 STAGE_LINKS.mlinks:= ${MLINKS:@f@${f:S,^,${MANDIR}${f:E}${MANSUBDIR}/,}@}
 stage_links.mlinks: ${_mansets:@s at stage_files.$s@}
 .endif

Modified: head/share/mk/bsd.nls.mk
==============================================================================
--- head/share/mk/bsd.nls.mk	Tue Oct  6 23:42:58 2015	(r288963)
+++ head/share/mk/bsd.nls.mk	Wed Oct  7 00:24:27 2015	(r288964)
@@ -63,7 +63,7 @@ NLSDIR?=	${SHAREDIR}/nls
 #
 .if ${MK_STAGING_PROG} == "yes"
 .if !defined(_SKIP_BUILD)
-staging:   stage_symlinks
+STAGE_TARGETS+= stage_symlinks
 .endif
 STAGE_SYMLINKS.NLS= ${NLSSYMLINKS}
 STAGE_SYMLINKS_DIR.NLS= ${STAGE_OBJTOP}

Modified: head/share/mk/bsd.sys.mk
==============================================================================
--- head/share/mk/bsd.sys.mk	Tue Oct  6 23:42:58 2015	(r288963)
+++ head/share/mk/bsd.sys.mk	Wed Oct  7 00:24:27 2015	(r288964)
@@ -205,7 +205,7 @@ stage_as.prog: ${PROG}
 .else
 STAGE_SETS+= prog
 stage_files.prog: ${PROG}
-staging: stage_files
+STAGE_TARGETS+= stage_files
 .endif
 .endif
 .endif
@@ -251,18 +251,18 @@ beforebuild: stage_includes
 
 .for t in stage_libs stage_files stage_as
 .if target($t)
-staging: $t
+STAGE_TARGETS+= $t
 .endif
 .endfor
 
 .if !empty(STAGE_AS_SETS)
-staging: stage_as
+STAGE_TARGETS+= stage_as
 .endif
 
 .if !empty(_LIBS) || ${MK_STAGING_PROG} != "no"
 
 .if !empty(LINKS)
-staging: stage_links
+STAGE_TARGETS+= stage_links
 .if ${MAKE_VERSION} < 20131001
 stage_links.links: ${_LIBS} ${PROG}
 .endif
@@ -271,7 +271,7 @@ STAGE_LINKS.links= ${LINKS}
 .endif
 
 .if !empty(SYMLINKS)
-staging: stage_symlinks
+STAGE_TARGETS+= stage_symlinks
 STAGE_SETS+= links
 STAGE_SYMLINKS.links= ${SYMLINKS}
 .endif

Modified: head/share/mk/meta.stage.mk
==============================================================================
--- head/share/mk/meta.stage.mk	Tue Oct  6 23:42:58 2015	(r288963)
+++ head/share/mk/meta.stage.mk	Wed Oct  7 00:24:27 2015	(r288964)
@@ -24,6 +24,8 @@ _dirdep = ${RELDIR}.${MACHINE}
 _dirdep = ${RELDIR}
 .endif
 
+CLEANFILES+= .dirdep
+
 # this allows us to trace dependencies back to their src dir
 .dirdep:
 	@echo '${_dirdep}' > $@
@@ -134,7 +136,7 @@ _STAGE_AS_BASENAME_USE:        .USE ${.T
 
 .if !empty(STAGE_INCSDIR)
 STAGE_TARGETS += stage_incs
-STAGE_INCS ?= ${.ALLSRC:N.dirdep}
+STAGE_INCS ?= ${.ALLSRC:N.dirdep:Nstage_*}
 
 stage_includes: stage_incs
 stage_incs:	.dirdep
@@ -145,7 +147,7 @@ stage_incs:	.dirdep
 .if !empty(STAGE_LIBDIR)
 STAGE_TARGETS += stage_libs
 
-STAGE_LIBS ?= ${.ALLSRC:N.dirdep}
+STAGE_LIBS ?= ${.ALLSRC:N.dirdep:Nstage_*}
 
 stage_libs:	.dirdep
 	@${STAGE_FILE_SCRIPT}; StageFiles ${STAGE_LIBDIR:${STAGE_DIR_FILTER}} ${STAGE_LIBS}
@@ -177,8 +179,8 @@ CLEANFILES += ${STAGE_SETS:@s at stage*$s@}
 
 # some makefiles need to populate multiple directories
 .for s in ${STAGE_SETS:O:u}
-STAGE_FILES.$s ?= ${.ALLSRC:N.dirdep}
-STAGE_SYMLINKS.$s ?= ${.ALLSRC:N.dirdep}
+STAGE_FILES.$s ?= ${.ALLSRC:N.dirdep:Nstage_*}
+STAGE_SYMLINKS.$s ?= ${.ALLSRC:N.dirdep:Nstage_*}
 STAGE_LINKS_DIR.$s ?= ${STAGE_OBJTOP}
 STAGE_SYMLINKS_DIR.$s ?= ${STAGE_OBJTOP}
 
@@ -224,7 +226,7 @@ STAGE_TARGETS += stage_as
 # each ${file} will be staged as ${STAGE_AS_${file:T}}
 # one could achieve the same with SYMLINKS
 .for s in ${STAGE_AS_SETS:O:u}
-STAGE_AS.$s ?= ${.ALLSRC:N.dirdep}
+STAGE_AS.$s ?= ${.ALLSRC:N.dirdep:Nstage_*}
 
 stage_as:	stage_as.$s
 stage_as.$s:	.dirdep
@@ -237,15 +239,16 @@ stage_as.$s:	.dirdep
 CLEANFILES += ${STAGE_TARGETS} stage_incs stage_includes
 
 # stage_*links usually needs to follow any others.
-.if !empty(STAGE_SETS) && !empty(STAGE_TARGETS:Nstage_links)
-.for s in ${STAGE_SETS:O:u}
-stage_links.$s: ${STAGE_TARGETS:Nstage_links:O:u}
+# for non-jobs mode the order here matters
+staging: ${STAGE_TARGETS:N*_links} ${STAGE_TARGETS:M*_links}
+
+.if ${.MAKE.JOBS:U0} > 0 && ${STAGE_TARGETS:M*_links} != ""
+# the above isn't sufficient
+.for t in ${STAGE_TARGETS:N*links:O:u}
+.ORDER: $t stage_links
 .endfor
 .endif
 
-# make sure this exists
-staging:
-
 # generally we want staging to wait until everything else is done
 STAGING_WAIT ?= .WAIT
 


More information about the svn-src-all mailing list