Date: Thu, 2 Aug 2018 21:33:45 +0000 (UTC) From: "Simon J. Gerraty" <sjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r337186 - head/share/mk Message-ID: <201808022133.w72LXjOq054601@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: sjg Date: Thu Aug 2 21:33:45 2018 New Revision: 337186 URL: https://svnweb.freebsd.org/changeset/base/337186 Log: Update dirdeps.mk et al to latest dirdeps.mk and meta.autodep.mk will now look for Makefile.depend.options to handle optional dependencies, the work is all done by dirdeps-options.mk Also update to latest meta.stage.mk and gendirdeps.mk Reviewed by: bdrewery Differential Revision: https://reviews.freebsd.org/D15701 Added: head/share/mk/dirdeps-options.mk (contents, props changed) Modified: head/share/mk/Makefile head/share/mk/bsd.files.mk head/share/mk/bsd.sys.mk head/share/mk/dirdeps.mk head/share/mk/gendirdeps.mk head/share/mk/local.autodep.mk head/share/mk/local.dirdeps.mk head/share/mk/local.gendirdeps.mk head/share/mk/local.meta.sys.mk head/share/mk/meta.autodep.mk head/share/mk/meta.stage.mk head/share/mk/meta.sys.mk head/share/mk/meta2deps.py Modified: head/share/mk/Makefile ============================================================================== --- head/share/mk/Makefile Thu Aug 2 21:25:32 2018 (r337185) +++ head/share/mk/Makefile Thu Aug 2 21:33:45 2018 (r337186) @@ -57,6 +57,7 @@ FILES= \ bsd.sys.mk \ bsd.test.mk \ dirdeps.mk \ + dirdeps-options.mk \ gendirdeps.mk \ install-new.mk \ meta.autodep.mk \ Modified: head/share/mk/bsd.files.mk ============================================================================== --- head/share/mk/bsd.files.mk Thu Aug 2 21:25:32 2018 (r337185) +++ head/share/mk/bsd.files.mk Thu Aug 2 21:33:45 2018 (r337186) @@ -120,8 +120,10 @@ realinstall: installfiles .if ${MK_STAGING} != "no" .if !empty(STAGE_SETS) buildfiles: stage_files +STAGE_TARGETS+= stage_files .if !empty(STAGE_AS_SETS) buildfiles: stage_as +STAGE_TARGETS+= stage_as .endif .endif .endif Modified: head/share/mk/bsd.sys.mk ============================================================================== --- head/share/mk/bsd.sys.mk Thu Aug 2 21:25:32 2018 (r337185) +++ head/share/mk/bsd.sys.mk Thu Aug 2 21:33:45 2018 (r337186) @@ -340,7 +340,7 @@ STAGE_TARGETS+= $t STAGE_TARGETS+= stage_as .endif -.if !empty(_LIBS) || (${MK_STAGING_PROG} != "no" && !defined(INTERNALPROG)) +.if !empty(STAGE_TARGETS) || (${MK_STAGING_PROG} != "no" && !defined(INTERNALPROG)) .if !empty(LINKS) STAGE_TARGETS+= stage_links Added: head/share/mk/dirdeps-options.mk ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/mk/dirdeps-options.mk Thu Aug 2 21:33:45 2018 (r337186) @@ -0,0 +1,73 @@ +# $FreeBSD$ +# $Id: dirdeps-options.mk,v 1.8 2018/05/29 22:31:21 sjg Exp $ +# +# @(#) Copyright (c) 2018, Simon J. Gerraty +# +# This file is provided in the hope that it will +# be of use. There is absolutely NO WARRANTY. +# Permission to copy, redistribute or otherwise +# use this file is hereby granted provided that +# the above copyright notice and this notice are +# left intact. +# +# Please send copies of changes and bug-fixes to: +# sjg@crufty.net +# + +## +# +# This makefile is used to deal with optional DIRDEPS. +# +# It is to be included by Makefile.depend.options in a +# directory which has DIRDEPS affected by optional features. +# Makefile.depend.options should set DIRDEPS_OPTIONS and +# may also set specific DIRDEPS.* for those options. +# +# If a Makefile.depend.options file exists, it will be included by +# dirdeps.mk and meta.autodep.mk +# +# We include local.dirdeps-options.mk which may also define DIRDEPS.* +# for options. +# +# Thus a directory, that is affected by an option FOO would have +# a Makefile.depend.options that sets +# DIRDEPS_OPTIONS= FOO +# It can also set either/both of +# DIRDEPS.FOO.yes +# DIRDEPS.FOO.no +# to whatever applies for that dir, or it can rely on globals +# set in local.dirdeps-options.mk +# Either way, we will .undef DIRDEPS.* when done. + +# This should have been set by Makefile.depend.options +# before including us +DIRDEPS_OPTIONS ?= + +# pickup any DIRDEPS.* we need +.-include <local.dirdeps-options.mk> + +.if ${.MAKE.LEVEL} == 0 +# :U below avoids potential errors when we := +.for o in ${DIRDEPS_OPTIONS:tu} +DIRDEPS += ${DIRDEPS.$o.${MK_$o:U}:U} +.endfor +DIRDEPS := ${DIRDEPS:O:u} +# avoid cross contamination +.for o in ${DIRDEPS_OPTIONS:tu} +.undef DIRDEPS.$o.yes DIRDEPS.$o.no +.endfor +.else +# whether options are enabled or not, +# we want to filter out the relevant DIRDEPS.* +# we should only be included by meta.autodep.mk +# if dependencies are to be updated +.for o in ${DIRDEPS_OPTIONS:tu} +.for d in ${DIRDEPS.$o.yes} ${DIRDEPS.$o.no} +.if exists(${SRCTOP}/$d) +GENDIRDEPS_FILTER += N$d* +.elif exists(${SRCTOP}/${d:R}) +GENDIRDEPS_FILTER += N${d:R}* +.endif +.endfor +.endfor +.endif Modified: head/share/mk/dirdeps.mk ============================================================================== --- head/share/mk/dirdeps.mk Thu Aug 2 21:25:32 2018 (r337185) +++ head/share/mk/dirdeps.mk Thu Aug 2 21:33:45 2018 (r337186) @@ -1,18 +1,18 @@ # $FreeBSD$ -# $Id: dirdeps.mk,v 1.86 2017/03/01 20:26:51 sjg Exp $ +# $Id: dirdeps.mk,v 1.96 2018/06/20 22:26:39 sjg Exp $ # Copyright (c) 2010-2013, Juniper Networks, Inc. # All rights reserved. -# +# # Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: +# modification, are permitted provided that the following conditions +# are met: # 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. +# notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# +# documentation and/or other materials provided with the distribution. +# # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -23,7 +23,7 @@ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # Much of the complexity here is for supporting cross-building. # If a tree does not support that, simply using plain Makefile.depend @@ -57,7 +57,7 @@ # .MAKE.DEPENDFILE_PREFIX) to refer to these makefiles to # distinguish them from others. # -# Before each Makefile.depend file is read, we set +# Before each Makefile.depend file is read, we set # DEP_RELDIR to be the RELDIR (path relative to SRCTOP) for # its directory, and DEP_MACHINE etc according to the .<target_spec> # represented by the suffix of the corresponding target. @@ -90,7 +90,7 @@ # # For example: # -# # Always list MACHINE first, +# # Always list MACHINE first, # # other variables might be optional. # TARGET_SPEC_VARS = MACHINE TARGET_OS # .if ${TARGET_SPEC:Uno:M*,*} != "" @@ -102,7 +102,7 @@ # # and deal with MACHINE=${TARGET_SPEC} in the environment. # TARGET_SPEC = # # export but do not track -# .export-env TARGET_SPEC +# .export-env TARGET_SPEC # .export ${TARGET_SPEC_VARS} # .for v in ${TARGET_SPEC_VARS:O:u} # .if empty($v) @@ -138,6 +138,14 @@ # built for. # +.if !target(bootstrap) && (make(bootstrap) || \ + make(bootstrap-this) || \ + make(bootstrap-recurse) || \ + make(bootstrap-empty)) +# disable most of below +.MAKE.LEVEL = 1 +.endif + # touch this at your peril _DIRDEP_USE_LEVEL?= 0 .if ${.MAKE.LEVEL} == ${_DIRDEP_USE_LEVEL} @@ -321,7 +329,7 @@ _DEP_RELDIR := ${DEP_RELDIR} .endif # DIRDEPS_CACHE can be very handy for debugging. -# Also if repeatedly building the same target, +# Also if repeatedly building the same target, # we can avoid the overhead of re-computing the tree dependencies. MK_DIRDEPS_CACHE ?= no BUILD_DIRDEPS_CACHE ?= no @@ -434,7 +442,7 @@ _only_machines := ${_only_machines:O:u} # make sure we have a starting place? DIRDEPS ?= ${RELDIR} -.endif # target +.endif # target .if !defined(NO_DIRDEPS) && !defined(NO_DIRDEPS_BELOW) .if ${MK_DIRDEPS_CACHE} == "yes" @@ -444,7 +452,7 @@ build-dirdeps: M_oneperline = @x@\\${.newline} $$x@ -.if ${BUILD_DIRDEPS_CACHE} == "no" +.if ${BUILD_DIRDEPS_CACHE} == "no" .if !target(dirdeps-cached) # we do this via sub-make BUILD_DIRDEPS = no @@ -462,7 +470,7 @@ dirdeps-cached: ${DIRDEPS_CACHE} .MAKE BUILD_DIRDEPS_MAKEFILE ?= ${MAKEFILE} BUILD_DIRDEPS_TARGETS ?= ${.TARGETS} -# we need the .meta file to ensure we update if +# we need the .meta file to ensure we update if # any of the Makefile.depend* changed. # We do not want to compare the command line though. ${DIRDEPS_CACHE}: .META .NOMETA_CMP @@ -521,6 +529,7 @@ _this_dir := ${SRCTOP}/${DEP_RELDIR} # on rare occasions, there can be a need for extra help _dep_hack := ${_this_dir}/${.MAKE.DEPENDFILE_PREFIX}.inc .-include <${_dep_hack}> +.-include <${_dep_hack:R}.options> .if ${DEP_RELDIR} != ${_DEP_RELDIR} || ${DEP_TARGET_SPEC} != ${TARGET_SPEC} # this should be all @@ -529,10 +538,14 @@ _machines := ${DEP_MACHINE} # this is the machine list we actually use below _machines := ${_only_machines} -.if defined(HOSTPROG) || ${DEP_MACHINE} == "host" +.if defined(HOSTPROG) || ${DEP_MACHINE:Nhost*} == "" # we need to build this guy's dependencies for host as well. +.if ${DEP_MACHINE:Nhost*} == "" +_machines += ${DEP_MACHINE} +.else _machines += host .endif +.endif _machines := ${_machines:O:u} .endif @@ -570,7 +583,7 @@ _build_dirs += ${_machines:N${DEP_TARGET_SPEC}:@m@${_C .if ${_debug_reldir} .info ${DEP_RELDIR}.${DEP_TARGET_SPEC}: DIRDEPS='${DIRDEPS}' -.info ${DEP_RELDIR}.${DEP_TARGET_SPEC}: _machines='${_machines}' +.info ${DEP_RELDIR}.${DEP_TARGET_SPEC}: _machines='${_machines}' .endif .if !empty(DIRDEPS) @@ -578,7 +591,7 @@ _build_dirs += ${_machines:N${DEP_TARGET_SPEC}:@m@${_C DEP_DIRDEPS_FILTER = \ ${DIRDEPS_FILTER.${DEP_TARGET_SPEC}:U} \ ${TARGET_SPEC_VARS:@v@${DIRDEPS_FILTER.${DEP_$v}:U}@} \ - ${DIRDEPS_FILTER:U} + ${DIRDEPS_FILTER:U} .if empty(DEP_DIRDEPS_FILTER) # something harmless DEP_DIRDEPS_FILTER = U @@ -587,7 +600,7 @@ DEP_DIRDEPS_FILTER = U # this is what we start with __depdirs := ${DIRDEPS:${NSkipDir}:${DEP_DIRDEPS_FILTER:ts:}:C,//+,/,g:O:u:@d@${SRCTOP}/$d@} -# some entries may be qualified with .<machine> +# some entries may be qualified with .<machine> # the :M*/*/*.* just tries to limit the dirs we check to likely ones. # the ${d:E:M*/*} ensures we don't consider junos/usr.sbin/mgd __qual_depdirs := ${__depdirs:M*/*/*.*:@d@${exists($d):?:${"${d:E:M*/*}":?:${exists(${d:R}):?$d:}}}@} @@ -595,7 +608,8 @@ __unqual_depdirs := ${__depdirs:${__qual_depdirs:Uno:$ .if ${DEP_RELDIR} == ${_DEP_RELDIR} # if it was called out - we likely need it. -__hostdpadd := ${DPADD:U.:M${HOST_OBJTOP}/*:S,${HOST_OBJTOP}/,,:H:${NSkipDir}:${DIRDEPS_FILTER:ts:}:S,$,.host,:N.*:@d@${SRCTOP}/$d@} +__hostdpadd := ${DPADD:U.:M${HOST_OBJTOP}/*:S,${HOST_OBJTOP}/,,:H:${NSkipDir}:${DIRDEPS_FILTER:ts:}:S,$,.host,:N.*:@d@${SRCTOP}/$d@} \ + ${DPADD:U.:M${HOST_OBJTOP32:Uno}/*:S,${HOST_OBJTOP32:Uno}/,,:H:${NSkipDir}:${DIRDEPS_FILTER:ts:}:S,$,.host32,:N.*:@d@${SRCTOP}/$d@} __qual_depdirs += ${__hostdpadd} .endif @@ -629,6 +643,11 @@ _build_all_dirs := ${_build_all_dirs:O:u} x!= { echo; echo '\# ${DEP_RELDIR}.${DEP_TARGET_SPEC}'; \ echo 'dirdeps: ${_build_all_dirs:${M_oneperline}}'; echo; } >&3; echo x!= { ${_build_all_dirs:@x@${target($x):?:echo '$x: _DIRDEP_USE';}@} echo; } >&3; echo +.if !empty(DEP_EXPORT_VARS) +# Discouraged, but there are always exceptions. +# Handle it here rather than explain how. +x!= { echo; ${DEP_EXPORT_VARS:@v@echo '$v=${$v}';@} echo '.export ${DEP_EXPORT_VARS}'; echo; } >&3; echo +.endif .else # this makes it all happen dirdeps: ${_build_all_dirs} @@ -639,6 +658,11 @@ ${_build_all_dirs}: _DIRDEP_USE .info ${DEP_RELDIR}.${DEP_TARGET_SPEC}: needs: ${_build_dirs} .endif +.if !empty(DEP_EXPORT_VARS) +.export ${DEP_EXPORT_VARS} +DEP_EXPORT_VARS= +.endif + # this builds the dependency graph .for m in ${_machines} # it would be nice to do :N${.TARGET} @@ -689,7 +713,7 @@ DEP_${TARGET_SPEC_VARS:[$i]} := ${_dtspec:[$i]} .else DEP_MACHINE := ${_DEP_MACHINE} .endif -# Warning: there is an assumption here that MACHINE is always +# Warning: there is an assumption here that MACHINE is always # the first entry in TARGET_SPEC_VARS. # If TARGET_SPEC and MACHINE are insufficient, you have a problem. _m := ${.MAKE.DEPENDFILE_PREFERENCE:T:S;${TARGET_SPEC}$;${d:E};:S;${MACHINE};${d:E:C/,.*//};:@m@${exists(${d:R}/$m):?${d:R}/$m:}@:[1]} @@ -699,7 +723,7 @@ _qm := ${_m:C;(\.depend)$;\1.${d:E};:${M_dep_qual_fixe .if ${_debug_search} .info Looking for ${_qm} .endif -# set this "just in case" +# set this "just in case" # we can skip :tA since we computed the path above DEP_RELDIR := ${_m:H:S,${SRCTOP}/,,} # and reset this @@ -708,6 +732,8 @@ DIRDEPS = .info loading ${_m} for ${d:E} .endif .include <${_m}> +.else +.-include <local.dirdeps-missing.mk> .endif .endif .endif @@ -722,6 +748,10 @@ DIRDEPS = # we are building something DEP_RELDIR := ${RELDIR} _DEP_RELDIR := ${RELDIR} +# Since we are/should be included by .MAKE.DEPENDFILE +# This is a final opportunity to add/hook global rules. +.-include <local.dirdeps-build.mk> + # pickup local dependencies .if ${MAKE_VERSION} < 20160220 .-include <.depend> @@ -758,7 +788,7 @@ bootstrap-this: .NOTMAIN @echo Bootstrapping ${RELDIR}/${_want:T} from ${_src:T}; \ echo You need to build ${RELDIR} to correctly populate it. .if ${_src:T} != ${.MAKE.DEPENDFILE_PREFIX:T} - (cd ${.CURDIR} && sed ${.MAKE.DEPENDFILE_BOOTSTRAP_SED} ${_src} > ${_want}) + (cd ${.CURDIR} && sed ${.MAKE.DEPENDFILE_BOOTSTRAP_SED} ${_src} > ${_want:T}) .else cp ${.CURDIR}/${_src:T} ${_want} .endif Modified: head/share/mk/gendirdeps.mk ============================================================================== --- head/share/mk/gendirdeps.mk Thu Aug 2 21:25:32 2018 (r337185) +++ head/share/mk/gendirdeps.mk Thu Aug 2 21:33:45 2018 (r337186) @@ -1,5 +1,5 @@ # $FreeBSD$ -# $Id: gendirdeps.mk,v 1.33 2016/10/11 22:37:28 sjg Exp $ +# $Id: gendirdeps.mk,v 1.39 2018/06/08 01:25:31 sjg Exp $ # Copyright (c) 2010-2013, Juniper Networks, Inc. # All rights reserved. @@ -161,17 +161,39 @@ META2DEPS_CMD += -S ${SB_BACKING_SB}/src M2D_OBJROOTS += ${SB_BACKING_SB}/${SB_OBJPREFIX} .endif +GENDIRDEPS_SEDCMDS += \ + -e 's,//*$$,,;s,\.${HOST_TARGET:Uhost}$$,.host,' \ + -e 's,\.${HOST_TARGET32:Uhost32}$$,.host32,' \ + -e 's,\.${MACHINE}$$,,' \ + -e 's:\.${TARGET_SPEC:U${MACHINE}}$$::' + # we are only interested in the dirs # specifically those we read something from. # we canonicalize them to keep things simple # if we are using a split-fs sandbox, it gets a little messier. _objtop := ${_OBJTOP:tA} + +# some people put *.meta in META_XTRAS to make sure we get here +_meta_files := ${META_FILES:N\*.meta:O:u} +# assume a big list +_meta_files_arg= @meta.list +.if empty(_meta_files) && ${META_FILES:M\*.meta} != "" +# XXX this should be considered a bad idea, +# since we cannot ignore stale .meta +x != cd ${_OBJDIR} && find . -name '*.meta' -print -o \( -type d ! -name . -prune \) | sed 's,^./,,' > meta.list; echo +.elif ${_meta_files:[#]} > 500 +.export _meta_files +x != echo; for m in $$_meta_files; do echo $$m; done > meta.list +.else +_meta_files_arg:= ${_meta_files} +.endif + dir_list != cd ${_OBJDIR} && \ ${META2DEPS_CMD} MACHINE=${MACHINE} \ SRCTOP=${SRCTOP} RELDIR=${RELDIR} CURDIR=${_CURDIR} \ ${META2DEPS_ARGS} \ - ${META_FILES:O:u} | ${META2DEPS_FILTER} ${_skip_gendirdeps} \ - sed 's,//*$$,,;s,\.${HOST_TARGET}$$,.host,' + ${_meta_files_arg} | ${META2DEPS_FILTER} ${_skip_gendirdeps} \ + sed ${GENDIRDEPS_SEDCMDS} .if ${dir_list:M*ERROR\:*} != "" .warning ${dir_list:tW:C,.*(ERROR),\1,} @@ -195,7 +217,7 @@ dpadd_dir_list += ${f:H:tA} .endfor .if !empty(ddep_list) ddeps != cat ${ddep_list:O:u} | ${META2DEPS_FILTER} ${_skip_gendirdeps} \ - sed 's,//*$$,,;s,\.${HOST_TARGET}$$,.host,;s,\.${MACHINE}$$,,' + sed ${GENDIRDEPS_SEDCMDS} .if ${DEBUG_GENDIRDEPS:Uno:@x@${RELDIR:M$x}@} != "" .info ${RELDIR}: raw_dir_list='${dir_list}' @@ -256,7 +278,9 @@ DIRDEPS += \ ${dirdep_list:M${RELDIR}/*:@d@${.MAKE.MAKEFILE_PREFERENCE:@m@${exists(${SRCTOP}/$d/$m):?$d:${exists(${SRCTOP}/${d:R}/$m):?$d:}}@}@} \ ${qualdir_list:M${RELDIR}/*:@d@${.MAKE.MAKEFILE_PREFERENCE:@m@${exists(${SRCTOP}/${d:R}/$m):?$d:}@}@} -DIRDEPS := ${DIRDEPS:${GENDIRDEPS_FILTER:UNno:ts:}:C,//+,/,g:O:u} +# what modifiers do we allow in GENDIRDEPS_FILTER +GENDIRDEPS_FILTER_MASK += @CMNS +DIRDEPS := ${DIRDEPS:${GENDIRDEPS_FILTER:UNno:M[${GENDIRDEPS_FILTER_MASK:O:u:ts}]*:ts:}:C,//+,/,g:O:u} .if ${DEBUG_GENDIRDEPS:Uno:@x@${RELDIR:M$x}@} != "" .info ${RELDIR}: M2D_OBJROOTS=${M2D_OBJROOTS} Modified: head/share/mk/local.autodep.mk ============================================================================== --- head/share/mk/local.autodep.mk Thu Aug 2 21:25:32 2018 (r337185) +++ head/share/mk/local.autodep.mk Thu Aug 2 21:33:45 2018 (r337186) @@ -2,7 +2,7 @@ .if ${.MAKE.DEPENDFILE:M*.${MACHINE}} == "" # by default only MACHINE0 does updates -UPDATE_DEPENDFILE_MACHINE?= ${MACHINE0} +UPDATE_DEPENDFILE_MACHINE?= ${MACHINE0:U${MACHINE}} .if ${MACHINE} != ${UPDATE_DEPENDFILE_MACHINE} UPDATE_DEPENDFILE= no .endif Modified: head/share/mk/local.dirdeps.mk ============================================================================== --- head/share/mk/local.dirdeps.mk Thu Aug 2 21:25:32 2018 (r337185) +++ head/share/mk/local.dirdeps.mk Thu Aug 2 21:33:45 2018 (r337186) @@ -6,9 +6,6 @@ .include "${SRCTOP}/share/mk/src.opts.mk" .endif -# DEP_MACHINE is set before we get here, this may not be. -DEP_RELDIR ?= ${RELDIR} - # making universe is special .if defined(UNIVERSE_GUARD) # these should be done by now @@ -39,6 +36,7 @@ DIRDEPS_FILTER.host = \ ${N_host_libs} \ Ninclude* \ Nlib/csu* \ + Nlib/libc \ Nlib/[mn]* \ Ngnu/lib/csu* \ Ngnu/lib/lib[a-r]* \ @@ -93,7 +91,7 @@ DIRDEPS += \ # Add in proper libgcc (gnu or LLVM) if not building libcc and libc is needed. # Add both gcc_s and gcc_eh as dependencies as the decision to build # -static or not is not known here. -.if ${DEP_RELDIR:M*libgcc*} == "" && ${DIRDEPS:Mlib/libc} +.if ${DEP_RELDIR:M*libgcc*} == "" && ${DIRDEPS:U:Mlib/libc} != "" .if ${MK_LLVM_LIBUNWIND} == "yes" DIRDEPS+= \ lib/libgcc_eh \ Modified: head/share/mk/local.gendirdeps.mk ============================================================================== --- head/share/mk/local.gendirdeps.mk Thu Aug 2 21:25:32 2018 (r337185) +++ head/share/mk/local.gendirdeps.mk Thu Aug 2 21:33:45 2018 (r337186) @@ -13,6 +13,8 @@ GENDIRDEPS_FILTER+= \ Ngnu/lib/libgcc \ Nlib/libgcc_eh \ Nlib/libgcc_s \ + Nstand/libsa/* \ + Nstand/libsa32/* \ Ntargets/pseudo/stage* \ Ntools/* Modified: head/share/mk/local.meta.sys.mk ============================================================================== --- head/share/mk/local.meta.sys.mk Thu Aug 2 21:25:32 2018 (r337185) +++ head/share/mk/local.meta.sys.mk Thu Aug 2 21:33:45 2018 (r337186) @@ -7,7 +7,7 @@ # we need this until there is an alternative MK_INSTALL_AS_USER= yes -.if !defined(HOST_TARGET) +.if !defined(HOST_TARGET) || !defined(HOST_MACHINE) # we need HOST_TARGET etc below. .include <host-target.mk> .export HOST_TARGET @@ -111,6 +111,7 @@ BUILD_AT_LEVEL0= no .error DIRDEPS_BUILD: Please run '${MAKE}' instead of '${MAKE} all'. .endif .endif +.endif # we want to end up with a singe stage tree for all machines .if ${MK_STAGING} == "yes" @@ -119,7 +120,6 @@ STAGE_ROOT?= ${OBJROOT}stage .export STAGE_ROOT .endif .endif -.endif .if ${MK_STAGING} == "yes" .if ${MACHINE} == "host" @@ -149,7 +149,7 @@ STAGE_INCSDIR= ${STAGE_OBJTOP}${INCSDIR:U/include} # the target is usually an absolute path STAGE_SYMLINKS_DIR= ${STAGE_OBJTOP} -LDFLAGS_LAST+= -Wl,-rpath-link,${STAGE_LIBDIR} +#LDFLAGS_LAST+= -Wl,-rpath-link,${STAGE_LIBDIR} .if ${MK_SYSROOT} == "yes" SYSROOT?= ${STAGE_OBJTOP} .else @@ -157,6 +157,8 @@ LDFLAGS_LAST+= -L${STAGE_LIBDIR} .endif .endif # MK_STAGING + +.-include "local.toolchain.mk" # this is sufficient for most of the tree. .MAKE.DEPENDFILE_DEFAULT = ${.MAKE.DEPENDFILE_PREFIX} Modified: head/share/mk/meta.autodep.mk ============================================================================== --- head/share/mk/meta.autodep.mk Thu Aug 2 21:25:32 2018 (r337185) +++ head/share/mk/meta.autodep.mk Thu Aug 2 21:33:45 2018 (r337186) @@ -1,5 +1,5 @@ # $FreeBSD$ -# $Id: meta.autodep.mk,v 1.40 2016/02/22 22:44:58 sjg Exp $ +# $Id: meta.autodep.mk,v 1.50 2018/06/08 01:25:31 sjg Exp $ # # @(#) Copyright (c) 2010, Simon J. Gerraty @@ -7,10 +7,10 @@ # This file is provided in the hope that it will # be of use. There is absolutely NO WARRANTY. # Permission to copy, redistribute or otherwise -# use this file is hereby granted provided that +# use this file is hereby granted provided that # the above copyright notice and this notice are -# left intact. -# +# left intact. +# # Please send copies of changes and bug-fixes to: # sjg@crufty.net # @@ -21,9 +21,12 @@ __${_this}__: .NOTMAIN .-include <local.autodep.mk> +PICO?= .pico +NOSSPPICO?= .nossppico + .if defined(SRCS) # it would be nice to be able to query .SUFFIXES -OBJ_EXTENSIONS+= .o .po .lo .pico .nossppico +OBJ_EXTENSIONS+= .o .po .lo ${PICO} ${NOSSPPICO} # explicit dependencies help short-circuit .SUFFIX searches SRCS_DEP_FILTER+= N*.[hly] @@ -40,7 +43,7 @@ ${s:T:R}$e: $s # you are supposed to know what you are doing! UPDATE_DEPENDFILE = yes .elif !empty(.TARGETS) && !make(all) -# do not update the *depend* files +# do not update the *depend* files # unless we are building the entire directory or the default target. # NO means don't update .depend - or Makefile.depend* # no means update .depend but not Makefile.depend* @@ -120,7 +123,7 @@ META_FILE_FILTER ?= N.meta META_FILE_FILTER += Ndirdeps.cache* .if !empty(DPADD) -# if we have any non-libs in DPADD, +# if we have any non-libs in DPADD, # they probably need to be paid attention to .if !empty(DPLIBS) FORCE_DPADD = ${DPADD:${DPLIBS:${M_ListToSkip}}:${DPADD_LAST:${M_ListToSkip}}} @@ -139,8 +142,8 @@ FORCE_DPADD += ${_nonlibs:@x@${DPADD:M*/$x}@} # if we don't have OBJS, then .depend isn't useful .if !target(.depend) && (!empty(OBJS) || ${.ALLTARGETS:M*.o} != "") # some makefiles and/or targets contain -# circular dependencies if you dig too deep -# (as meta mode is apt to do) +# circular dependencies if you dig too deep +# (as meta mode is apt to do) # so we provide a means of suppressing them. # the input to the loop below is target: dependency # with just one dependency per line. @@ -156,13 +159,13 @@ SUPPRESS_DEPEND += \ # we use ${.MAKE.META.CREATED} to trigger an update but # we process using ${.MAKE.META.FILES} # the double $$ defers initial evaluation -# if necessary, we fake .po dependencies, just so the result +# if necessary, we fake .po dependencies, just so the result # in Makefile.depend* is stable # The current objdir may be referred to in various ways OBJDIR_REFS += ${.OBJDIR} ${.OBJDIR:tA} ${_OBJDIR} ${RELOBJTOP}/${RELDIR} _depend = .depend # it would be nice to be able to get .SUFFIXES as ${.SUFFIXES} -# we actually only care about the .SUFFIXES of files that might be +# we actually only care about the .SUFFIXES of files that might be # generated by tools like yacc. DEPEND_SUFFIXES += .c .h .cpp .hpp .cxx .hxx .cc .hh .depend: .NOMETA $${.MAKE.META.CREATED} ${_this} @@ -179,7 +182,7 @@ DEPEND_SUFFIXES += .c .h .cpp .hpp .cxx .hxx .cc .hh @case "${.MAKE.META.FILES:T:M*.po.*}" in \ *.po.*) mv $@.${.MAKE.PID} $@;; \ *) { cat $@.${.MAKE.PID}; \ - sed 's,\.nossppico:,.o:,;s,\.pico:,.o:,;s,\.o:,.po:,' $@.${.MAKE.PID}; } | sort -u > $@; \ + sed 's,\${NOSSPPICO}:,.o:,;s,\${PICO}:,.o:,;s,\.o:,.po:,' $@.${.MAKE.PID}; } | sort -u > $@; \ rm -f $@.${.MAKE.PID};; \ esac .else @@ -244,7 +247,7 @@ META_FILES = *.meta .elif ${OPTIMIZE_OBJECT_META_FILES:Uno:tl} == "no" META_FILES = ${.MAKE.META.FILES:T:N.depend*:O:u} .else -# if we have 1000's of .o.meta, .pico.meta etc we need only look at one set +# if we have 1000's of .o.meta, ${PICO}.meta etc we need only look at one set # it is left as an exercise for the reader to work out what this does META_FILES = ${.MAKE.META.FILES:T:N.depend*:N*o.meta:O:u} \ ${.MAKE.META.FILES:T:M*.${.MAKE.META.FILES:M*o.meta:R:E:O:u:[1]}.meta:O:u} @@ -254,20 +257,27 @@ META_FILES = ${.MAKE.META.FILES:T:N.depend*:N*o.meta:O .info ${_DEPENDFILE:S,${SRCTOP}/,,}: ${_depend} ${.PARSEDIR}/gendirdeps.mk ${META2DEPS} xtras=${META_XTRAS} .endif -.if ${.MAKE.LEVEL} > 0 && !empty(GENDIRDEPS_FILTER) +.if ${.MAKE.LEVEL} > 0 +.if ${UPDATE_DEPENDFILE} == "yes" +.-include <${.CURDIR}/${.MAKE.DEPENDFILE_PREFIX}.options> +.endif +.if !empty(GENDIRDEPS_FILTER) .export GENDIRDEPS_FILTER .endif +# export to avoid blowing command line limit +META_FILES := ${META_XTRAS:U:O:u} ${META_FILES:U:T:O:u:${META_FILE_FILTER:ts:}} +.export META_FILES +.endif # we might have .../ in MAKESYSPATH _makesyspath:= ${_PARSEDIR} ${_DEPENDFILE}: ${_depend} ${.PARSEDIR}/gendirdeps.mk ${META2DEPS} $${.MAKE.META.CREATED} @echo Checking $@: ${.OODATE:T:[1..8]} - @(cd . && \ + @(cd . && ${GENDIRDEPS_ENV} \ SKIP_GENDIRDEPS='${SKIP_GENDIRDEPS:O:u}' \ DPADD='${FORCE_DPADD:O:u}' ${_gendirdeps_mutex} \ MAKESYSPATH=${_makesyspath} \ - ${.MAKE} -f gendirdeps.mk RELDIR=${RELDIR} _DEPENDFILE=${_DEPENDFILE} \ - META_FILES='${META_XTRAS:O:u} ${META_FILES:T:O:u:${META_FILE_FILTER:ts:}}') + ${.MAKE} -f gendirdeps.mk RELDIR=${RELDIR} _DEPENDFILE=${_DEPENDFILE}) @test -s $@ && touch $@; : .endif Modified: head/share/mk/meta.stage.mk ============================================================================== --- head/share/mk/meta.stage.mk Thu Aug 2 21:25:32 2018 (r337185) +++ head/share/mk/meta.stage.mk Thu Aug 2 21:33:45 2018 (r337186) @@ -1,5 +1,5 @@ # $FreeBSD$ -# $Id: meta.stage.mk,v 1.48 2017/03/01 22:48:07 sjg Exp $ +# $Id: meta.stage.mk,v 1.55 2017/10/27 01:17:09 sjg Exp $ # # @(#) Copyright (c) 2011-2017, Simon J. Gerraty # @@ -14,14 +14,16 @@ # sjg@crufty.net # +.ifndef NO_STAGING + .if !target(__${.PARSEFILE}__) # the guard target is defined later .if ${.MAKE.DEPENDFILE_PREFERENCE:U${.MAKE.DEPENDFILE}:M*.${MACHINE}} != "" # this is generally safer anyway -_dirdep = ${RELDIR}.${MACHINE} +_dirdep ?= ${RELDIR}.${MACHINE} .else -_dirdep = ${RELDIR} +_dirdep ?= ${RELDIR} .endif CLEANFILES+= .dirdep @@ -135,11 +137,31 @@ _STAGE_AS_BASENAME_USE: .USE .dirdep ${.TARGET: @${STAGE_AS_SCRIPT}; StageAs ${.TARGET:H:${STAGE_DIR_FILTER}} ${.TARGET:T} ${STAGE_AS_${.TARGET:T}:U${.TARGET:T}} +.endif # first time + + +.if !empty(STAGE_INCSDIR) +.if !empty(STAGE_INCS) +stage_incs: ${STAGE_INCS} +.endif +.if target(stage_incs) || !empty(.ALLTARGETS:Mstage_includes) +STAGE_TARGETS += stage_incs +STAGE_INCS ?= ${.ALLSRC:N.dirdep:Nstage_*} stage_includes: stage_incs stage_incs: .dirdep @${STAGE_FILE_SCRIPT}; StageFiles ${STAGE_INCSDIR:${STAGE_DIR_FILTER}} ${STAGE_INCS} @touch $@ +.endif +.endif + +.if !empty(STAGE_LIBDIR) +.if !empty(STAGE_LIBS) +stage_libs: ${STAGE_LIBS} +.endif +.if target(stage_libs) +STAGE_TARGETS += stage_libs +STAGE_LIBS ?= ${.ALLSRC:N.dirdep:Nstage_*} stage_libs: .dirdep @${STAGE_FILE_SCRIPT}; StageFiles ${STAGE_LIBDIR:${STAGE_DIR_FILTER}} ${STAGE_LIBS} .if !defined(NO_SHLIB_LINKS) @@ -151,18 +173,7 @@ stage_libs: .dirdep .endif .endif @touch $@ - -.endif # first time - - -.if !empty(STAGE_INCSDIR) -STAGE_TARGETS += stage_incs -STAGE_INCS ?= ${.ALLSRC:N.dirdep:Nstage_*} .endif - -.if !empty(STAGE_LIBDIR) -STAGE_TARGETS += stage_libs -STAGE_LIBS ?= ${.ALLSRC:N.dirdep:Nstage_*} .endif .if !empty(STAGE_DIR) @@ -173,8 +184,6 @@ STAGE_SYMLINKS_DIR._default = ${STAGE_SYMLINKS_DIR:U${ STAGE_FILES._default = ${STAGE_FILES} STAGE_LINKS._default = ${STAGE_LINKS} STAGE_SYMLINKS._default = ${STAGE_SYMLINKS} -STAGE_FILES ?= ${.ALLSRC:N.dirdep:Nstage_*} -STAGE_SYMLINKS ?= ${.ALLSRC:T:N.dirdep:Nstage_*} .endif .if !empty(STAGE_SETS) @@ -182,24 +191,31 @@ 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:Nstage_*} -STAGE_SYMLINKS.$s ?= ${.ALLSRC:N.dirdep:Nstage_*} -STAGE_LINKS_DIR.$s ?= ${STAGE_OBJTOP} -STAGE_SYMLINKS_DIR.$s ?= ${STAGE_OBJTOP} - +.if !empty(STAGE_FILES.$s) +stage_files.$s: ${STAGE_FILES.$s} +.endif +.if target(stage_files.$s) || target(stage_files${s:S,^,.,:N._default}) STAGE_TARGETS += stage_files +STAGE_FILES.$s ?= ${.ALLSRC:N.dirdep:Nstage_*} .if !target(.stage_files.$s) .stage_files.$s: .if $s != "_default" stage_files: stage_files.$s stage_files.$s: .dirdep .else +STAGE_FILES ?= ${.ALLSRC:N.dirdep:Nstage_*} stage_files: .dirdep .endif @${STAGE_FILE_SCRIPT}; StageFiles ${FLAGS.$@} ${STAGE_FILES_DIR.$s:U${STAGE_DIR.$s}:${STAGE_DIR_FILTER}} ${STAGE_FILES.$s} @touch $@ .endif +.endif +.if !empty(STAGE_LINKS.$s) +stage_links.$s: +.endif +.if target(stage_links.$s) || target(stage_links${s:S,^,.,:N._default}) +STAGE_LINKS_DIR.$s ?= ${STAGE_OBJTOP} STAGE_TARGETS += stage_links .if !target(.stage_links.$s) .stage_links.$s: @@ -212,7 +228,13 @@ stage_links: .dirdep @${STAGE_LINKS_SCRIPT}; StageLinks ${STAGE_LINKS_DIR.$s:U${STAGE_DIR.$s}:${STAGE_DIR_FILTER}} ${STAGE_LINKS.$s} @touch $@ .endif +.endif +.if !empty(STAGE_SYMLINKS.$s) +stage_symlinks.$s: +.endif +.if target(stage_symlinks.$s) || target(stage_symlinks${s:S,^,.,:N._default}) +STAGE_SYMLINKS_DIR.$s ?= ${STAGE_OBJTOP} STAGE_TARGETS += stage_symlinks .if !target(.stage_symlinks.$s) .stage_symlinks.$s: @@ -225,6 +247,7 @@ stage_symlinks: .dirdep @${STAGE_LINKS_SCRIPT}; StageLinks -s ${STAGE_SYMLINKS_DIR.$s:U${STAGE_DIR.$s}:${STAGE_DIR_FILTER}} ${STAGE_SYMLINKS.$s} @touch $@ .endif +.endif .endfor .endif @@ -232,8 +255,6 @@ stage_symlinks: .dirdep .if !empty(STAGE_AS_SETS) CLEANFILES += ${STAGE_AS_SETS:@s@stage*$s@} -STAGE_TARGETS += stage_as stage_as_and_symlink - # sometimes things need to be renamed as they are staged # each ${file} will be staged as ${STAGE_AS_${file:T}} # one could achieve the same with SYMLINKS @@ -241,9 +262,12 @@ STAGE_TARGETS += stage_as stage_as_and_symlink # it is the same as using stage_as and stage_symlinks but ensures # both operations happen together .for s in ${STAGE_AS_SETS:O:u} +.if !empty(STAGE_AS.$s) +stage_as.$s: ${STAGE_AS.$s} +.endif +.if target(stage_as.$s) +STAGE_TARGETS += stage_as STAGE_AS.$s ?= ${.ALLSRC:N.dirdep:Nstage_*} -STAGE_AS_AND_SYMLINK.$s ?= ${.ALLSRC:N.dirdep:Nstage_*} - .if !target(.stage_as.$s) .stage_as.$s: stage_as: stage_as.$s @@ -251,7 +275,14 @@ stage_as.$s: .dirdep @${STAGE_AS_SCRIPT}; StageAs ${FLAGS.$@} ${STAGE_FILES_DIR.$s:U${STAGE_DIR.$s}:${STAGE_DIR_FILTER}} ${STAGE_AS.$s:@f@$f ${STAGE_AS_${f:tA}:U${STAGE_AS_${f:T}:U${f:T}}}@} @touch $@ .endif +.endif +.if !empty(STAGE_AS_AND_SYMLINK.$s) +stage_as_and_symlink.$s: ${STAGE_AS_AND_SYMLINK.$s} +.endif +.if target(stage_as_and_symlink.$s) +STAGE_TARGETS += stage_as_and_symlink +STAGE_AS_AND_SYMLINK.$s ?= ${.ALLSRC:N.dirdep:Nstage_*} .if !target(.stage_as_and_symlink.$s) .stage_as_and_symlink.$s: stage_as_and_symlink: stage_as_and_symlink.$s @@ -260,6 +291,7 @@ stage_as_and_symlink.$s: .dirdep @${STAGE_LINKS_SCRIPT}; StageLinks -s ${STAGE_FILES_DIR.$s:U${STAGE_DIR.$s}:${STAGE_DIR_FILTER}} ${STAGE_AS_AND_SYMLINK.$s:@f@${STAGE_AS_${f:tA}:U${STAGE_AS_${f:T}:U${f:T}}} $f@} @touch $@ .endif +.endif .endfor .endif @@ -303,6 +335,9 @@ beforeinstall: .dirdep .NOPATH: ${STAGE_FILES} .if !empty(STAGE_TARGETS) +# for backwards compat make sure they exist +${STAGE_TARGETS}: + .NOPATH: ${CLEANFILES} MK_STALE_STAGED?= no @@ -322,6 +357,7 @@ stale_staged: staging .NOMETA echo "Removing stale staged files..."; \ sed 's,.*,& &.dirdep,' ${.TARGET}.stale | xargs rm -f; } +.endif .endif .endif .endif Modified: head/share/mk/meta.sys.mk ============================================================================== --- head/share/mk/meta.sys.mk Thu Aug 2 21:25:32 2018 (r337185) +++ head/share/mk/meta.sys.mk Thu Aug 2 21:33:45 2018 (r337186) @@ -1,5 +1,5 @@ # $FreeBSD$ -# $Id: meta.sys.mk,v 1.19 2014/08/02 23:16:02 sjg Exp $ +# $Id: meta.sys.mk,v 1.32 2017/06/11 03:24:04 sjg Exp $ # # @(#) Copyright (c) 2010, Simon J. Gerraty @@ -21,7 +21,7 @@ .if ${MAKE_VERSION:U0} > 20100901 .if !target(.ERROR) -.-include "local.meta.sys.mk" +.-include <local.meta.sys.mk> # absolute path to what we are reading. _PARSEDIR = ${.PARSEDIR:tA} @@ -56,17 +56,6 @@ META_MODE += silent=yes .endif .endif -# make defaults .MAKE.DEPENDFILE to .depend -# that won't work for us. -.if ${.MAKE.DEPENDFILE} == ".depend" -.undef .MAKE.DEPENDFILE -.endif - -# if you don't cross build for multiple MACHINEs concurrently, then -# .MAKE.DEPENDFILE = Makefile.depend -# probably makes sense - you can set that in local.sys.mk -.MAKE.DEPENDFILE ?= Makefile.depend.${MACHINE} - # we use the pseudo machine "host" for the build host. # this should be taken care of before we get here .if ${OBJTOP:Ua} == ${HOST_OBJTOP:Ub} @@ -118,10 +107,21 @@ _metaError: .NOMETA .NOTMAIN .if ${.MAKE.MODE:Uno:Mmeta*} != "" MKDEP_MK = meta.autodep.mk +.if ${.MAKE.MAKEFILES:M*sys.dependfile.mk} == "" +# this does all the smarts of setting .MAKE.DEPENDFILE +.-include <sys.dependfile.mk> +# check if we got anything sane +.if ${.MAKE.DEPENDFILE} == ".depend" +.undef .MAKE.DEPENDFILE +.endif +.MAKE.DEPENDFILE ?= Makefile.depend +.endif + # we can afford to use cookies to prevent some targets # re-running needlessly META_COOKIE_TOUCH?= touch ${COOKIE.${.TARGET}:U${.OBJDIR}/${.TARGET:T}} META_NOPHONY= +META_NOECHO= : # some targets involve old pre-built targets # ignore mtime of shell @@ -131,11 +131,16 @@ META_NOPHONY= ${SHELL} \ ${SYS_MK_DIR} -# if we think we are updating dependencies, -# then filemon had better be present -.if ${UPDATE_DEPENDFILE:Uyes:tl} != "no" && !exists(/dev/filemon) +.if ${UPDATE_DEPENDFILE:Uyes:tl} != "no" +.if ${.MAKEFLAGS:Uno:M-k} != "" +# make this more obvious +.warning Setting UPDATE_DEPENDFILE=NO due to -k +UPDATE_DEPENDFILE= NO +.export UPDATE_DEPENDFILE +.elif !exists(/dev/filemon) .error ${.newline}ERROR: The filemon module (/dev/filemon) is not loaded. .endif +.endif .if ${.MAKE.LEVEL} == 0 # make sure dirdeps target exists and do it first @@ -160,5 +165,6 @@ BUILD_AT_LEVEL0 ?= no META_COOKIE_TOUCH= # some targets need to be .PHONY in non-meta mode META_NOPHONY= .PHONY +META_NOECHO= echo .endif .endif Modified: head/share/mk/meta2deps.py ============================================================================== --- head/share/mk/meta2deps.py Thu Aug 2 21:25:32 2018 (r337185) +++ head/share/mk/meta2deps.py Thu Aug 2 21:33:45 2018 (r337186) @@ -38,7 +38,7 @@ We only pay attention to a subset of the information i """ RCSid: $FreeBSD$ - $Id: meta2deps.py,v 1.24 2017/02/08 22:17:10 sjg Exp $ + $Id: meta2deps.py,v 1.27 2017/05/24 00:04:04 sjg Exp $ Copyright (c) 2011-2013, Juniper Networks, Inc. All rights reserved. @@ -91,6 +91,12 @@ def resolve(path, cwd, last_dir=None, debug=0, debug_o for d in [last_dir, cwd]: if not d: continue + if path == '..': + dw = d.split('/') + p = '/'.join(dw[:-1]) + if not p: + p = '/' + return p p = '/'.join([d,path]) if debug > 2: print("looking for:", p, end=' ', file=debug_out) @@ -116,8 +122,11 @@ def cleanpath(path): if not d or d == '.': continue if d == '..': - p.pop() - continue + try: + p.pop() + continue + except: + break p.append(d) return r + '/'.join(p)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808022133.w72LXjOq054601>