From eef72759b5f3b77381fd8a0a730bc39099f62429 Mon Sep 17 00:00:00 2001 From: "Simon J. Gerraty" Date: Wed, 7 Oct 2015 00:24:27 +0000 Subject: [PATCH] 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 --- share/mk/bsd.incs.mk | 4 ++-- share/mk/bsd.man.mk | 4 ++-- share/mk/bsd.nls.mk | 2 +- share/mk/bsd.sys.mk | 10 +++++----- share/mk/meta.stage.mk | 25 ++++++++++++++----------- 5 files changed, 24 insertions(+), 21 deletions(-) diff --git a/share/mk/bsd.incs.mk b/share/mk/bsd.incs.mk index 1c178b07d38e..3f9680a6ef23 100644 --- a/share/mk/bsd.incs.mk +++ b/share/mk/bsd.incs.mk @@ -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 diff --git a/share/mk/bsd.man.mk b/share/mk/bsd.man.mk index a5422ea0400c..bbb47b9df933 100644 --- a/share/mk/bsd.man.mk +++ b/share/mk/bsd.man.mk @@ -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@man$s@} STAGE_SETS+= ${_mansets} .for _page in ${MAN} @@ -137,7 +137,7 @@ STAGE_DIR.man${_page:T:E}?= ${STAGE_OBJTOP}${MANDIR}${_page:T:E}${MANSUBDIR} .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@stage_files.$s@} .endif diff --git a/share/mk/bsd.nls.mk b/share/mk/bsd.nls.mk index bf8305cb459e..c578361fdd53 100644 --- a/share/mk/bsd.nls.mk +++ b/share/mk/bsd.nls.mk @@ -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} diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk index 74e28346deed..044b668ebada 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -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 diff --git a/share/mk/meta.stage.mk b/share/mk/meta.stage.mk index 7f6c3b3691c2..cdf3e36e733d 100644 --- a/share/mk/meta.stage.mk +++ b/share/mk/meta.stage.mk @@ -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 ${.TARGET: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@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