diff options
Diffstat (limited to 'mk')
66 files changed, 942 insertions, 529 deletions
diff --git a/mk/ChangeLog b/mk/ChangeLog index ca42bc2839c5..9ea9d42a7776 100644 --- a/mk/ChangeLog +++ b/mk/ChangeLog @@ -1,3 +1,106 @@ +2020-08-26 Simon J Gerraty <sjg@beast.crufty.net> + + * dirdeps.mk: ensure we cannot confuse a static cache for dynamic + (even more rare that use of static cache is playing clever tricks + with it) + +2020-08-16 Simon J Gerraty <sjg@beast.crufty.net> + + * dirdeps-cache-update.mk: allow + MK_STATIC_DIRDEPS_CACHE_UPDATE_IMMEDIATE to control when we + actually update STATIC_DIRDEPS_CACHE. + + * stage-install.sh: create dest directory if needed + before running install(1) + +2020-08-10 Simon J Gerraty <sjg@beast.crufty.net> + + * dirdeps-targets.mk: include Makefile.dirdeps.options + + * dirdeps.mk: use _TARGETS if defined for DIRDEPS_CACHE + +2020-08-09 Simon J Gerraty <sjg@beast.crufty.net> + + * dirdeps.mk: default BUILD_DIRDEPS_MAKEFILE to empty + + * dirdeps-cache-update.mk: building parallel cache update + under the context of dirdeps-cached would be ideal, but + is problematic, so it runs as a sibling. + Use cache-built target to ensure we wait for it to complete if + necessary. + +2020-08-06 Simon J Gerraty <sjg@beast.crufty.net> + + * install-mk (MK_VERSION): 20200806 + + * dirdeps-options: allow TARGET_SPEC to affect option values. + Use DIRDEPS_OPTIONS_QUALIFIER_LIST before using bare MK_* + + * dirdeps-targets.mk: check for MK_STATIC_DIRDEPS_CACHE defined + before looking for STATIC_DIRDEPS_CACHE + +2020-08-05 Simon J Gerraty <sjg@beast.crufty.net> + + * host-target.mk: Darwin use MACHINE for HOST_ARCH too + + * dirdeps-options.mk: improve debug output + +2020-07-22 Simon J Gerraty <sjg@beast.crufty.net> + + * dirdeps.mk: set and export DYNAMIC_DIRDEPS_CACHE + for use by dirdeps-cache-update.mk + + * dirdeps-targets.mk: set and export STATIC_DIRDEPS_CACHE + for use by dirdeps-cache-update.mk even if we don't use it. + + * dirdeps-cache-update.mk: we only need worry about the background + update case, with the above, the update from DIRDEPS_CACHE is + simple. + + * meta2deps.py: R 1234 . is not interesting + +2020-07-20 Simon J Gerraty <sjg@beast.crufty.net> + + * sys.mk: default MK_STATIC_DIRDEPS_CACHE from MK_DIRDEPS_CACHE + + * dirdeps-options.mk: do not :tu DIRDEPS_OPTIONS + allows use of lower case for pseudo options. + + * dirdeps-cache-update.mk: magic to deal with STATIC_DIRDEPS_CACHE + +2020-07-18 Simon J Gerraty <sjg@beast.crufty.net> + + * dirdeps-targets.mk: Look for Makefile.dirdeps.cache + which allows us to have a static cache for expensive targets. + Use -DWITHOUT_STATIC_DIRDEPS_CACHE -DWITH_DIRDEPS_CACHE + to regenerate the dirdeps.cache it is a copy of. + +2020-07-17 Simon J Gerraty <sjg@beast.crufty.net> + + * Get rid of BUILD_AT_LEVEL0, MK_DIRDEPS_BUILD makes more sense. + +2020-07-16 Simon J Gerraty <sjg@beast.crufty.net> + + * dirdeps.mk (DIRDEP_LOADAVG_REPORT): make it easy to record + load averages at intervals during build. + +2020-07-15 Simon J Gerraty <sjg@beast.crufty.net> + + * install-mk (MK_VERSION): 20200715 + + * dirdeps.mk: tweak Checking line to make matching Finished + lines for post-build analysis easier. + + * meta.autodep.mk: use !defined(WITHOUT_META_STATS) + + * progs.mk: avoid prog.mk outputting multiple Finished lines + +2020-07-11 Simon J Gerraty <sjg@beast.crufty.net> + + * dirdeps.mk: further optimize dirdeps.cache + generate a DIRDEPS.${.TARGET} list for other purposes + and improve the layout. + 2020-07-10 Simon J Gerraty <sjg@beast.crufty.net> * dirdeps.mk: optimize content of dirdeps.cache @@ -124,7 +227,7 @@ * install-mk (MK_VERSION): 20180919 * dirdeps-options.mk: .undef cannot handle var that expands to - more than one var. + more than one var. 2018-07-08 Simon J Gerraty <sjg@beast.crufty.net> @@ -309,8 +412,8 @@ 2016-12-12 Simon J. Gerraty <sjg@bad.crufty.net> * install-mk (MK_VERSION): 20161212 - - * meta2deps.py: set pid_cwd[pid] when we process 'C'hdir, + + * meta2deps.py: set pid_cwd[pid] when we process 'C'hdir, rather than when we detect pid change. 2016-12-07 Simon J. Gerraty <sjg@bad.crufty.net> @@ -322,7 +425,7 @@ to use foo.tgz to reference the latest staged version - so we make foo.tgz a symlink to it. Using a target to do both operations ensures we stay in sync. - + 2016-11-26 Simon J. Gerraty <sjg@bad.crufty.net> * install-mk (MK_VERSION): 20161126 @@ -374,18 +477,18 @@ 2016-08-13 Simon J. Gerraty <sjg@bad.crufty.net> - * meta.sys.mk (.MAKE.META.IGNORE_PATHS): + * meta.sys.mk (.MAKE.META.IGNORE_PATHS): in meta mode we can ignore the mtime of makefiles 2016-08-02 Simon J. Gerraty <sjg@bad.crufty.net> * install-mk (MK_VERSION): 20160802 - + * lib.mk (libinstall): depends on beforinstall * prog.mk (proginstall): depends on beforinstall patch from Lauri Tirkkonen - + * dirdeps.mk (bootstrap): When bootstrapping; creat .MAKE.DEPENDFILE_DEFAULT and allow additional filtering via .MAKE.DEPENDFILE_BOOTSTRAP_SED @@ -408,7 +511,7 @@ * install-mk (MK_VERSION): 20160530 * meta.stage.mk: we assume ${CLEANFILES} gets .NOPATH make it so. - + 2016-05-12 Simon J. Gerraty <sjg@bad.crufty.net> * install-mk (MK_VERSION): 20160512 @@ -418,7 +521,7 @@ skip INCLUDES_* for staged libs unless SRC_* defined. * own.mk: add INCLUDEDIR - + 2016-04-18 Simon J. Gerraty <sjg@bad.crufty.net> * dirdeps.mk: when doing -f dirdeps.mk if target suppies no @@ -428,9 +531,9 @@ 2016-04-07 Simon J. Gerraty <sjg@bad.crufty.net> * meta.autodep.mk: issue a warning if UPDATE_DEPENDFILE=NO due to - NO_FILEMON_COOKIE + NO_FILEMON_COOKIE - * dirdeps.mk: move the logic that allows for + * dirdeps.mk: move the logic that allows for make -f dirdeps.mk some/dir.${TARGET_SPEC} inside the check for !target(_DIRDEP_USE) @@ -438,15 +541,15 @@ * Use <> when including local*.mk and others which may exist elsewhere so that user can better control what they get. - - * meta.autodep.mk (NO_FILEMON_COOKIE): + + * meta.autodep.mk (NO_FILEMON_COOKIE): create a cookie if we ever build dir with nofilemon so that UPDATE_DEPENDFILE will be forced to NO until cleaned. 2016-04-01 Simon J. Gerraty <sjg@bad.crufty.net> * install-mk (MK_VERSION): 20160401 - + * meta2deps.py: fix old print statement when debugging. * gendirdeps.mk: META2DEPS_CMD append M2D_EXCLUDES with -X @@ -455,12 +558,12 @@ 2016-03-22 Simon J. Gerraty <sjg@bad.crufty.net> * install-mk (MK_VERSION): 20160317 (St. Pats) - + * warnings.mk: g++ does not like -Wimplicit - + * sys.mk sys/*.mk lib.mk prog.mk: use CXX_SUFFIXES to handle the pelthora of common suffixes for C++ - + * lib.mk: use .So for shared objects 2016-03-15 Simon J. Gerraty <sjg@bad.crufty.net> @@ -469,9 +572,9 @@ * meta.stage.mk (LN_CP_SCRIPT): do not ln(1) if we have to chmod(1) normally only applies to scripts. - + * dirdeps.mk: NO_DIRDEPS_BELOW to supress DIRDEPS below RELDIR as - well as outside it. + well as outside it. 2016-03-10 Simon J. Gerraty <sjg@bad.crufty.net> @@ -509,17 +612,17 @@ we cannot use the '$$' trick, but .export-literal does the job we need. * auto.dep.mk: make use .dinclude if we can. - + 2016-02-05 Simon J. Gerraty <sjg@bad.crufty.net> - * dirdeps.mk: + * dirdeps.mk: Add _build_all_dirs such that local.dirdeps.mk can add fully qualified dirs to it. - These will be built normally but the current + These will be built normally but the current DEP_RELDIR will not depend on then (to avoid cycles). This makes it easy to hook things like unit-tests into build. - + 2016-01-21 Simon J. Gerraty <sjg@bad.crufty.net> @@ -541,7 +644,7 @@ to set MK_AUTO_OBJ and MK_DIRDEPS_BUILD include local.sys.env.mk early include local.sys.mk later - + * own.mk (OPTIONS_DEFAULT_NO): AUTO_OBJ etc moved to sys.mk 2015-11-13 Simon J. Gerraty <sjg@bad.crufty.net> @@ -560,8 +663,8 @@ 2015-10-20 Simon J. Gerraty <sjg@bad.crufty.net> * install-mk (MK_VERSION): 20151020 - - * dirdeps.mk: Add logic for + + * dirdeps.mk: Add logic for make -f dirdeps.mk some/dir.${TARGET_SPEC} 2015-10-14 Simon J. Gerraty <sjg@bad.crufty.net> @@ -587,16 +690,16 @@ 2015-06-15 Simon J. Gerraty <sjg@bad.crufty.net> * install-mk (MK_VERSION): 20150615 - + * auto.obj.mk: allow use of MAKEOBJDIRPREFIX too. Follow make's normal precedence rules. - + * gendirdeps.mk: allow customization of the header. - eg. for FreeBSD: + eg. for FreeBSD: GENDIRDEPS_HEADER= echo '\# ${FreeBSD:L:@v@$$$v$$ @:M*F*}'; * meta.autodep.mk: ignore dirdeps.cache* - + * meta.stage.mk: when bootstrapping options it can be handy to throw warnings rather than errors for staging conflicts. @@ -605,11 +708,11 @@ 2015-06-06 Simon J. Gerraty <sjg@bad.crufty.net> * install-mk (MK_VERSION): 20150606 - + * dirdeps.mk: don't rely on manually maintained Makefile.depend to set DEP_RELDIR and reset DIRDEPS. By setting DEP_RELDIR ourselves we can skip :tA - + * gendirdeps.mk: skip setting DEP_RELDIR. 2015-05-24 Simon J. Gerraty <sjg@bad.crufty.net> @@ -626,19 +729,19 @@ * meta.stage.mk: for STAGE_AS_* basename of file may not be unique so first use absolute path as key. - Also skip staging at level 0. + Also skip staging at level 0. 2015-04-30 Simon J. Gerraty <sjg@bad.crufty.net> * install-mk (MK_VERSION): 20150430 - + * dirdeps.mk: fix _count_dirdeps for non-cache case. 2015-04-16 Simon J. Gerraty <sjg@bad.crufty.net> * install-mk (MK_VERSION): 20150411 bump version - + * own.mk: put AUTO_OBJ in OPTIONS_DEFAULT_NO rather than YES. it is here mainly for documentation purposes, since if using auto.obj.mk it is better done via sys.mk @@ -646,21 +749,21 @@ 2015-04-01 Simon J. Gerraty <sjg@bad.crufty.net> * install-mk (MK_VERSION): 20150401 - + * meta2deps.sh: support @list - + * meta2deps.py: updates from Juniper - o add EXCLUDES + o add EXCLUDES o skip bogus input files. o treat 'M' and 'L' as both an 'R' and a 'W' 2015-03-03 Simon J. Gerraty <sjg@bad.crufty.net> * install-mk (MK_VERSION): 20150303 - + * dirdeps.mk: if MK_DIRDEPS_CACHE is yes, use dirdeps-cache which is built via sub-make so we have a .meta file to tell if - it is out-of-date. + it is out-of-date. The dirdeps-cache contains the same dependency rules that we normaly construct on the fly. This adds a few seconds overhead when the cache is out of date, @@ -669,15 +772,15 @@ 2014-11-18 Simon J. Gerraty <sjg@bad.crufty.net> * install-mk (MK_VERSION): 20141118 - + * meta.stage.mk: add stale_staged - + * dirdeps.mk (_DIRDEP_USE_LEVEL): allow this to be tweaked only useful under very rare conditions such as FreeBSD's make universe. * auto.obj.mk: Allow MK_AUTO_OBJ to set MKOBJDIRS=auto - + 2014-11-11 Simon J. Gerraty <sjg@bad.crufty.net> * install-mk (MK_VERSION): 20141111 @@ -695,24 +798,24 @@ for GENDIRDEPS_FILTER to avoid surprises. 2014-10-10 Simon J. Gerraty <sjg@bad.crufty.net> - + * dirdeps.mk (NSkipHostDir): this needs SRCTOP prepended since by the time it is applied to __depdirs they have. - + * dirdeps.mk fix filtering of _machines since M_dep_qual_fixes expects patterns like *.${MACHINE} - + * cython.mk (pyprefix?): use pyprefix to find python bits since prefix might be something else (where we install our stuff) - + 2014-09-11 Simon J. Gerraty <sjg@bad.crufty.net> * install-mk (MK_VERSION): 20140911 - + * dirdeps.mk: add bootstrap target to simplify adding support for new MACHINE. - + 2014-09-01 Simon J. Gerraty <sjg@bad.crufty.net> * gendirdeps.mk: Add handling of GENDIRDEPS_FILTER_DIR_VARS and @@ -722,7 +825,7 @@ 2014-08-28 Simon J. Gerraty <sjg@bad.crufty.net> * install-mk (MK_VERSION): 20140828 - + * cython.mk: capture logic for building python extension modules with Cython. @@ -735,8 +838,8 @@ * install-mk (MK_VERSION): 20140801 * dep.mk: use explicit MKDEP_MK rather than overload MKDEP to - identify the autodep.mk variant. - + identify the autodep.mk variant. + * sys.dependfile.mk: delete .MAKE.DEPENDFILE if its initial value does not match .MAKE.DEPENDFILE_PREFIX @@ -774,7 +877,7 @@ build). * dirdeps.mk (__depdirs): ensure // don't sneak in - + * gendirdeps.mk (DIRDEPS): ensure // don't sneak in @@ -794,7 +897,7 @@ 2014-02-09 Simon J. Gerraty <sjg@bad.crufty.net> - * options.mk: cleanup and simplify semanitcs + * options.mk: cleanup and simplify semanitcs NO_* dominates all, if both WITH_* and WITHOUT_* are defined then result is DOMINATE_* which defaults to "no". Ie. WITHOUT_ normally wins. @@ -815,7 +918,7 @@ as _build_dirs. Also fix the filtering of Makefile.depend files - for reporting what we are looking for (M_dep_qual_fixes can get confused by - Makefile.depend) + Makefile.depend) Add some more debug info. 2013-09-04 Simon J. Gerraty <sjg@bad.crufty.net> @@ -828,7 +931,7 @@ * install-mk (MK_VERSION): 20130801 * libs.mk: update to match progs.mk - + 2013-07-26 Simon J. Gerraty <sjg@bad.crufty.net> * install-mk (MK_VERSION): 20130726 @@ -837,13 +940,13 @@ errors also allow @file to provide huge list of .meta files. * meta2deps.py: add try_parse() to cleanup the above. - + 2013-07-16 Simon J. Gerraty <sjg@bad.crufty.net> * install-mk (MK_VERSION): 20130716 * own.mk: add GPROG as an option * prog.mk: honor MK_GPROF==yes - + 2013-05-10 Simon J. Gerraty <sjg@bad.crufty.net> * install-mk (MK_VERSION): 20130505 @@ -878,7 +981,7 @@ * meta.stage.mk (LN_CP_SCRIPT): Add LnCp to do the ln||cp dance consistently. * dirdeps.mk: better describe the dance in sys.mk for TARGET_SPEC. - + 2013-03-18 Simon J. Gerraty <sjg@bad.crufty.net> * gendirdeps.mk: revert the dance around .MAKE.DEPENDFILE_DEFAULT @@ -893,7 +996,7 @@ * gendirdeps.mk: ensure _objroot has trailing / if it needs it. * meta2deps.py: if machine is "host", then also trim self.host_target from any OBJROOTS. - + 2013-03-11 Simon J. Gerraty <sjg@bad.crufty.net> @@ -909,7 +1012,7 @@ 2013-03-07 Simon J. Gerraty <sjg@bad.crufty.net> - * sys.dependfile.mk (.MAKE.DEPENDFILE_DEFAULT): + * sys.dependfile.mk (.MAKE.DEPENDFILE_DEFAULT): use a separate variable for the default .MAKE.DEPENDFILE value so that it can be controlled independently of .MAKE.DEPENDFILE_PREFERENCE @@ -926,12 +1029,12 @@ 2013-02-10 Simon J. Gerraty <sjg@bad.crufty.net> * install-mk (MK_VERSION): bump version to 20130210 - * import latest dirdeps.mk, gendirdeps.mk and meta2deps.py - from Juniper. + * import latest dirdeps.mk, gendirdeps.mk and meta2deps.py + from Juniper. o dirdeps.mk now fully supports TARGET_SPEC consisting of more than just MACHINE. o no longer use DEP_MACHINE from Makefile.depend* so remove it. - + 2013-01-23 Simon J. Gerraty <sjg@bad.crufty.net> * install-mk (MK_VERSION): bump version to 20130123 @@ -976,13 +1079,13 @@ * progs.mk: add MAN and CXXFLAGS to PROG_VARS also add PROGS_TARGETS and pass on PROG_CXX if it seems appropriate. - + 2012-11-04 Simon J. Gerraty <sjg@bad.crufty.net> * meta.stage.mk: update CLEANFILES remove redundant cp of .dirdep from STAGE_AS_SCRIPT. * progs.mk: Add LDADD to PROG_VARS - + 2012-10-12 Simon J. Gerraty <sjg@bad.crufty.net> * meta.stage.mk (STAGE_DIR_FILTER): track dirs we stage to in @@ -1004,11 +1107,11 @@ * install-mk (MK_VERSION): bump version to 20120711 * dep.mk: add explicit dependencies on SRCS after applying - SRCS_DEP_FILTER + SRCS_DEP_FILTER * meta.autodep.mk: add explicit dependencies on SRCS after applying SRCS_DEP_FILTER * meta.autodep.mk: ensure GENDIRDEPS_FILTER is exported if needed. - + 2012-06-26 Simon J. Gerraty <sjg@bad.crufty.net> * install-mk (MK_VERSION): bump version to 20120626 @@ -1020,14 +1123,14 @@ * gendirdeps.mk: only produce unqualified deps if no .MAKE.DEPENDFILE_PREFERENCE ends in .${MACHINE} * meta.subdir.mk: apply SUBDIRDEPS_FILTER - + 2012-04-20 Simon J. Gerraty <sjg@bad.crufty.net> * install-mk (MK_VERSION): bump version to 20120420 * add sys.dependfile.mk so we can experiment with - .MAKE.DEPENDFILE_PREFERENCE + .MAKE.DEPENDFILE_PREFERENCE * meta.autodep.mk: _DEPENDFILE is precious! - + 2012-03-15 Simon J. Gerraty <sjg@bad.crufty.net> * install-mk (MK_VERSION): bump version to 20120315 @@ -1068,37 +1171,37 @@ o meta2deps.py add a clear 'ERROR:' token if an exception is raised. o gendirdeps.mk if ERROR: from meta2deps.py do not update anything. - + 2011-10-30 Simon J. Gerraty <sjg@bad.crufty.net> * install-new.mk separate the cmp and copy logic to its own function. - + 2011-10-28 Simon J. Gerraty <sjg@bad.crufty.net> * install-mk (MK_VERSION): bump version to 20111028 * sys.mk: include auto.obj.mk if MKOBJDIRS is set to auto * subdir.mk: ensure _SUBDIRUSE is provided - * meta.autodep.mk: remove dependency of gendirdeps.mk on auto.obj.mk + * meta.autodep.mk: remove dependency of gendirdeps.mk on auto.obj.mk * meta.subdir.mk: always allow for Makefile.depend - + 2011-10-10 Simon J. Gerraty <sjg@bad.crufty.net> * install-mk (MK_VERSION): bump version to 20111010 o minor tweak to *dirdeps.mk from Juniper sjg@ - + 2011-10-01 Simon J. Gerraty <sjg@bad.crufty.net> * install-mk (MK_VERSION): bump version to 20111001 o add meta2deps.py from Juniper sjg@ o tweak gendirdeps.mk to work with meta2deps.py when not - cross-building - * autoconf.mk: add autoconf-input as a hook for regenerating + cross-building + * autoconf.mk: add autoconf-input as a hook for regenerating AUTOCONF_INPUTS (configure). 2011-08-24 Simon J. Gerraty <sjg@bad.crufty.net> * meta.autodep.mk: if we do not have OBJS, .depend isn't a useful - trigger for updating Makefile.depend* + trigger for updating Makefile.depend* 2011-08-08 Simon J. Gerraty <sjg@bad.crufty.net> @@ -1155,7 +1258,7 @@ 2011-04-03 Simon J. Gerraty <sjg@bad.crufty.net> * rst2htm.mk: convert rst to s5 (slides) or plain html depending - on target name. + on target name. 2011-03-30 Simon J. Gerraty <sjg@bad.crufty.net> @@ -1167,16 +1270,16 @@ can be used to debug level 0 only and DEBUG_MAKE_FLAGS for the rest. * sys.mk: re-define M_whence in terms of M_type. M_type is useful for checking if something is a builtin. - + 2011-03-16 Simon J. Gerraty <sjg@bad.crufty.net> * meta.stage.mk: add stage_symlinks and leverage StageLinks for - stage_libs + stage_libs 2011-03-10 Simon J. Gerraty <sjg@bad.crufty.net> * dirdeps.mk: correct value for _depdir_files depends on - .MAKE.DEPENDFILE + .MAKE.DEPENDFILE Add our copyright - just to make it clear we have frobbed this quite a bit. DEP_MACHINE needs to be set to MACHINE each time, if using only @@ -1216,7 +1319,7 @@ 2010-09-24 Simon J. Gerraty <sjg@bad.crufty.net> * install-mk (MK_VERSION): bump version to 20100919 - include dirdeps.mk et al from Juniper Networks, + include dirdeps.mk et al from Juniper Networks, for meta mode - requires filemon(9). * sys.mk, subdir.mk: Add hooks for meta mode. we do this as meta.sys.mk, meta.autodep.mk and meta.subdir.mk @@ -1282,7 +1385,7 @@ * install-mk (MK_VERSION): bump version to 20100420 * sys/NetBSD.mk: add MACHINE_CPU to keep netbsd makefiles happy * autoconf.mk allow AUTO_AUTOCONF - + 2010-04-19 Simon J. Gerraty <sjg@bad.crufty.net> * obj.mk: add objwarn to keep freebsd makefiles happy @@ -1294,7 +1397,7 @@ * auto.dep.mk: add some explanation of how/what we do. * autodep.mk: skip the .OPTIONAL frobbing of .depend bmake's FROM_DEPEND flag makes it redundant. - + 2010-04-13 Simon J. Gerraty <sjg@bad.crufty.net> * install-mk (MK_VERSION): bump version to 20100404 @@ -1335,7 +1438,7 @@ * sys.mk,libnames.mk add .-include <local.*> this allows local customization without the need to edit the - distributed files. + distributed files. 2009-12-14 Simon J. Gerraty <sjg@void.crufty.net> @@ -1361,7 +1464,7 @@ 2009-11-17 Simon J. Gerraty <sjg@void.crufty.net> * install-mk (MK_VERSION): bump version - * host-target.mk: only export the expensive stuff + * host-target.mk: only export the expensive stuff * Generic.sys.mk (sys_mk): for SunOS we need to look for ${HOST_OS}.${HOST_OSMAJOR} too! @@ -1411,7 +1514,7 @@ * install-mk (MK_VERSION): bump version * general cleanup - * dpadd.mk introduce DPMAGIC_LIBS_* + * dpadd.mk introduce DPMAGIC_LIBS_* 2007-04-30 Simon J. Gerraty <sjg@void.crufty.net> @@ -1453,10 +1556,10 @@ * install-mk (MK_VERSION): bump version to 20061126 * warnings.mk: detect invalid WARNINGS_SET - + * warnings.mk: use ${.TARGET:T:R}.o when looking for target - specific warnings. - + specific warnings. + * For .cc sources, turn off warnings that g++ vomits on. 2006-11-08 Simon J. Gerraty <sjg@void.crufty.net> @@ -1483,11 +1586,11 @@ 2006-03-01 Simon J. Gerraty <sjg@void.crufty.net> * install-mk (MK_VERSION): bump version to 20060301 - * autodep.mk (.depend): + * autodep.mk (.depend): if MAKE_VERSION is newer than 20050530 we can make .END depend on .depend and make .depend depend on __depsrcs that exist. * dpadd.mk: add SRC_PATHADD - + 2005-11-04 Simon J. Gerraty <sjg@void.crufty.net> * install-mk (MK_VERSION): bump version to 20051104 @@ -1512,7 +1615,7 @@ 2004-02-15 Simon J. Gerraty <sjg@void.crufty.net> * own.mk: don't use NetBSD's _SRC_TOP_ it can - cause confusion. Also don't take just 'mk' as a + cause confusion. Also don't take just 'mk' as a srctop indicator. 2004-02-14 Simon J. Gerraty <sjg@void.crufty.net> @@ -1538,7 +1641,7 @@ * set OS and ROOT_GROUP for those that we know the value. for others (eg. Generic.sys.mk) wrap the != in an .ifndef so we don't do it again for each sub-make. - + 2003-09-28 Simon J. Gerraty <sjg@void.crufty.net> * install-mk (MK_VERSION): 20030928 @@ -1554,8 +1657,8 @@ 2003-07-31 Simon J. Gerraty <sjg@void.crufty.net> - * install-mk: add ability to use cp -f when updating - destination .mk files. Also now possible to play games with + * install-mk: add ability to use cp -f when updating + destination .mk files. Also now possible to play games with FORCE_SYS_MK=ln etc on *BSD machines to link /usr/share/mk/sys.mk into dest - not recommended unless you seriously want to. @@ -1575,4 +1678,4 @@ * install-mk: Allow FORCE_SYS_MK to come from env - + @@ -61,6 +61,7 @@ warnings.mk whats.mk yacc.mk dirdeps.mk +dirdeps-cache-update.mk dirdeps-options.mk dirdeps-targets.mk gendirdeps.mk diff --git a/mk/README b/mk/README index 3d79b6a2de7d..161426cfcd0c 100644 --- a/mk/README +++ b/mk/README @@ -1,10 +1,10 @@ -# $Id: README,v 1.1 1997/03/11 07:27:15 sjg Exp $ +# $Id: README,v 1.2 2020/08/19 17:51:53 sjg Exp $ This directory contains some macro's derrived from the NetBSD bsd.*.mk macros. They have the same names but without the bsd., separate macro files are needed to ensure we can make them do what we want for builing things outside of /usr/src. Nearly all the comments below -apply. +apply. # $NetBSD: bsd.README,v 1.18 1997/01/13 00:54:23 mark Exp $ # @(#)bsd.README 5.1 (Berkeley) 5/11/90 @@ -347,9 +347,9 @@ If foo has multiple source files, add the line: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= The include file <bsd.subdir.mk> contains the default targets for building -subdirectories. It has the same eight targets as <bsd.prog.mk>: all, +subdirectories. It has the same eight targets as <bsd.prog.mk>: all, clean, cleandir, depend, includes, install, lint, and tags. For all of -the directories listed in the variable SUBDIRS, the specified directory +the directories listed in the variable SUBDIRS, the specified directory will be visited and the target made. There is also a default target which allows the command "make subdir" where subdir is any directory listed in the variable SUBDIRS. diff --git a/mk/auto.dep.mk b/mk/auto.dep.mk index 55b2971be6e0..d905649ab206 100644 --- a/mk/auto.dep.mk +++ b/mk/auto.dep.mk @@ -1,16 +1,16 @@ # # RCSid: -# $Id: auto.dep.mk,v 1.5 2016/04/05 15:58:37 sjg Exp $ +# $Id: auto.dep.mk,v 1.6 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 2010, 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 +# 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 # @@ -20,11 +20,11 @@ # set MKDEP_MK=auto.dep.mk and dep.mk will include us -# This version differs from autodep.mk, in that +# This version differs from autodep.mk, in that # we use ${.TARGET:T}.d rather than ${.TARGET:T:R}.d # this makes it simpler to get the args to -MF and -MT right # and ensure we can simply include all the .d files. -# +# # However suffix rules do not work with something like .o.d so we # don't even try to handle 'make depend' gracefully. # dep.mk will handle that itself. @@ -37,7 +37,7 @@ __${.PARSEFILE}__: # set this to -MMD to ignore /usr/include # actually it ignores <> so may not be a great idea -CFLAGS_MD ?= -MD +CFLAGS_MD ?= -MD # -MF etc not available on all gcc versions. CFLAGS_MF ?= -MF ${.TARGET:T}.d -MT ${.TARGET:T} CFLAGS += ${CFLAGS_MD} ${CFLAGS_MF} diff --git a/mk/auto.obj.mk b/mk/auto.obj.mk index a12ea7a81318..0405b5e6441d 100644 --- a/mk/auto.obj.mk +++ b/mk/auto.obj.mk @@ -1,14 +1,14 @@ -# $Id: auto.obj.mk,v 1.15 2017/11/04 21:05:04 sjg Exp $ +# $Id: auto.obj.mk,v 1.16 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 2004, 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 +# 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 # @@ -16,7 +16,7 @@ ECHO_TRACE ?= echo .ifndef Mkdirs -# A race condition in some versions of mkdir, means that it can bail +# A race condition in some versions of mkdir, means that it can bail # if another process made a dir that mkdir expected to. # We repeat the mkdir -p a number of times to try and work around this. # We stop looping as soon as the dir exists. @@ -53,7 +53,7 @@ __objdir:= ${__objdir} # We need to chdir, make the directory if needed .if !exists(${__objdir}/) && \ (${.TARGETS} == "" || ${.TARGETS:Nclean*:N*clean:Ndestroy*} != "") -# This will actually make it... +# This will actually make it... __objdir_made != echo ${__objdir}/; umask ${OBJDIR_UMASK:U002}; \ ${ECHO_TRACE} "[Creating objdir ${__objdir}...]" >&2; \ ${Mkdirs}; Mkdirs ${__objdir} diff --git a/mk/autoconf.mk b/mk/autoconf.mk index 38f4ece48ad6..61e6978043a8 100644 --- a/mk/autoconf.mk +++ b/mk/autoconf.mk @@ -1,14 +1,14 @@ -# $Id: autoconf.mk,v 1.9 2017/08/13 20:03:13 sjg Exp $ +# $Id: autoconf.mk,v 1.10 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 1996-2009, 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 +# 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 # @@ -49,7 +49,7 @@ CLEANFILES+= config.recheck config.gen config.status *.meta AUTOCONF ?= autoconf AUTOHEADER ?= autoheader -# expand it to a full path +# expand it to a full path AUTOCONF := ${AUTOCONF:${M_whence}} .if exists(${AUTOCONF}) diff --git a/mk/autodep.mk b/mk/autodep.mk index 7b5029f15728..a7bb942278c9 100644 --- a/mk/autodep.mk +++ b/mk/autodep.mk @@ -1,16 +1,16 @@ # # RCSid: -# $Id: autodep.mk,v 1.37 2020/04/17 21:08:17 sjg Exp $ +# $Id: autodep.mk,v 1.38 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 1999-2010, 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 +# 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 @@ -51,7 +51,7 @@ ${s:T:R}.d: $s .endfor __depsrcs:=${__depsrcs:T:R:S/$/.d/g} -# we also need to handle makefiles where the .d's from __depsrcs +# we also need to handle makefiles where the .d's from __depsrcs # don't match those from OBJS # we avoid using := here, since the modifier applied to OBJS # can cause trouble if there are any undefined vars in OBJS. @@ -64,7 +64,7 @@ __dependsrcs= ${__dependsrcsx:O:u} # set this to -MMD to ignore /usr/include # actually it ignores <> so may not be a great idea -CFLAGS_MD?=-MD +CFLAGS_MD?=-MD # -MF etc not available on all gcc versions. # we "fix" the .o later CFLAGS_MF?=-MF ${.TARGET:T:R}.d -MT ${.TARGET:T:R}.o @@ -73,8 +73,8 @@ RM?= rm MAKE_SHELL?= sh # watch out for people who don't use CPPFLAGS -CPPFLAGS_MD=${CFLAGS:M-[IUD]*} ${CPPFLAGS} -CXXFLAGS_MD=${CXXFLAGS:M-[IUD]*} ${CPPFLAGS} +CPPFLAGS_MD=${CFLAGS:M-[IUD]*} ${CPPFLAGS} +CXXFLAGS_MD=${CXXFLAGS:M-[IUD]*} ${CPPFLAGS} # just in case these need to be different CC_MD?=${CC} diff --git a/mk/compiler.mk b/mk/compiler.mk index 40a57c081ab4..b20ecaa047e3 100644 --- a/mk/compiler.mk +++ b/mk/compiler.mk @@ -1,14 +1,14 @@ -# $Id: compiler.mk,v 1.6 2019/09/28 17:12:00 sjg Exp $ +# $Id: compiler.mk,v 1.7 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 2019, 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 +# 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 # diff --git a/mk/cython.mk b/mk/cython.mk index c1318b2174e9..d3c229c7269a 100644 --- a/mk/cython.mk +++ b/mk/cython.mk @@ -1,15 +1,15 @@ # RCSid: -# $Id: cython.mk,v 1.7 2018/03/25 18:46:11 sjg Exp $ +# $Id: cython.mk,v 1.8 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 2014, 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 +# 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 # diff --git a/mk/dirdeps-cache-update.mk b/mk/dirdeps-cache-update.mk new file mode 100644 index 000000000000..eb992e936eb8 --- /dev/null +++ b/mk/dirdeps-cache-update.mk @@ -0,0 +1,179 @@ +# $Id: dirdeps-cache-update.mk,v 1.21 2020/08/19 17:51:53 sjg Exp $ +# +# @(#) Copyright (c) 2020, 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 deals with the updating of STATIC_DIRDEPS_CACHE. +# Some targets are so huge that computing dirdeps takes a significant +# amount of time. For such targets a STATIC_DIRDEPS_CACHE can make +# sense. +# +# If the target is represented by targets/pseudo/production +# it's normal DIRDEPS would be in +# targets/pseudo/production/Makefile.depend +# and STATIC_DIRDEPS_CACHE would be +# targets/pseudo/production/Makefile.dirdeps.cache +# which is simply initialized by copying dirdeps.cache.production +# from $OBJTOP +# +# When dirdeps-targets.mk is initializing DIRDEPS it will look for +# Makefile.dirdeps.cache and unless told not to +# (MK_STATIC_DIRDEPS_CACHE=no) will use it as DIRDEPS_CACHE. +# +# If MK_STATIC_DIRDEPS_CACHE_UPDATE is "yes", then this makefile +# comes into play. +# +# We usually get included from local.dirdeps.mk +# as well as Makefile.depend of RELDIR with a static Makefile.dirdeps.cache +# +# If we see that STATIC_DIRDEPS_CACHE is in use, we need to hook a +# cache-update target into the build to regenerate dirdeps.cache +# in parallel with the rest of the build. +# If MK_STATIC_DIRDEPS_CACHE_UPDATE_IMMEDIATE is "yes" we update +# STATIC_DIRDEPS_CACHE as soon as the update is ready, +# otherwise it will be done at the end of the build. +# +# If STATIC_DIRDEPS_CACHE is not in use, but a DIRDEPS_CACHE is, +# then we need do nothing except export STATIC_DIRDEPS_CACHE and +# DYNAMIC_DIRDEPS_CACHE for use when we are include during the visit +# to the ultimate target (targets/pseudo/production). +# +# Regardless of which happens, when included at .MAKE.LEVEL > 0 +# for a target other than cache-update we simply copy +# DYNAMIC_DIRDEPS_CACHE to STATIC_DIRDEPS_CACHE with some optional +# filtering. +# +# If we are included for the target cache-update we take care of +# running dirdeps.mk again to generate the DYNAMIC_DIRDEPS_CACHE. +# + +.if !target(_${.PARSEFILE}_) +_${.PARSEFILE}_: .NOTMAIN + +STATIC_CACHE_SED += \ + -e '/Autogenerated/s,-.*,- edit with care!,' \ + -e '/cache-update/d' + +STATIC_DIRDEPS_CACHE_UPDATE_SCRIPT ?= \ + { echo Saving ${DYNAMIC_DIRDEPS_CACHE} as ${STATIC_DIRDEPS_CACHE}; \ + sed ${STATIC_CACHE_SED} ${DYNAMIC_DIRDEPS_CACHE} > ${STATIC_DIRDEPS_CACHE}; } +.endif + +.if ${MK_DIRDEPS_CACHE:Uno} == "yes" +.if ${MK_STATIC_DIRDEPS_CACHE_UPDATE:Uno} == "yes" +.if ${_debug_reldir:U0} || ${DEBUG_DIRDEPS:U:Mcache*} != "" +_debug_cache = 1 +.else +_debug_cache = 0 +.endif + +.if ${.MAKE.LEVEL} == 0 && !make(cache-update) + +.if ${_debug_cache} +.info ${MK_STATIC_DIRDEPS_CACHE_UPDATE MK_STATIC_DIRDEPS_CACHE MK_DIRDEPS_CACHE DIRDEPS_CACHE STATIC_DIRDEPS_CACHE:L:@v@$v=${$v}@} +.endif + +.if ${MK_STATIC_DIRDEPS_CACHE} == "yes" && defined(STATIC_DIRDEPS_CACHE) && exists(${STATIC_DIRDEPS_CACHE}) +.if !make(dirdeps) +# We are using static cache and this is the only look we will get. +# We want to generate an updated cache while we build +# so need to hook cache-update to dirdeps now. +# Note: we are running as a sibling to dirdeps-cached, +# attempting to do this in that context is problematic. + +# One of these should exist - to actually kick off the cache generation +.for d in ${STATIC_DIRDEPS_CACHE:H}/cache-update ${STATIC_DIRDEPS_CACHE:H:H}/cache-update ${STATIC_DIRDEPS_CACHE:H:H:H}/cache-update +.if exists($d) +cache_update_dirdep ?= $d.${TARGET_SPEC} +.endif +.endfor +.if !target(${cache_update_dirdep}) +dirdeps: ${cache_update_dirdep} +${cache_update_dirdep}: _DIRDEP_USE +DYNAMIC_DIRDEPS_CACHE := ${OBJTOP}/dirdeps.cache.${STATIC_DIRDEPS_CACHE:H:T}-update +.export DYNAMIC_DIRDEPS_CACHE STATIC_DIRDEPS_CACHE +.endif +.endif # make(dirdeps) +.endif # MK_* + +.endif # .MAKE.LEVEL 0 + +.if ${.MAKE.LEVEL} > 0 && ${.CURDIR:T} == "cache-update" +# we are the background update shim + +.if ${_debug_cache} +.info level ${.MAKE.LEVEL}: ${MK_DIRDEPS_CACHE DYNAMIC_DIRDEPS_CACHE STATIC_DIRDEPS_CACHE:L:@v@$v=${$v}@} +.endif + +all: cache-build +cache-build: .META + @set -x; MAKELEVEL=0 \ + ${.MAKE} -C ${SRCTOP} -f ${RELDIR}/Makefile cache-update \ + -DWITHOUT_STATIC_DIRDEPS_CACHE_UPDATE + +.endif # cache-update + +.elif ${.MAKE.LEVEL} == 0 && make(cache-update) && !target(cache-update) +# we were invoked above +# we just leverage dirdeps.mk +BUILD_DIRDEPS_TARGETS := ${STATIC_DIRDEPS_CACHE:H:T} +DIRDEPS := ${STATIC_DIRDEPS_CACHE:H:S,^${SRCTOP}/,,}.${TARGET_SPEC} +DIRDEPS_CACHE := ${DYNAMIC_DIRDEPS_CACHE} + +.if ${DEBUG_DIRDEPS:U:Mcache*} != "" +.info level 0: ${MK_DIRDEPS_CACHE DIRDEPS_CACHE DIRDEPS:L:@v@$v=${$v}@} +.endif + +# so cache-built below can check on us +x!= echo; echo ${.MAKE.PID} > ${DIRDEPS_CACHE}.new.pid + +cache-update: ${DIRDEPS_CACHE} + @rm -f ${DIRDEPS_CACHE}.new.pid +.if ${MK_STATIC_DIRDEPS_CACHE_UPDATE_IMMEDIATE:Uno} == "yes" + ${STATIC_DIRDEPS_CACHE_UPDATE_SCRIPT} +.endif + +all: + +.include <dirdeps.mk> + +.endif # MK_STATIC_DIRDEPS_CACHE_UPDATE +.endif # MK_DIRDEPS_CACHE + +.if ${.MAKE.LEVEL} > 0 && ${MK_STATIC_DIRDEPS_CACHE_UPDATE:Uno} == "yes" && \ + ${STATIC_DIRDEPS_CACHE:Uno:H} == "${SRCTOP}/${RELDIR}" +.if !defined(DYNAMIC_DIRDEPS_CACHE) +all: +.else +# This is the easy bit, time to save the cache + +all: cache-update + +# ensure the cache update is completed +cache-built: + @test -s ${DYNAMIC_DIRDEPS_CACHE}.new || exit 0; \ + pid=`cat ${DYNAMIC_DIRDEPS_CACHE}.new.pid 2> /dev/null`; \ + test $${pid:-0} -gt 1 || exit 0; \ + echo "Waiting for $$pid to finish ${DYNAMIC_DIRDEPS_CACHE} ..."; \ + while 'kill' -0 $$pid; do sleep 30; done > /dev/null 2>&1 + +cache-update: cache-built +.if ${MK_STATIC_DIRDEPS_CACHE_UPDATE_IMMEDIATE:Uno} == "no" + @test ! -s ${DYNAMIC_DIRDEPS_CACHE} || \ + ${STATIC_DIRDEPS_CACHE_UPDATE_SCRIPT} +.endif + +.endif +.endif diff --git a/mk/dirdeps-options.mk b/mk/dirdeps-options.mk index 4f74c02e1b8c..74f54a4cf665 100644 --- a/mk/dirdeps-options.mk +++ b/mk/dirdeps-options.mk @@ -1,6 +1,6 @@ -# $Id: dirdeps-options.mk,v 1.9 2018/09/20 00:07:19 sjg Exp $ +# $Id: dirdeps-options.mk,v 1.17 2020/08/07 01:57:38 sjg Exp $ # -# @(#) Copyright (c) 2018, Simon J. Gerraty +# @(#) Copyright (c) 2018-2020, Simon J. Gerraty # # This file is provided in the hope that it will # be of use. There is absolutely NO WARRANTY. @@ -37,6 +37,11 @@ # 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. +# +# In some cases the value of MK_FOO might depend on TARGET_SPEC +# so we qualify MK_FOO with .${TARGET_SPEC} and each component +# TARGET_SPEC_VAR (in reverse order) before using MK_FOO. +# # This should have been set by Makefile.depend.options # before including us @@ -47,21 +52,43 @@ DIRDEPS_OPTIONS ?= .if ${.MAKE.LEVEL} == 0 # :U below avoids potential errors when we := -.for o in ${DIRDEPS_OPTIONS:tu} -DIRDEPS += ${DIRDEPS.$o.${MK_$o:U}:U} +# some options can depend on TARGET_SPEC! +DIRDEPS_OPTIONS_QUALIFIER_LIST ?= \ + ${DEP_TARGET_SPEC:U${TARGET_SPEC}} \ + ${TARGET_SPEC_VARSr:U${TARGET_SPEC_VARS}:@v@${DEP_$v:U${$v}}@} +# note that we need to include $o in the variable _o$o +# to ensure correct evaluation. +.for o in ${DIRDEPS_OPTIONS} +.undef _o$o _v$o +.for x in ${DIRDEPS_OPTIONS_QUALIFIER_LIST} +.if defined(MK_$o.$x) +_o$o ?= MK_$o.$x +_v$o ?= ${MK_$o.$x} +.endif +.endfor +_v$o ?= ${MK_$o} +.if ${_debug_reldir:U0} +.info ${DEP_RELDIR:U${RELDIR}}.${DEP_TARGET_SPEC:U${TARGET_SPEC}}: o=$o ${_o$o:UMK_$o}=${_v$o:U} DIRDEPS += ${DIRDEPS.$o.${_v$o:U}:U} +.endif +DIRDEPS += ${DIRDEPS.$o.${_v$o:U}:U} .endfor DIRDEPS := ${DIRDEPS:O:u} +.if ${_debug_reldir:U0} +.info ${DEP_RELDIR:U${RELDIR}}: DIRDEPS=${DIRDEPS} +.endif # avoid cross contamination -.for o in ${DIRDEPS_OPTIONS:tu} +.for o in ${DIRDEPS_OPTIONS} .undef DIRDEPS.$o.yes .undef DIRDEPS.$o.no +.undef _o$o +.undef _v$o .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 o in ${DIRDEPS_OPTIONS} .for d in ${DIRDEPS.$o.yes} ${DIRDEPS.$o.no} .if exists(${SRCTOP}/$d) GENDIRDEPS_FILTER += N$d* diff --git a/mk/dirdeps-targets.mk b/mk/dirdeps-targets.mk index 50a1970d6211..73dcf3639d3b 100644 --- a/mk/dirdeps-targets.mk +++ b/mk/dirdeps-targets.mk @@ -1,15 +1,15 @@ # RCSid: -# $Id: dirdeps-targets.mk,v 1.10 2020/06/06 22:41:02 sjg Exp $ +# $Id: dirdeps-targets.mk,v 1.22 2020/08/15 18:00:11 sjg Exp $ # # @(#) Copyright (c) 2019-2020 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 +# 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 # @@ -25,7 +25,16 @@ # We then search those dirs for any Makefile.depend* # Finally we select any that match conditions like REQUESTED_MACHINE # or TARGET_SPEC and initialize DIRDEPS accordingly. -# +# +# We will check each of the initial DIRDEPS for Makefile.dirdeps.options +# and include any found. +# This makes it feasible to tweak options like MK_DIRDEPS_CACHE +# for a specific target. +# +# If MK_STATIC_DIRDEPS_CACHE is defined we will check if the +# initial DIRDEPS has a static cache (Makefile.dirdeps.cache). +# This only makes sense for seriously expensive targets. +# .if ${.MAKE.LEVEL} == 0 # pickup customizations @@ -125,12 +134,38 @@ DIRDEPS := ${DIRDEPS:O:u} .endif # if we got DIRDEPS get to work .if !empty(DIRDEPS) +DIRDEPS.dirs := ${DIRDEPS:S,^,${SRCTOP}/,:@d@${exists($d):?$d:${d:R}}@} +# some targets what to tweak options we might want to process now +.for m in ${DIRDEPS.dirs:S,$,/Makefile.dirdeps.options,} +.-include <$m> +.endfor +.if defined(MK_STATIC_DIRDEPS_CACHE) +# some targets are very expensive to compute dirdeps for +# so we may have a static cache +.for c in ${DIRDEPS.dirs:S,$,/Makefile.dirdeps.cache,} +.if exists($c) +STATIC_DIRDEPS_CACHE ?= $c +.if ${MK_STATIC_DIRDEPS_CACHE} == "yes" +DIRDEPS_CACHE ?= $c +MK_DIRDEPS_CACHE = yes +.endif +.endif +.endfor +.if defined(STATIC_DIRDEPS_CACHE) +.export STATIC_DIRDEPS_CACHE +.endif +.endif + +# allow a top-level makefile to do other stuff +# before including dirdeps.mk +.if ${MK_DIRDEPS_TARGETS_INCLUDE_DIRDEPS:Uyes} == "yes" .include <dirdeps.mk> +.endif DIRDEPS_TARGETS_SKIP += all clean* destroy* .for t in ${.TARGETS:${DIRDEPS_TARGETS_SKIP:${M_ListToSkip}}} $t: dirdeps -.endfor +.endfor .endif .endif diff --git a/mk/dirdeps.mk b/mk/dirdeps.mk index 337692479898..16673a04c07b 100644 --- a/mk/dirdeps.mk +++ b/mk/dirdeps.mk @@ -1,4 +1,4 @@ -# $Id: dirdeps.mk,v 1.106 2020/07/11 16:25:17 sjg Exp $ +# $Id: dirdeps.mk,v 1.125 2020/08/26 21:49:45 sjg Exp $ # Copyright (c) 2010-2020, Simon J. Gerraty # Copyright (c) 2010-2018, Juniper Networks, Inc. @@ -41,7 +41,7 @@ # or .<target_spec> suffix (see TARGET_SPEC_VARS below), # for example to force building something for the pseudo # machines "host" or "common" regardless of current ${MACHINE}. -# +# # All unqualified entries end up being qualified with .${TARGET_SPEC} # and partially qualified (if TARGET_SPEC_VARS has multiple # entries) are also expanded to a full .<target_spec>. @@ -50,29 +50,22 @@ # # The fully qualified directory entries are used to construct a # dependency graph that will drive the build later. -# +# # Also, for each fully qualified directory target, we will search # using ${.MAKE.DEPENDFILE_PREFERENCE} to find additional # dependencies. We use Makefile.depend (default value for # .MAKE.DEPENDFILE_PREFIX) to refer to these makefiles to # distinguish them from others. -# +# # 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. -# +# # Since each Makefile.depend file includes dirdeps.mk, this # processing is recursive and results in .MAKE.LEVEL 0 learning the # dependencies of the tree wrt the initial directory (_DEP_RELDIR). # -# BUILD_AT_LEVEL0 -# Indicates whether .MAKE.LEVEL 0 builds anything: -# if "no" sub-makes are used to build everything, -# if "yes" sub-makes are only used to build for other machines. -# It is best to use "no", but this can require fixing some -# makefiles to not do anything at .MAKE.LEVEL 0. -# # TARGET_SPEC_VARS # The default value is just MACHINE, and for most environments # this is sufficient. The _DIRDEP_USE target actually sets @@ -113,12 +106,12 @@ # # make sure we know what TARGET_SPEC is # # as we may need it to find Makefile.depend* # TARGET_SPEC = ${TARGET_SPEC_VARS:@v@${$v:U}@:ts,} -# +# # The following variables can influence the initial DIRDEPS # computation with regard to the TARGET_SPECs that will be # built. # Most should also be considered by init.mk -# +# # ONLY_TARGET_SPEC_LIST # Defines a list of TARGET_SPECs for which the current # directory can be built. @@ -137,6 +130,19 @@ # A list of MACHINEs the current directory should not be # built for. # +# _build_xtra_dirs +# local.dirdeps.mk can add targets to this variable. +# They will be hooked into the build, but independent of +# any other DIRDEP. +# +# This allows for adding TESTS to the build, such that the build +# if any test fails, but without the risk of introducing +# circular dependencies. + +now_utc ?= ${%s:L:gmtime} +.if !defined(start_utc) +start_utc := ${now_utc} +.endif .if !target(bootstrap) && (make(bootstrap) || \ make(bootstrap-this) || \ @@ -157,11 +163,6 @@ _DIRDEP_USE_LEVEL?= 0 _CURDIR ?= ${.CURDIR} _OBJDIR ?= ${.OBJDIR} -now_utc = ${%s:L:gmtime} -.if !defined(start_utc) -start_utc := ${now_utc} -.endif - .if ${MAKEFILE:T} == ${.PARSEFILE} && empty(DIRDEPS) && ${.TARGETS:Uall:M*/*} != "" # This little trick let's us do # @@ -223,6 +224,7 @@ _tspec_m$i := ${TARGET_SPEC_VARS:[2..$i]:@w@[^,]+@:ts,} _tspec_a$i := ,${TARGET_SPEC_VARS:[$i..-1]:@v@$$$${DEP_$v}@:ts,} M_dep_qual_fixes += C;(\.${_tspec_m$i})$$;\1${_tspec_a$i}; .endfor +TARGET_SPEC_VARSr := ${TARGET_SPEC_VARS:[-1..1]} .else # A harmless? default. M_dep_qual_fixes = U @@ -307,6 +309,7 @@ DEP_MACHINE := ${_DEP_TARGET_SPEC} # reset each time through _build_all_dirs = +_build_xtra_dirs = # the first time we are included the _DIRDEP_USE target will not be defined # we can use this as a clue to do initialization and other one time things. @@ -337,7 +340,7 @@ BUILD_DIRDEPS ?= yes .if ${MK_DIRDEPS_CACHE} == "yes" # this is where we will cache all our work -DIRDEPS_CACHE ?= ${_OBJDIR:tA}/dirdeps.cache${.TARGETS:Nall:O:u:ts-:S,/,_,g:S,^,.,:N.} +DIRDEPS_CACHE ?= ${_OBJDIR:tA}/dirdeps.cache${_TARGETS:U${.TARGETS}:Nall:O:u:ts-:S,/,_,g:S,^,.,:N.} .endif .if ${DEBUG_DIRDEPS:@x@${DEP_RELDIR:M$x}${${DEP_RELDIR}.${DEP_MACHINE}:L:M$x}@} != "" @@ -393,6 +396,18 @@ DIRDEPS_FILTER += M${_DEP_RELDIR} DIRDEP_MAKE ?= ${.MAKE} DIRDEP_DIR ?= ${.TARGET:R} +# if you want us to report load averages during build +# DIRDEP_USE_PRELUDE += ${DIRDEP_LOADAVG_REPORT}; + +DIRDEP_LOADAVG_CMD ?= ${UPTIME:Uuptime} | sed 's,.*\(load\),\1,' +DIRDEP_LOADAVG_LAST = 0 +# yes the expression here is a bit complicated, +# the trick is to only eval ${DIRDEP_LOADAVG_LAST::=${now_utc}} +# when we want to report. +DIRDEP_LOADAVG_REPORT = \ + test -z "${"${expr ${now_utc} - ${DIRDEP_LOADAVG_INTEVAL:U60} - ${DIRDEP_LOADAVG_LAST}:L:sh:N-*}":?yes${DIRDEP_LOADAVG_LAST::=${now_utc}}:}" || \ + echo "${TRACER}`${DIRDEP_LOADAVG_CMD}`" + # we suppress SUBDIR when visiting the leaves # we assume sys.mk will set MACHINE_ARCH # you can add extras to DIRDEP_USE_ENV @@ -400,7 +415,7 @@ DIRDEP_DIR ?= ${.TARGET:R} _DIRDEP_USE: .USE .MAKE @for m in ${.MAKE.MAKEFILE_PREFERENCE}; do \ test -s ${.TARGET:R}/$$m || continue; \ - echo "${TRACER}Checking ${.TARGET:R} for ${.TARGET:E} ..."; \ + echo "${TRACER}Checking ${.TARGET:S,${SRCTOP}/,,} for ${.TARGET:E} ..."; \ ${DIRDEP_USE_PRELUDE} \ MACHINE_ARCH= NO_SUBDIR=1 ${DIRDEP_USE_ENV} \ TARGET_SPEC=${.TARGET:E} \ @@ -480,9 +495,13 @@ dirdeps-cached: ${DIRDEPS_CACHE} .MAKE dirdeps MK_DIRDEPS_CACHE=no BUILD_DIRDEPS=no # these should generally do -BUILD_DIRDEPS_MAKEFILE ?= ${MAKEFILE} +BUILD_DIRDEPS_MAKEFILE ?= BUILD_DIRDEPS_TARGETS ?= ${.TARGETS} +.if ${DIRDEPS_CACHE} != ${STATIC_DIRDEPS_CACHE:Uno} && ${DIRDEPS_CACHE:M${SRCTOP}/*} == "" +# export this for dirdeps-cache-update.mk +DYNAMIC_DIRDEPS_CACHE := ${DIRDEPS_CACHE} +.export DYNAMIC_DIRDEPS_CACHE # 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. @@ -494,26 +513,28 @@ ${DIRDEPS_CACHE}: .META .NOMETA_CMP +@MAKELEVEL=${.MAKE.LEVEL} DIRDEPS_CACHE=${DIRDEPS_CACHE} \ DIRDEPS="${DIRDEPS}" \ TARGET_SPEC=${TARGET_SPEC} \ - MAKEFLAGS= ${.MAKE} -C ${_CURDIR} -f ${BUILD_DIRDEPS_MAKEFILE} \ + MAKEFLAGS= ${DIRDEP_CACHE_MAKE:U${.MAKE}} -C ${_CURDIR} \ + ${BUILD_DIRDEPS_MAKEFILE} \ ${BUILD_DIRDEPS_TARGETS} BUILD_DIRDEPS_CACHE=yes \ .MAKE.DEPENDFILE=.none \ ${.MAKEFLAGS:tW:S,-D ,-D,g:tw:M*WITH*} \ ${.MAKEFLAGS:tW:S,-d ,-d,g:tw:M-d*} \ - 3>&1 1>&2 | sed 's,${SRCTOP},$${SRCTOP},g' >> ${.TARGET}.new && \ + 3>&1 1>&2 | sed 's,${SRCTOP},$${SRCTOP},g;s,_{,$${,g' >> ${.TARGET}.new && \ mv ${.TARGET}.new ${.TARGET} .endif +.endif .elif !target(_count_dirdeps) # we want to capture the dirdeps count in the cache .END: _count_dirdeps _count_dirdeps: .NOMETA - @{ echo; echo '.info $${.newline}$${TRACER}Makefiles read: total=${.MAKE.MAKEFILES:[#]} depend=${.MAKE.MAKEFILES:M*depend*:[#]} dirdeps=${.ALLTARGETS:M${SRCTOP}*:O:u:[#]}'; } >&3 + @{ echo; echo '.info $${.newline}$${TRACER}Makefiles read: total=${.MAKE.MAKEFILES:[#]} depend=${.MAKE.MAKEFILES:M*depend*:[#]} dirdeps=${.ALLTARGETS:M${SRCTOP}*:O:u:[#]} ${DIRDEP_INFO_XTRAS}'; } >&3 .endif .elif !make(dirdeps) && !target(_count_dirdeps) beforedirdeps: _count_dirdeps _count_dirdeps: .NOMETA - @echo "${TRACER}Makefiles read: total=${.MAKE.MAKEFILES:[#]} depend=${.MAKE.MAKEFILES:M*depend*:[#]} dirdeps=${.ALLTARGETS:M${SRCTOP}*:O:u:[#]} seconds=`expr ${now_utc} - ${start_utc}`" + @echo "${TRACER}Makefiles read: total=${.MAKE.MAKEFILES:[#]} depend=${.MAKE.MAKEFILES:M*depend*:[#]} dirdeps=${.ALLTARGETS:M${SRCTOP}*:O:u:[#]} ${DIRDEP_INFO_XTRAS} seconds=`expr ${now_utc} - ${start_utc}`" .endif .endif @@ -570,19 +591,7 @@ _build_dirs = .if ${DEP_RELDIR} == ${_DEP_RELDIR} # pickup other machines for this dir if necessary -.if ${BUILD_AT_LEVEL0:Uyes} == "no" _build_dirs += ${_machines:@m@${_CURDIR}.$m@} -.else -_build_dirs += ${_machines:N${DEP_TARGET_SPEC}:@m@${_CURDIR}.$m@} -.if ${DEP_TARGET_SPEC} == ${TARGET_SPEC} -# pickup local dependencies now -.if ${MAKE_VERSION} < 20160220 -.-include <.depend> -.else -.dinclude <.depend> -.endif -.endif -.endif .endif .if ${_debug_reldir} @@ -635,7 +644,7 @@ _build_dirs := ${_build_dirs:${M_dep_qual_fixes:ts:}:O:u} .endif # empty DIRDEPS -_build_all_dirs += ${_build_dirs} +_build_all_dirs += ${_build_dirs} ${_build_xtra_dirs} _build_all_dirs := ${_build_all_dirs:O:u} # Normally if doing make -V something, @@ -647,12 +656,7 @@ _build_all_dirs := ${_build_all_dirs:O:u} x!= echo; { echo; echo '\# ${DEP_RELDIR}.${DEP_TARGET_SPEC}'; } >&3 # guard against _new_dirdeps being too big for a single command line _new_dirdeps := ${_build_all_dirs:@x@${target($x):?:$x}@} -.if !empty(_new_dirdeps) -.export _new_dirdeps -x!= echo; { echo; echo "dirdeps: \\"; \ - for x in $$_new_dirdeps; do echo " $$x \\"; done; echo; \ - for x in $$_new_dirdeps; do echo "$$x: _DIRDEP_USE"; done; } >&3 -.endif +.export _build_xtra_dirs _new_dirdeps .if !empty(DEP_EXPORT_VARS) # Discouraged, but there are always exceptions. # Handle it here rather than explain how. @@ -676,7 +680,8 @@ DEP_EXPORT_VARS= # this builds the dependency graph .for m in ${_machines} .if ${BUILD_DIRDEPS_CACHE} == "yes" && !empty(_build_dirs) -x!= echo; { echo; echo "${_this_dir}.$m: \\"; } >&3 +x!= echo; { echo; echo 'DIRDEPS.${_this_dir}.$m = \'; } >&3 +_cache_deps = .endif # it would be nice to do :N${.TARGET} .if !empty(__qual_depdirs) @@ -685,11 +690,7 @@ x!= echo; { echo; echo "${_this_dir}.$m: \\"; } >&3 .info ${DEP_RELDIR}.$m: graph: ${_build_dirs:M*.$q} .endif .if ${BUILD_DIRDEPS_CACHE} == "yes" -_cache_deps := ${_build_dirs:M*.$q} -.if !empty(_cache_deps) -.export _cache_deps -x!= echo; for x in $$_cache_deps; do echo " $$x \\"; done >&3 -.endif +_cache_deps += ${_build_dirs:M*.$q} .else ${_this_dir}.$m: ${_build_dirs:M*.$q} .endif @@ -699,11 +700,17 @@ ${_this_dir}.$m: ${_build_dirs:M*.$q} .info ${DEP_RELDIR}.$m: graph: ${_build_dirs:M*.$m:N${_this_dir}.$m} .endif .if ${BUILD_DIRDEPS_CACHE} == "yes" -_cache_deps := ${_build_dirs:M*.$m:N${_this_dir}.$m} +.if !empty(_build_dirs) +_cache_deps += ${_build_dirs:M*.$m:N${_this_dir}.$m} .if !empty(_cache_deps) .export _cache_deps x!= echo; for x in $$_cache_deps; do echo " $$x \\"; done >&3 .endif +x!= echo; { echo; echo '${_this_dir}.$m: $${DIRDEPS.${_this_dir}.$m}'; \ + echo; echo 'dirdeps: ${_this_dir}.$m \'; \ + for x in $$_build_xtra_dirs; do echo " $$x \\"; done; \ + echo; for x in $$_new_dirdeps; do echo "$$x: _DIRDEP_USE"; done; } >&3 +.endif .else ${_this_dir}.$m: ${_build_dirs:M*.$m:N${_this_dir}.$m} .endif @@ -773,6 +780,27 @@ _DEP_RELDIR := ${RELDIR} # This is a final opportunity to add/hook global rules. .-include <local.dirdeps-build.mk> +# skip _reldir_{finish,failed} if not included from Makefile.depend* +# or not in meta mode +.if !defined(WITHOUT_META_STATS) && ${.INCLUDEDFROMFILE:U:M${.MAKE.DEPENDFILE_PREFIX}*} != "" && ${.MAKE.MODE:Mmeta} != "" + +meta_stats= meta=${empty(.MAKE.META.FILES):?0:${.MAKE.META.FILES:[#]}} \ + created=${empty(.MAKE.META.CREATED):?0:${.MAKE.META.CREATED:[#]}} + +.if !target(_reldir_finish) +.END: _reldir_finish +_reldir_finish: .NOMETA + @echo "${TRACER}Finished ${RELDIR}.${TARGET_SPEC} seconds=$$(( ${now_utc} - ${start_utc} )) ${meta_stats}" +.endif + +.if !target(_reldir_failed) +.ERROR: _reldir_failed +_reldir_failed: .NOMETA + @echo "${TRACER}Failed ${RELDIR}.${TARGET_SPEC} seconds=$$(( ${now_utc} - ${start_utc} )) ${meta_stats}" +.endif + +.endif + # pickup local dependencies .if ${MAKE_VERSION} < 20160220 .-include <.depend> diff --git a/mk/dpadd.mk b/mk/dpadd.mk index 02fa7f386921..45585ce76d9b 100644 --- a/mk/dpadd.mk +++ b/mk/dpadd.mk @@ -1,14 +1,14 @@ -# $Id: dpadd.mk,v 1.27 2019/05/17 13:58:53 sjg Exp $ +# $Id: dpadd.mk,v 1.28 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 2004, 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 +# 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 # @@ -75,7 +75,7 @@ # and -L${STAGE_OBJTOP}/usr/lib are sufficient, and we should # have no need of anything else. # - + .if !target(__${.PARSEFILE}__) __${.PARSEFILE}__: @@ -98,7 +98,7 @@ RELOBJTOP?= ${OBJTOP} RELSRCTOP?= ${SRCTOP} # we get included just about everywhere so this is handy... -# C*DEBUG_XTRA are for defining on cmd line etc +# C*DEBUG_XTRA are for defining on cmd line etc # so do not use in makefiles. .ifdef CFLAGS_DEBUG_XTRA CFLAGS_LAST += ${CFLAGS_DEBUG_XTRA} @@ -180,14 +180,14 @@ SRC_LIBS+= ${_OBJDIR}/lib${LIB}.a .endif .endif -# +# # This little bit of magic, assumes that SRC_libfoo will be # set if it cannot be correctly derrived from ${LIBFOO} # Note that SRC_libfoo and INCLUDES_libfoo should be named for the # actual library name not the variable name that might refer to it. # 99% of the time the two are the same, but the DPADD logic # only has the library name available, so stick to that. -# +# SRC_LIBS?= # magic_libs includes those we want to link with @@ -198,7 +198,7 @@ DPMAGIC_LIBS += ${__dpadd_magic_libs} \ # we skip this for staged libs .for __lib in ${DPMAGIC_LIBS:O:u:N${STAGE_OBJTOP:Unot}*/lib/*} -# +# # if SRC_libfoo is not set, then we assume that the srcdir corresponding # to where we found the library is correct. # @@ -215,8 +215,8 @@ INCLUDES_${__lib:T:R}?= -I${exists(${SRC_${__lib:T:R}}/h):?${SRC_${__lib:T:R}}/h .endfor -# even for staged libs we sometimes -# need to allow direct -I to avoid cicular dependencies +# even for staged libs we sometimes +# need to allow direct -I to avoid cicular dependencies .for __lib in ${DPMAGIC_LIBS:O:u:T:R} .if !empty(SRC_${__lib}) && empty(INCLUDES_${__lib}) # must be a staged lib @@ -267,7 +267,7 @@ __dpadd_last_incs += ${__dpadd_magic_libs:O:u:@s@${SRC_LIBS_${s:T:R}:U}@:@x@${IN __dpadd_last_incs := \ ${__dpadd_last_incs:N-I/usr/*} \ ${__dpadd_incs:M-I/usr/*} \ - ${__dpadd_last_incs:M-I/usr/*} + ${__dpadd_last_incs:M-I/usr/*} __dpadd_incs := ${__dpadd_incs:N-I/usr/*} .endif @@ -310,12 +310,12 @@ dpadd: .NOTMAIN .endif .ifdef SRC_PATHADD -# We don't want to assume that we need to .PATH every element of +# We don't want to assume that we need to .PATH every element of # SRC_LIBS, but the Makefile cannot do # .PATH: ${SRC_libfoo} # since the value of SRC_libfoo must be available at the time .PATH: -# is read - and we only just worked it out. -# Further, they can't wait until after include of {lib,prog}.mk as +# is read - and we only just worked it out. +# Further, they can't wait until after include of {lib,prog}.mk as # the .PATH is needed before then. # So we let the Makefile do # SRC_PATHADD+= ${SRC_libfoo} diff --git a/mk/files.mk b/mk/files.mk index fa16b118fb6c..513ab1fd819e 100644 --- a/mk/files.mk +++ b/mk/files.mk @@ -1,14 +1,14 @@ -# $Id: files.mk,v 1.6 2017/05/07 02:21:02 sjg Exp $ +# $Id: files.mk,v 1.7 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 2017, 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 +# 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 # diff --git a/mk/gendirdeps.mk b/mk/gendirdeps.mk index 82618f2225a3..b977f3c48d99 100644 --- a/mk/gendirdeps.mk +++ b/mk/gendirdeps.mk @@ -1,18 +1,18 @@ -# $Id: gendirdeps.mk,v 1.44 2020/06/23 04:21:51 sjg Exp $ +# $Id: gendirdeps.mk,v 1.46 2020/08/19 17:51:53 sjg Exp $ # Copyright (c) 2011-2020, Simon J. Gerraty # Copyright (c) 2010-2018, 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. # # This makefile [re]generates ${.MAKE.DEPENDFILE} @@ -104,7 +104,7 @@ GENDIRDEPS_FILTER += ${GENDIRDEPS_FILTER_DIR_VARS:@v@S,${$v},_{${v}},@} GENDIRDEPS_FILTER += ${GENDIRDEPS_FILTER_VARS:@v@S,/${$v}/,/_{${v}}/,@:NS,//,*:u} .endif -# this (*should* be set in meta.sys.mk) +# this (*should* be set in meta.sys.mk) # is the script that extracts what we want. META2DEPS ?= ${.PARSEDIR}/meta2deps.sh META2DEPS := ${META2DEPS} @@ -122,7 +122,7 @@ _py_d = .if ${META2DEPS:E} == "py" # we can afford to do this all the time. DPDEPS ?= no -META2DEPS_CMD = ${_time} ${PYTHON} ${META2DEPS} ${_py_d} +META2DEPS_CMD = ${_time} ${PYTHON} ${META2DEPS} ${_py_d} .if ${DPDEPS:tl} != "no" META2DEPS_CMD += -D ${DPDEPS} .endif @@ -155,8 +155,8 @@ M2D_OBJROOTS += ${STAGE_ROOT} # and tell it not to add machine qualifiers META2DEPS_ARGS += MACHINE=none .endif -.if defined(SB_BACKING_SB) -META2DEPS_CMD += -S ${SB_BACKING_SB}/src +.if defined(SB_BACKING_SB) +META2DEPS_CMD += -S ${SB_BACKING_SB}/src M2D_OBJROOTS += ${SB_BACKING_SB}/${SB_OBJPREFIX} .endif @@ -177,7 +177,7 @@ _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, +# 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 @@ -234,10 +234,10 @@ dir_list += ${ddeps} # DIRDEPS represent things that had to have been built first # so they should all be undir OBJTOP. -# Note that ${_OBJTOP}/bsd/include/machine will get reported +# Note that ${_OBJTOP}/bsd/include/machine will get reported # to us as $SRCTOP/bsd/sys/$MACHINE_ARCH/include meaning we # will want to visit bsd/include -# so we add +# so we add # ${"${dir_list:M*bsd/sys/${MACHINE_ARCH}/include}":?bsd/include:} # to GENDIRDEPS_DIR_LIST_XTRAS _objtops = ${OBJTOP} ${_OBJTOP} ${_objtop} @@ -272,11 +272,11 @@ DIRDEPS = \ # We only consider things below $RELDIR/ if they have a makefile. # This is the same test that _DIRDEP_USE applies. -# We have do a double test with dirdep_list as it _may_ contain +# We have do a double test with dirdep_list as it _may_ contain # qualified dirs - if we got anything from a stage dir. # qualdir_list we know are all qualified. # It would be nice do peform this check for all of DIRDEPS, -# but we cannot assume that all of the tree is present, +# but we cannot assume that all of the tree is present, # in fact we can only assume that RELDIR is. DIRDEPS += \ ${dirdep_list:M${RELDIR}/*:@d@${.MAKE.MAKEFILE_PREFERENCE:@m@${exists(${SRCTOP}/$d/$m):?$d:${exists(${SRCTOP}/${d:R}/$m):?$d:}}@}@} \ @@ -309,7 +309,7 @@ SRC_DIRDEPS = \ SRC_DIRDEPS := ${SRC_DIRDEPS:${GENDIRDEPS_SRC_FILTER:UN/*:ts:}:C,//+,/,g:O:u} # if you want to capture SRC_DIRDEPS in .MAKE.DEPENDFILE put -# SRC_DIRDEPS_FILE = ${_DEPENDFILE} +# SRC_DIRDEPS_FILE = ${_DEPENDFILE} # in local.gendirdeps.mk .if ${SRC_DIRDEPS_FILE:Uno:tl} != "no" ECHO_SRC_DIRDEPS = echo 'SRC_DIRDEPS = \'; echo '${SRC_DIRDEPS:@d@ $d \\${.newline}@}'; echo; @@ -324,7 +324,7 @@ ${SRC_DIRDEPS_FILE}: ${META_FILES} ${_this} ${META2DEPS} .endif .endif .endif -_include_src_dirdeps ?= +_include_src_dirdeps ?= all: ${_DEPENDFILE} @@ -339,11 +339,7 @@ CAT_DEPEND ?= .depend .PHONY: ${_DEPENDFILE} .endif -.if ${BUILD_AT_LEVEL0:Uno:tl} == "no" LOCAL_DEPENDS_GUARD ?= _{.MAKE.LEVEL} > 0 -.else -LOCAL_DEPENDS_GUARD ?= _{DEP_RELDIR} == _{_DEP_RELDIR} -.endif # 'cat .depend' should suffice, but if we are mixing build modes # .depend may contain things we don't want. diff --git a/mk/host-target.mk b/mk/host-target.mk index a83642c9698c..3e6094f16730 100644 --- a/mk/host-target.mk +++ b/mk/host-target.mk @@ -1,5 +1,5 @@ # RCSid: -# $Id: host-target.mk,v 1.12 2020/07/08 23:35:29 sjg Exp $ +# $Id: host-target.mk,v 1.13 2020/08/05 23:32:08 sjg Exp $ # Host platform information; may be overridden .if !defined(_HOST_OSNAME) @@ -16,7 +16,7 @@ _HOST_MACHINE != uname -m .endif .if !defined(_HOST_ARCH) # for NetBSD prefer $MACHINE (amd64 rather than x86_64) -.if ${_HOST_OSNAME:NNetBSD} == "" +.if ${_HOST_OSNAME:NDarwin:NNetBSD} == "" _HOST_ARCH := ${_HOST_MACHINE} .else _HOST_ARCH != uname -p 2> /dev/null || uname -m diff --git a/mk/host.libnames.mk b/mk/host.libnames.mk index c0a13d756d16..3afa73f9d2a3 100644 --- a/mk/host.libnames.mk +++ b/mk/host.libnames.mk @@ -1,14 +1,14 @@ -# $Id: host.libnames.mk,v 1.4 2010/01/11 23:01:31 sjg Exp $ +# $Id: host.libnames.mk,v 1.5 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 2007-2009, 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 +# 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 # diff --git a/mk/inc.mk b/mk/inc.mk index 74626d34646f..5fc14b32d88d 100644 --- a/mk/inc.mk +++ b/mk/inc.mk @@ -1,14 +1,14 @@ -# $Id: inc.mk,v 1.7 2017/05/06 17:29:45 sjg Exp $ +# $Id: inc.mk,v 1.8 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 2008, 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 +# 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 # diff --git a/mk/init.mk b/mk/init.mk index d4ae45372d9c..0dae997beb54 100644 --- a/mk/init.mk +++ b/mk/init.mk @@ -1,14 +1,14 @@ -# $Id: init.mk,v 1.17 2020/05/25 20:15:07 sjg Exp $ +# $Id: init.mk,v 1.21 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 2002, 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 +# 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 # @@ -65,7 +65,11 @@ CC_PIC?= -DPIC CXX_PIC?= ${CC_PIC} PROFFLAGS?= -DGPROF -DPROF -.if ${.MAKE.LEVEL:U1} == 0 && ${BUILD_AT_LEVEL0:Uyes:tl} == "no" +# targets that are ok at level 0 +LEVEL0_TARGETS += clean* destory* +M_ListToSkip= O:u:S,^,N,:ts: + +.if ${.MAKE.LEVEL:U1} == 0 && ${MK_DIRDEPS_BUILD:Uno} == "yes" && ${.TARGETS:Uall:${LEVEL0_TARGETS:${M_ListToSkip}}} != "" # this tells lib.mk and prog.mk to not actually build anything _SKIP_BUILD = not building at level 0 .endif diff --git a/mk/install-mk b/mk/install-mk index 486bcd25d05f..66185e42cc6e 100644 --- a/mk/install-mk +++ b/mk/install-mk @@ -33,7 +33,7 @@ # # All our *.mk files are copied to "dest" with appropriate # ownership and permissions. -# +# # By default if a sys.mk can be found in a standard location # (that bmake will find) then no sys.mk will be put in "dest". # @@ -55,22 +55,22 @@ # Simon J. Gerraty <sjg@crufty.net> # RCSid: -# $Id: install-mk,v 1.174 2020/07/10 21:50:14 sjg Exp $ +# $Id: install-mk,v 1.179 2020/08/26 21:49:45 sjg Exp $ # # @(#) Copyright (c) 1994 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 +# 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 # -MK_VERSION=20200710 +MK_VERSION=20200826 OWNER= GROUP= MODE=444 @@ -137,7 +137,7 @@ if [ -s $SYS_MK -a -d $dest ]; then sys_mk_dir=`realpath $SYS_MK_DIR` if [ $dest = $sys_mk_dir ]; then case "$os" in - *BSD*) SKIP_SYS_MK=: + *BSD*) SKIP_SYS_MK=: SKIP_BSD_MK=: ;; *) # could be fake? diff --git a/mk/install-new.mk b/mk/install-new.mk index ddfff20e3b85..d312bdc26d46 100644 --- a/mk/install-new.mk +++ b/mk/install-new.mk @@ -1,14 +1,14 @@ -# $Id: install-new.mk,v 1.3 2012/03/24 18:25:49 sjg Exp $ +# $Id: install-new.mk,v 1.4 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 2009, 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 +# 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 # diff --git a/mk/java.mk b/mk/java.mk index ef4a5ea0ba10..e2149e7089a7 100644 --- a/mk/java.mk +++ b/mk/java.mk @@ -1,16 +1,16 @@ # # RCSid: -# $Id: java.mk,v 1.14 2007/11/22 08:16:25 sjg Exp $ +# $Id: java.mk,v 1.15 2020/08/19 17:51:53 sjg Exp $ # @(#) Copyright (c) 1998-2001, 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 +# 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 # @@ -53,7 +53,7 @@ JAVAC_FLAGS+= ${JAVAC_DBG} .if defined(MAKE_VERSION) && !defined(NO_CLASSES_COOKIE) # java works best by compiling a bunch of classes at once. -# this lot does that but needs a recent netbsd make or +# this lot does that but needs a recent netbsd make or # or its portable cousin bmake. .for __s in ${SRCS} __c:= ${__classdest}${__s:.java=.class} diff --git a/mk/lib.mk b/mk/lib.mk index 03d24e27cbe6..c3979414ec49 100644 --- a/mk/lib.mk +++ b/mk/lib.mk @@ -1,4 +1,4 @@ -# $Id: lib.mk,v 1.70 2020/05/02 02:10:20 sjg Exp $ +# $Id: lib.mk,v 1.71 2020/08/19 17:51:53 sjg Exp $ .if !target(__${.PARSEFILE}__) __${.PARSEFILE}__: @@ -67,7 +67,7 @@ META_NOECHO?= echo # Alpha-specific shared library flags FPICFLAGS ?= -fPIC CPICFLAGS ?= -fPIC -DPIC -CPPPICFLAGS?= -DPIC +CPPPICFLAGS?= -DPIC CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS} APICFLAGS ?= .elif ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" @@ -87,7 +87,7 @@ MKPICLIB= no .elif (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64") && \ ${OBJECT_FMT} == "ELF" -# If you use -fPIC you need to define BIGPIC to turn on 32-bit +# If you use -fPIC you need to define BIGPIC to turn on 32-bit # relocations in asm code FPICFLAGS ?= -fPIC CPICFLAGS ?= -fPIC -DPIC @@ -102,7 +102,7 @@ SHLIB_SOVERSION=${SHLIB_FULLVERSION} SHLIB_SHFLAGS= FPICFLAGS ?= -fPIC CPICFLAGS?= -fPIC -DPIC -CPPPICFLAGS?= -DPIC +CPPPICFLAGS?= -DPIC CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS} APICFLAGS?= -k @@ -246,7 +246,7 @@ DLLIB ?= -ldl .endif # some libs have lots of objects, and scanning all .o, .po and ${PICO} meta files -# is a waste of time, this tells meta.autodep.mk to just pick one +# is a waste of time, this tells meta.autodep.mk to just pick one # (typically ${PICO}) # yes, 42 is a random number. .if ${MK_DIRDEPS_BUILD} == "yes" && ${SRCS:Uno:[\#]} > 42 @@ -272,7 +272,7 @@ ${CXX_SUFFIXES:%=%.o}: ${COMPILE.cc} ${.IMPSRC} .S.o .s.o: - ${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} + ${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} .if (${LD_X} == "") .c.po: @@ -382,7 +382,7 @@ _LIBS+= ${libLDORDER_INC} .endif .if !defined(_SKIP_BUILD) -realbuild: ${_LIBS} +realbuild: ${_LIBS} .endif all: _SUBDIRUSE diff --git a/mk/libnames.mk b/mk/libnames.mk index b0eabed5ea53..8140360714df 100644 --- a/mk/libnames.mk +++ b/mk/libnames.mk @@ -1,14 +1,14 @@ -# $Id: libnames.mk,v 1.8 2016/04/05 15:58:37 sjg Exp $ +# $Id: libnames.mk,v 1.9 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 2007-2009, 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 +# 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 # diff --git a/mk/libs.mk b/mk/libs.mk index 7f974bfa86b9..9f0079d6e511 100644 --- a/mk/libs.mk +++ b/mk/libs.mk @@ -1,14 +1,14 @@ -# $Id: libs.mk,v 1.3 2013/08/02 18:28:48 sjg Exp $ +# $Id: libs.mk,v 1.6 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 2006, 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 +# 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 # @@ -82,12 +82,18 @@ UPDATE_DEPENDFILE = NO LIBS_TARGETS+= cleandepend cleandir cleanobj depend install .for b in ${LIBS:R:T:S,^lib,,} -lib$b.a: ${SRCS} ${DPADD} ${SRCS_lib$b} ${DPADD_lib$b} - (cd ${.CURDIR} && ${.MAKE} -f ${MAKEFILE} LIB=$b) +lib$b.a: ${SRCS} ${DPADD} ${SRCS_lib$b} ${DPADD_lib$b} + (cd ${.CURDIR} && ${.MAKE} -f ${MAKEFILE} LIB=$b -DWITHOUT_META_STATS) .for t in ${LIBS_TARGETS:O:u} $b.$t: .PHONY .MAKE - (cd ${.CURDIR} && ${.MAKE} -f ${MAKEFILE} LIB=$b ${@:E}) + (cd ${.CURDIR} && ${.MAKE} -f ${MAKEFILE} LIB=$b ${@:E} -DWITHOUT_META_STATS) .endfor .endfor + +.if !defined(WITHOUT_META_STATS) && ${.MAKE.LEVEL} > 0 +.END: _reldir_finish +.ERROR: _reldir_failed +.endif + .endif diff --git a/mk/links.mk b/mk/links.mk index aac3914fdd00..6bf0db080c23 100644 --- a/mk/links.mk +++ b/mk/links.mk @@ -1,14 +1,14 @@ -# $Id: links.mk,v 1.6 2014/09/29 17:14:40 sjg Exp $ +# $Id: links.mk,v 1.7 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 2005, 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 +# 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 # diff --git a/mk/manifest.mk b/mk/manifest.mk index 797038d19391..1e2f728f094e 100644 --- a/mk/manifest.mk +++ b/mk/manifest.mk @@ -1,14 +1,14 @@ -# $Id: manifest.mk,v 1.2 2014/10/31 18:06:17 sjg Exp $ +# $Id: manifest.mk,v 1.3 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 2014, 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 +# 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,12 +21,12 @@ # ${MANIFEST}.DIRS += bin sbin usr/bin ... # for each dir we have a ${MANIFEST}.SRCS.$dir # that provides the absolute path to the contents -# ${MANIFEST}.SRCS.bin += ${OBJTOP}/bin/sh/sh +# ${MANIFEST}.SRCS.bin += ${OBJTOP}/bin/sh/sh # ${MANIFEST}.SYMLINKS is a list of src target pairs # for each file/dir there are a number of attributes # UID GID MODE FLAGS # which can be set per dir, per file or we use defaults -# eg. +# eg. # MODE.sbin = 550 # MODE.usr/sbin = 550 # MODE.dirs = 555 @@ -37,7 +37,7 @@ # means passwd gets 4555 other files in usr/bin get 555 and # files in usr/sbin get 500 # STORE defaults to basename of src and target directory -# but we can use +# but we can use # ${MANIFEST}.SRCS.sbin += ${OBJTOP}/bin/sh-static/sh-static # STORE.sbin/sh-static = sbin/sh # @@ -47,7 +47,7 @@ UID.dirs ?= 0 GID.dirs ?= 0 MODE.dirs ?= 775 -FLAGS.dirs ?= +FLAGS.dirs ?= UID.files ?= 0 GID.files ?= 0 diff --git a/mk/meta.autodep.mk b/mk/meta.autodep.mk index 9cb3f14ea0c6..5e18c35fa560 100644 --- a/mk/meta.autodep.mk +++ b/mk/meta.autodep.mk @@ -1,4 +1,4 @@ -# $Id: meta.autodep.mk,v 1.50 2018/06/08 01:25:31 sjg Exp $ +# $Id: meta.autodep.mk,v 1.52 2020/07/18 05:57:57 sjg Exp $ # # @(#) Copyright (c) 2010, Simon J. Gerraty @@ -57,7 +57,7 @@ _OBJTOP ?= ${OBJTOP} _OBJROOT ?= ${OBJROOT:U${_OBJTOP}} _DEPENDFILE := ${_CURDIR}/${.MAKE.DEPENDFILE:T} -.if ${.MAKE.LEVEL} > 0 || ${BUILD_AT_LEVEL0:Uyes:tl} == "yes" +.if ${.MAKE.LEVEL} > 0 # do not allow auto update if we ever built this dir without filemon NO_FILEMON_COOKIE = .nofilemon CLEANFILES += ${NO_FILEMON_COOKIE} @@ -73,10 +73,8 @@ UPDATE_DEPENDFILE = NO .endif .if ${.MAKE.LEVEL} == 0 -.if ${BUILD_AT_LEVEL0:Uyes:tl} == "no" UPDATE_DEPENDFILE = NO .endif -.endif .if !exists(${_DEPENDFILE}) _bootstrap_dirdeps = yes .endif @@ -283,9 +281,7 @@ ${_DEPENDFILE}: ${_depend} ${.PARSEDIR}/gendirdeps.mk ${META2DEPS} $${.MAKE.MET .endif .if ${_bootstrap_dirdeps} == "yes" -.if ${BUILD_AT_LEVEL0:Uno} == "no" DIRDEPS+= ${RELDIR}.${TARGET_SPEC:U${MACHINE}} -.endif # make sure this is included at least once .include <dirdeps.mk> .else @@ -312,7 +308,7 @@ _reldir_finish: .NOMETA _reldir_failed: .NOMETA @echo "${TIME_STAMP} Failed ${RELDIR}.${TARGET_SPEC} seconds=$$(( ${now_utc} - ${start_utc} )) ${meta_stats}" -.if defined(WITH_META_STATS) && ${.MAKE.LEVEL} > 0 +.if !defined(WITHOUT_META_STATS) && ${.MAKE.LEVEL} > 0 .END: _reldir_finish .ERROR: _reldir_failed .endif diff --git a/mk/meta.stage.mk b/mk/meta.stage.mk index 3b4624fc4599..c78685760c11 100644 --- a/mk/meta.stage.mk +++ b/mk/meta.stage.mk @@ -1,14 +1,14 @@ -# $Id: meta.stage.mk,v 1.59 2020/04/25 18:18:27 sjg Exp $ +# $Id: meta.stage.mk,v 1.60 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 2011-2017, 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 +# 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 # diff --git a/mk/meta.subdir.mk b/mk/meta.subdir.mk index d27de1079f87..39cf875d6b77 100644 --- a/mk/meta.subdir.mk +++ b/mk/meta.subdir.mk @@ -1,4 +1,4 @@ -# $Id: meta.subdir.mk,v 1.11 2015/11/24 22:26:51 sjg Exp $ +# $Id: meta.subdir.mk,v 1.12 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 2010, Simon J. Gerraty @@ -6,10 +6,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 # @@ -32,7 +32,7 @@ DIRDEPS = ${SUBDIR:N.WAIT:O:u:@d@${RELDIR}/$d@} .include <meta.autodep.mk> .else # this is the cunning bit -# actually it is probably a bit risky +# actually it is probably a bit risky # since we may pickup subdirs which are not relevant # the alternative is a walk through the tree though # which is difficult without a sub-make. diff --git a/mk/meta.sys.mk b/mk/meta.sys.mk index a561e04534f8..77b4893a8785 100644 --- a/mk/meta.sys.mk +++ b/mk/meta.sys.mk @@ -1,4 +1,4 @@ -# $Id: meta.sys.mk,v 1.36 2020/05/16 23:21:48 sjg Exp $ +# $Id: meta.sys.mk,v 1.38 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 2010-2020, Simon J. Gerraty @@ -6,10 +6,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 # @@ -155,12 +155,6 @@ dirdeps: # the first .MAIN: is what counts # by default dirdeps is all we want at level0 .MAIN: dirdeps -# tell dirdeps.mk what we want -BUILD_AT_LEVEL0 = no -.endif -.if ${.TARGETS:Nall} == "" -# it works best if we do everything via sub-makes -BUILD_AT_LEVEL0 ?= no .endif .endif diff --git a/mk/meta2deps.py b/mk/meta2deps.py index 253287a87d1b..9231003b70df 100755 --- a/mk/meta2deps.py +++ b/mk/meta2deps.py @@ -25,7 +25,7 @@ We only pay attention to a subset of the information in the 'W' files opened for write or read-write, for filemon V3 and earlier. - + 'E' files executed. 'L' files linked @@ -37,20 +37,20 @@ We only pay attention to a subset of the information in the """ RCSid: - $Id: meta2deps.py,v 1.30 2020/06/08 23:05:00 sjg Exp $ + $Id: meta2deps.py,v 1.33 2020/08/19 17:51:53 sjg Exp $ - Copyright (c) 2011-2019, Simon J. Gerraty + Copyright (c) 2011-2020, Simon J. Gerraty Copyright (c) 2011-2017, 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 @@ -62,8 +62,8 @@ RCSid: 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. + """ import os, re, sys @@ -164,7 +164,7 @@ def sort_unique(list, cmp=None, key=None, reverse=False): def add_trims(x): return ['/' + x + '/', - '/' + x, + '/' + x, x + '/', x] @@ -181,7 +181,7 @@ class MetaFile: obj_deps = [] src_deps = [] file_deps = [] - + def __init__(self, name, conf={}): """if name is set we will parse it now. conf can have the follwing keys: @@ -198,7 +198,7 @@ class MetaFile: TARGET_SPEC Sometimes MACHINE isn't enough. - + HOST_TARGET when we build for the pseudo machine 'host' the object tree uses HOST_TARGET rather than MACHINE. @@ -222,7 +222,7 @@ class MetaFile: debug_out open file to send debug output to (sys.stderr) """ - + self.name = name self.debug = getv(conf, 'debug', 0) self.debug_out = getv(conf, 'debug_out', sys.stderr) @@ -310,11 +310,11 @@ class MetaFile: self.obj_deps = [] self.src_deps = [] self.file_deps = [] - + def dirdeps(self, sep='\n'): """return DIRDEPS""" return sep.strip() + sep.join(self.obj_deps) - + def src_dirdeps(self, sep='\n'): """return SRC_DIRDEPS""" return sep.strip() + sep.join(self.src_deps) @@ -333,7 +333,7 @@ class MetaFile: def seenit(self, dir): """rememer that we have seen dir.""" self.seen[dir] = 1 - + def add(self, list, data, clue=''): """add data to list if it isn't already there.""" if data not in list: @@ -392,10 +392,10 @@ class MetaFile: # give a useful clue print('{}:{}: '.format(self.name, self.line), end=' ', file=sys.stderr) raise - + def parse(self, name=None, file=None): """A meta file looks like: - + # Meta data file "path" CMD "command-line" CWD "cwd" @@ -506,6 +506,8 @@ class MetaFile: continue elif w[0] in 'ERWS': path = w[2] + if path == '.': + continue self.parse_path(path, cwd, w[0], w) if not file: @@ -601,13 +603,13 @@ class MetaFile: self.seenit(w[2]) self.seenit(dir) - + def main(argv, klass=MetaFile, xopts='', xoptf=None): """Simple driver for class MetaFile. Usage: script [options] [key=value ...] "meta" ... - + Options and key=value pairs contribute to the dictionary passed to MetaFile. @@ -615,7 +617,7 @@ def main(argv, klass=MetaFile, xopts='', xoptf=None): add "SRCTOP" to the "SRCTOPS" list. -C "CURDIR" - + -O "OBJROOT" add "OBJROOT" to the "OBJROOTS" list. @@ -626,7 +628,7 @@ def main(argv, klass=MetaFile, xopts='', xoptf=None): -H "HOST_TARGET" -D "DPDEPS" - + -d bumps debug level """ @@ -666,7 +668,7 @@ def main(argv, klass=MetaFile, xopts='', xoptf=None): debug = 0 output = True - + opts, args = getopt.getopt(argv[1:], 'a:dS:C:O:R:m:D:H:qT:X:' + xopts) for o, a in opts: if o == '-a': diff --git a/mk/meta2deps.sh b/mk/meta2deps.sh index 59ccf7bd6216..e56e52a89675 100755 --- a/mk/meta2deps.sh +++ b/mk/meta2deps.sh @@ -5,11 +5,11 @@ # # SYNOPSIS: # meta2deps.sh SB="SB" "meta" ... -# +# # DESCRIPTION: # This script looks each "meta" file and extracts the # information needed to deduce build and src dependencies. -# +# # To do this, we extract the 'CWD' record as well as all the # syscall traces which describe 'R'ead, 'C'hdir and 'E'xec # syscalls. @@ -77,20 +77,20 @@ # RCSid: -# $Id: meta2deps.sh,v 1.12 2016/12/13 20:44:16 sjg Exp $ +# $Id: meta2deps.sh,v 1.13 2020/08/19 17:51:53 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 @@ -101,14 +101,14 @@ # 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. meta2src() { cat /dev/null "$@" | sed -n '/^R .*\.[chyl]$/s,^..[0-9]* ,,p' | sort -u } - + meta2dirs() { cat /dev/null "$@" | sed -n '/^R .*\/.*\.[a-z0-9][^\/]*$/s,^..[0-9]* \(.*\)/[^/]*$,\1,p' | @@ -169,7 +169,7 @@ meta2deps() { case "$MACHINE" in host) _ht=$HOST_TARGET;; esac - + for o in $OBJROOTS do case "$MACHINE,/$o/" in @@ -203,7 +203,7 @@ meta2deps() { obj_re= add_list '|' -s '/*' src_re $SRCTOPS add_list '|' -s '*' obj_re $OBJROOTS - + [ -z "$RELDIR" ] && unset DPDEPS tf=/tmp/m2d$$-$USER rm -f $tf.* @@ -274,10 +274,10 @@ meta2deps() { eval cwd_$pid=$cwd continue ;; - F,*) # $path is new pid + F,*) # $path is new pid eval cwd_$path=$cwd ldir_$path=$ldir continue - ;; + ;; *) dir=${path%/*} case "$path" in $src_re|$obj_re) ;; diff --git a/mk/mk-files.txt b/mk/mk-files.txt index 4e69dfec0808..282f9b87a63c 100644 --- a/mk/mk-files.txt +++ b/mk/mk-files.txt @@ -14,17 +14,17 @@ Many years ago, when building large software projects, I used GNU make to simplify developing complex build trees. Since the early 90's my main development machines, run BSD -(NetBSD_ to be precise), and the BSD source tree is good example of a -large software project. It quickly became clear that -``/usr/share/mk/*.mk`` were a great model, but were quite tightly -linked to building the BSD tree. +(NetBSD_ to be precise, and more recently FreeBSD), and the BSD source +tree is good example of a large software project. +It quickly became clear that ``/usr/share/mk/*.mk`` were a great +model, but at the time were quite tightly linked to building the BSD tree. Much as I liked using NetBSD, my customers were more likely to be using SunOS, HP-UX etc, so I started on bmake_ and a portable collection of mk-files (mk.tar.gz_). NetBSD provided much of the original structure. Since then I've added a lot of features to NetBSD's make and hence to -bmake which is kept closely in sync. The mk-files however have +bmake which is kept closely in sync. The mk-files however have diverged quite a bit, though ideas are still picked up from NetBSD and FreeBSD. @@ -59,7 +59,7 @@ in such cases even the ``SRCS`` line is unnecessary as ``prog.mk`` will default it to ``${PROG}.c``. It is the sensible use of defaults and the plethora of macro modifiers -provided by bmake_ that allow simple makefiles such as the above +provided by bmake_ that allow simple makefiles such as the above to *just work* on many different systems. @@ -67,7 +67,7 @@ mk-files ======== This section provides a brief description of some of the ``*.mk`` -files. +files. sys.mk ------ @@ -76,7 +76,7 @@ When bmake starts, it looks for ``sys.mk`` and reads it before doing anything else. Thus, this is the place to setup the environment for everyone else. -In this distribution, sys.mk avoids doing anything platform dependent. +In this distribution, ``sys.mk`` avoids doing anything platform dependent. It is quite short, and includes a number of other files (which may or may not exists) @@ -97,7 +97,7 @@ examples/sys.clean-env.mk PATH HOME USER LOGNAME \ SRCTOP OBJTOP OBJROOT \ ${_env_vars} - + _env_vars != env | egrep '^(${MAKE_SAVE_ENV_PREFIX:ts|})' | sed 's,=.*,,'; echo _export_list = .for v in ${MAKE_SAVE_ENV_VARS:O:u} @@ -169,7 +169,7 @@ lib${LIB}.a An archive lib of ``.o`` files, this is the default lib${LIB}_p.a - A profiled lib of ``.po`` files. + A profiled lib of ``.po`` files. Still an archive lib, but all the objects are built with profiling in mind - hence the different extension. It is skipped if ``MKPROFILE`` is "no". @@ -194,7 +194,7 @@ lib${LIB}.${LD_so} There is a lot of platform specific tweaking in ``lib.mk``, largely the result of the original distributions trying to avoid interfering with -the system's ``sys.mk``. +the system's ``sys.mk``. libnames.mk ----------- @@ -204,22 +204,19 @@ include ``*.libnames.mk`` of which: local.libnames.mk does not exist unless you create it. It is a handy way for you - to customize without touching the distributed files. + to customize without touching the distributed files. For example, on a test machine I needed to build openssl but - not install it, so put the following in ``local.libnames.mk``:: + not install it, so put the following in ``local.libnames.mk``:: .if ${host_os} == "sunos" LIBCRYPTO = ${OBJTOP}/openssl/lib/crypto/libcrypto${DLIBEXT} LIBSSL = ${OBJTOP}/openssl/lib/ssl/libssl${DLIBEXT} INCLUDES_libcrypto = -I${OBJ_libcrypto} .endif - + The makefile created an openssl dir in ``${OBJ_libcrypto}`` to gather all the headers. dpadd.mk_ did the rest. -sjg.libnames.mk - not part of the mk-files distribution. - host.libnames.mk contains logic to find any libs named in ``HOST_LIBS`` in ``HOST_LIBDIRS``. @@ -248,7 +245,7 @@ else in various ways:: # it also has the same effect as SRC_LIBS DPADD += ${LIBSSLFD} - # indicate that not only must libsslfd be built, + # indicate that not only must libsslfd be built, # but that we need to link with it. # this is almost exactly equivalent to # DPADD += ${LIBSSLFD} @@ -324,7 +321,7 @@ If ``SUBDIR_MUST_EXIST`` is set, missing directories cause an error, otherwise a warning is issued. If you don't even want the warning, set ``MISSING_DIR=continue``. -Traditionally, ``subdir.mk`` prints clue as it visits each subdir:: +Traditionally, ``subdir.mk`` prints clues as it visits each subdir:: ===> ssl ===> ssl/lib @@ -342,7 +339,7 @@ links.mk Provides rules for processing lists of ``LINKS`` and ``SYMLINKS``. Each is expected to be a list of ``link`` and ``target`` pairs -(``link`` -> ``target``). +(``link`` -> ``target``). The logic is generally in a ``_*_SCRIPT`` which is referenced in a ``_*_USE`` (``.USE``) target. @@ -353,7 +350,7 @@ For example:: SYMLINKS += ${.CURDIR}/${MACHINE_ARCH}/include machine header_links: _BUILD_SYMLINKS_USE - + md.o: header_links would create a symlink called ``machine`` in ``${.OBJDIR}`` pointing to @@ -394,10 +391,10 @@ post process the ``.d`` files into ``.depend``. auto.dep.mk ----------- -A much simpler implementation than autodep.mk_ it uses +A much simpler implementation than autodep.mk_ it uses ``-MF ${.TARGET:T}.d`` -to avoid possible conflicts during parallel builds. -This precludes the use of suffix rules to drive ``make depend``, so +to avoid possible conflicts during parallel builds. +This precludes the use of suffix rules to drive ``make depend``, so dep.mk_ handles that if specifically requested. options.mk @@ -452,7 +449,7 @@ on sparc, ``-Wno-unused`` would replace ``-Wunused``. You should never need to edit ``warnings.mk``, it will include ``warnings-sets.mk`` if it exists and you use that to make any local -customizations. +customizations. rst2htm.mk ---------- @@ -470,7 +467,7 @@ Meta mode ========= The 20110505 and later versions of ``mk-files`` include a number of -makefiles contributed by Juniper Networks, Inc. +makefiles contributed by Juniper Networks, Inc. These allow the latest version of bmake_ to run in `meta mode`_ see `dirdeps.mk`_ @@ -499,5 +496,5 @@ where you unpacked the tar file, you can:: .. _mk.tar.gz: http://www.crufty.net/ftp/pub/sjg/mk.tar.gz :Author: sjg@crufty.net -:Revision: $Id: mk-files.txt,v 1.18 2018/12/08 07:27:15 sjg Exp $ +:Revision: $Id: mk-files.txt,v 1.20 2020/08/19 17:51:53 sjg Exp $ :Copyright: Crufty.NET diff --git a/mk/mkopt.sh b/mk/mkopt.sh index 929a5aa83a66..4a42c0ddf122 100755 --- a/mk/mkopt.sh +++ b/mk/mkopt.sh @@ -1,16 +1,16 @@ #!/bin/sh -# $Id: mkopt.sh,v 1.12 2020/06/23 04:16:35 sjg Exp $ +# $Id: mkopt.sh,v 1.13 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 2014, 2020, 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 +# 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 # diff --git a/mk/obj.mk b/mk/obj.mk index b936379d4f6b..487e25a55b6c 100644 --- a/mk/obj.mk +++ b/mk/obj.mk @@ -1,14 +1,14 @@ -# $Id: obj.mk,v 1.15 2012/11/11 22:37:02 sjg Exp $ +# $Id: obj.mk,v 1.16 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 1999-2010, 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 +# 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 # diff --git a/mk/options.mk b/mk/options.mk index a03c6cde34dc..eb5253a6b7e8 100644 --- a/mk/options.mk +++ b/mk/options.mk @@ -1,14 +1,14 @@ -# $Id: options.mk,v 1.11 2020/05/02 21:23:52 sjg Exp $ +# $Id: options.mk,v 1.13 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 2012, 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 +# 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 # @@ -77,4 +77,6 @@ ${OPTION_PREFIX}${o:H} ?= no ${OPTION_PREFIX}${o:H} ?= ${${OPTION_PREFIX}${o:T}} .endif .endfor -.undef OPTIONS_DEFAULT_VALUES OPTIONS_DEFAULT_NO OPTIONS_DEFAULT_YES +.undef OPTIONS_DEFAULT_VALUES +.undef OPTIONS_DEFAULT_NO +.undef OPTIONS_DEFAULT_YES diff --git a/mk/own.mk b/mk/own.mk index 4c8425b0ee7c..b20b9e5e2c35 100644 --- a/mk/own.mk +++ b/mk/own.mk @@ -1,4 +1,4 @@ -# $Id: own.mk,v 1.40 2018/04/23 04:53:57 sjg Exp $ +# $Id: own.mk,v 1.41 2020/08/19 17:51:53 sjg Exp $ .if !target(__${.PARSEFILE}__) __${.PARSEFILE}__: @@ -61,7 +61,7 @@ YACC.y?= ${YACC} ${YFLAGS} # for suffix rules IMPFLAGS?= ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -.for s in .c .cc +.for s in .c .cc COMPILE.$s += ${IMPFLAGS} LINK.$s += ${IMPFLAGS} .endfor @@ -211,8 +211,8 @@ CFLAGS+= ${CPPFLAGS} # allow for per target flags # apply the :T:R first, so the more specific :T can override if needed -CPPFLAGS += ${CPPFLAGS_${.TARGET:T:R}} ${CPPFLAGS_${.TARGET:T}} -CFLAGS += ${CFLAGS_${.TARGET:T:R}} ${CFLAGS_${.TARGET:T}} +CPPFLAGS += ${CPPFLAGS_${.TARGET:T:R}} ${CPPFLAGS_${.TARGET:T}} +CFLAGS += ${CFLAGS_${.TARGET:T:R}} ${CFLAGS_${.TARGET:T}} # Define SYS_INCLUDE to indicate whether you want symbolic links to the system # source (``symlinks''), or a separate copy (``copies''); (latter useful diff --git a/mk/prlist.mk b/mk/prlist.mk index 09d7dfdacc97..aca1fde25555 100644 --- a/mk/prlist.mk +++ b/mk/prlist.mk @@ -1,14 +1,14 @@ -# $Id: prlist.mk,v 1.3 2008/07/17 16:24:57 sjg Exp $ +# $Id: prlist.mk,v 1.4 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 2006, 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 +# 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 # diff --git a/mk/prog.mk b/mk/prog.mk index 4bc6260d208b..ea48837d5544 100644 --- a/mk/prog.mk +++ b/mk/prog.mk @@ -1,4 +1,4 @@ -# $Id: prog.mk,v 1.35 2018/01/26 20:04:07 sjg Exp $ +# $Id: prog.mk,v 1.36 2020/08/19 17:51:53 sjg Exp $ .if !target(__${.PARSEFILE}__) __${.PARSEFILE}__: @@ -99,7 +99,7 @@ _PROGLDOPTS+= -Wl,-dynamic-linker=${_SHLINKER} _PROGLDOPTS+= -Wl,-rpath-link,${DESTDIR}${SHLIBDIR}:${DESTDIR}/usr/lib \ -L${DESTDIR}${SHLIBDIR} .endif -_PROGLDOPTS+= -Wl,-rpath,${SHLIBDIR}:/usr/lib +_PROGLDOPTS+= -Wl,-rpath,${SHLIBDIR}:/usr/lib .if defined(PROG_CXX) _CCLINK= ${CXX} diff --git a/mk/progs.mk b/mk/progs.mk index 7ccebbffb44c..16c381a50bf9 100644 --- a/mk/progs.mk +++ b/mk/progs.mk @@ -1,14 +1,14 @@ -# $Id: progs.mk,v 1.13 2013/08/02 18:28:48 sjg Exp $ +# $Id: progs.mk,v 1.16 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 2006, 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 +# 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 # @@ -87,11 +87,11 @@ x.$p= PROG_CXX=$p .endif $p ${p}_p: .PHONY .MAKE - (cd ${.CURDIR} && ${.MAKE} -f ${MAKEFILE} PROG=$p ${x.$p}) + (cd ${.CURDIR} && ${.MAKE} -f ${MAKEFILE} PROG=$p ${x.$p} -DWITHOUT_META_STATS) .for t in ${PROGS_TARGETS:O:u} $p.$t: .PHONY .MAKE - (cd ${.CURDIR} && ${.MAKE} -f ${MAKEFILE} PROG=$p ${x.$p} ${@:E}) + (cd ${.CURDIR} && ${.MAKE} -f ${MAKEFILE} PROG=$p ${x.$p} ${@:E} -DWITHOUT_META_STATS) .endfor .endfor @@ -99,4 +99,9 @@ $p.$t: .PHONY .MAKE $t: ${PROGS:%=%.$t} .endfor +.if !defined(WITHOUT_META_STATS) && ${.MAKE.LEVEL} > 0 +.END: _reldir_finish +.ERROR: _reldir_failed +.endif + .endif diff --git a/mk/rst2htm.mk b/mk/rst2htm.mk index 296b73c68574..1db9792f4127 100644 --- a/mk/rst2htm.mk +++ b/mk/rst2htm.mk @@ -1,14 +1,14 @@ -# $Id: rst2htm.mk,v 1.10 2015/09/08 22:17:46 sjg Exp $ +# $Id: rst2htm.mk,v 1.11 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 2009, 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 +# 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 # diff --git a/mk/scripts.mk b/mk/scripts.mk index 9b6d82f49253..5ea2474e65a3 100644 --- a/mk/scripts.mk +++ b/mk/scripts.mk @@ -1,14 +1,14 @@ -# $Id: scripts.mk,v 1.3 2017/05/06 17:29:45 sjg Exp $ +# $Id: scripts.mk,v 1.4 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 2006, 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 +# 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 # diff --git a/mk/srctop.mk b/mk/srctop.mk index fab090c80d39..91594c7a98e4 100644 --- a/mk/srctop.mk +++ b/mk/srctop.mk @@ -1,14 +1,14 @@ -# $Id: srctop.mk,v 1.3 2012/11/11 23:20:18 sjg Exp $ +# $Id: srctop.mk,v 1.4 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 2012, 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 +# 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 # @@ -46,7 +46,7 @@ SRCTOP!= cd ${.CURDIR}; while :; do \ here=`pwd`; \ ${_SRCTOP_TEST_} && { echo $$here; break; }; \ case $$here in /*/*/*) cd ..;; *) echo ""; break;; esac; \ - done + done .endif .if defined(SRCTOP) && exists(${SRCTOP}/.) .export SRCTOP diff --git a/mk/stage-install.sh b/mk/stage-install.sh index 64d044fa048c..674652d1d482 100755 --- a/mk/stage-install.sh +++ b/mk/stage-install.sh @@ -28,22 +28,26 @@ # "file".dirdep placed in "dest" or "dest".dirdep if it happed # to be a file rather than a directory. # +# Before we run install(1), we check if "dest" needs to be a +# directory (more than one file in "args") and create it +# if necessary. +# # SEE ALSO: # meta.stage.mk -# +# # RCSid: -# $Id: stage-install.sh,v 1.5 2013/04/19 16:32:24 sjg Exp $ +# $Id: stage-install.sh,v 1.9 2020/08/28 01:04:13 sjg Exp $ # -# @(#) Copyright (c) 2013, Simon J. Gerraty +# @(#) Copyright (c) 2013-2020, 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 +# 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 # @@ -59,6 +63,45 @@ do esac done +# get last entry from "$@" without side effects +last_entry() { + while [ $# -gt 8 ] + do + shift 8 + done + eval last=\$$# + echo $last +} + +# mkdir $dest if needed (more than one file) +mkdir_if_needed() { + ( + lf= + while [ $# -gt 8 ] + do + shift 4 + done + for f in "$@" + do + [ -f $f ] || continue + [ $f = $dest ] && continue + if [ -n "$lf" ]; then + # dest must be a directory + mkdir -p $dest + break + fi + lf=$f + done + ) +} + +args="$@" +dest=`last_entry "$@"` +case " $args " in +*" -d "*) ;; +*) [ -e $dest ] || mkdir_if_needed "$@";; +esac + # if .dirdep doesn't exist, just run install and be done _DIRDEP=${_DIRDEP:-$OBJDIR/.dirdep} [ -s $_DIRDEP ] && EXEC= || EXEC=exec @@ -80,12 +123,6 @@ StageDirdep() { LnCp $_DIRDEP $t.dirdep || exit 1 } -args="$@" -while [ $# -gt 8 ] -do - shift 8 -done -eval dest=\$$# if [ -f $dest ]; then # a file, there can be only one .dirdep needed StageDirdep $dest diff --git a/mk/sys.clean-env.mk b/mk/sys.clean-env.mk index 5ac74bba9342..88d32cb3c6e9 100644 --- a/mk/sys.clean-env.mk +++ b/mk/sys.clean-env.mk @@ -1,14 +1,14 @@ -# $Id: sys.clean-env.mk,v 1.22 2017/10/25 23:44:20 sjg Exp $ +# $Id: sys.clean-env.mk,v 1.23 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 2009, 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 +# 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 # @@ -55,7 +55,7 @@ MAKE_ENV_SAVE_PREFIX_LIST += \ MAKE_ENV_SAVE_EXCLUDE_LIST ?= _ # This is the actual list that we will save -# HOME is probably something worth clobbering eg. +# HOME is probably something worth clobbering eg. # HOME=/var/empty MAKE_ENV_SAVE_VAR_LIST += \ HOME \ diff --git a/mk/sys.debug.mk b/mk/sys.debug.mk index 7debfc6cf051..7fde27c24fdb 100644 --- a/mk/sys.debug.mk +++ b/mk/sys.debug.mk @@ -1,14 +1,14 @@ -# $Id: sys.debug.mk,v 1.1 2016/10/01 19:11:55 sjg Exp $ +# $Id: sys.debug.mk,v 1.2 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 2009, 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 +# 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 # diff --git a/mk/sys.dependfile.mk b/mk/sys.dependfile.mk index 5389c24fd1bb..7c1fd94d3eb8 100644 --- a/mk/sys.dependfile.mk +++ b/mk/sys.dependfile.mk @@ -1,14 +1,14 @@ -# $Id: sys.dependfile.mk,v 1.8 2016/03/11 01:34:13 sjg Exp $ +# $Id: sys.dependfile.mk,v 1.9 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 2012, 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 +# 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 # diff --git a/mk/sys.mk b/mk/sys.mk index 37e37390eb27..b21dfa8b4ebf 100644 --- a/mk/sys.mk +++ b/mk/sys.mk @@ -1,14 +1,14 @@ -# $Id: sys.mk,v 1.47 2020/04/17 21:08:17 sjg Exp $ +# $Id: sys.mk,v 1.51 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 2003-2009, 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 +# 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 # @@ -77,6 +77,7 @@ OPTIONS_DEFAULT_DEPENDENT += \ AUTO_OBJ/DIRDEPS_BUILD \ META_MODE/DIRDEPS_BUILD \ STAGING/DIRDEPS_BUILD \ + STATIC_DIRDEPS_CACHE/DIRDEPS_CACHE \ .-include <options.mk> @@ -116,7 +117,7 @@ ROOT_GROUP != sed -n /:0:/s/:.*//p /etc/group unix ?= We run ${_HOST_OSNAME}. -# We need a Bourne/POSIX shell +# We need a Bourne/POSIX shell MAKE_SHELL ?= sh SHELL ?= ${MAKE_SHELL} diff --git a/mk/sys.vars.mk b/mk/sys.vars.mk index 2f2e66700266..24e0ed26a15f 100644 --- a/mk/sys.vars.mk +++ b/mk/sys.vars.mk @@ -1,20 +1,20 @@ -# $Id: sys.vars.mk,v 1.4 2019/05/27 20:22:52 sjg Exp $ +# $Id: sys.vars.mk,v 1.5 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 2003-2009, 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 +# 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 # # We use the following paradigm for preventing multiple inclusion. -# It relies on the fact that conditionals and dependencies are resolved +# It relies on the fact that conditionals and dependencies are resolved # at the time they are read. # # _this ?= ${.PARSEFILE} diff --git a/mk/sys/AIX.mk b/mk/sys/AIX.mk index b848d99fb4e8..d591385be603 100644 --- a/mk/sys/AIX.mk +++ b/mk/sys/AIX.mk @@ -28,9 +28,9 @@ CC ?= gcc DBG ?= -O -g STATIC ?= -static .else -CC ?= cc +CC ?= cc DBG ?= -g -STATIC ?= +STATIC ?= .endif CFLAGS ?= ${DBG} COMPILE.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} -c @@ -138,7 +138,7 @@ ${CXX_SUFFIXES:%=%.a}: .s: ${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} .s.o: - ${COMPILE.s} -o ${.TARGET} ${.IMPSRC} + ${COMPILE.s} -o ${.TARGET} ${.IMPSRC} .s.a: ${COMPILE.s} ${.IMPSRC} ${AR} ${ARFLAGS} $@ $*.o @@ -162,7 +162,7 @@ ${CXX_SUFFIXES:%=%.a}: mv lex.yy.c ${.TARGET} .l.o: ${LEX.l} ${.IMPSRC} - ${COMPILE.c} -o ${.TARGET} lex.yy.c + ${COMPILE.c} -o ${.TARGET} lex.yy.c rm -f lex.yy.c # Yacc diff --git a/mk/sys/Darwin.mk b/mk/sys/Darwin.mk index ea04b416ff3a..06918a11a4ad 100644 --- a/mk/sys/Darwin.mk +++ b/mk/sys/Darwin.mk @@ -176,7 +176,7 @@ ${CXX_SUFFIXES:%=%.a}: .s: ${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} .s.o: - ${COMPILE.s} -o ${.TARGET} ${.IMPSRC} + ${COMPILE.s} -o ${.TARGET} ${.IMPSRC} .s.a: ${COMPILE.s} ${.IMPSRC} ${AR} ${ARFLAGS} $@ $*.o @@ -200,7 +200,7 @@ ${CXX_SUFFIXES:%=%.a}: mv lex.yy.c ${.TARGET} .l.o: ${LEX.l} ${.IMPSRC} - ${COMPILE.c} -o ${.TARGET} lex.yy.c + ${COMPILE.c} -o ${.TARGET} lex.yy.c rm -f lex.yy.c # Yacc diff --git a/mk/sys/Generic.mk b/mk/sys/Generic.mk index 9a3d3bffc183..51c72990f2ea 100644 --- a/mk/sys/Generic.mk +++ b/mk/sys/Generic.mk @@ -1,4 +1,4 @@ -# $Id: Generic.mk,v 1.16 2020/06/29 14:34:42 sjg Exp $ +# $Id: Generic.mk,v 1.17 2020/08/19 17:51:53 sjg Exp $ # # some reasonable defaults @@ -31,7 +31,7 @@ ARFLAGS ?= rl AS ?= as AFLAGS ?= -.if ${MACHINE_ARCH} == "sparc64" +.if ${MACHINE_ARCH} == "sparc64" AFLAGS+= -Wa,-Av9a .endif COMPILE.s ?= ${CC} ${AFLAGS} -c @@ -56,7 +56,7 @@ COMPILE.m ?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c LINK.m ?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS} CPP ?= cpp -CPPFLAGS ?= +CPPFLAGS ?= FC ?= f77 FFLAGS ?= -O @@ -181,7 +181,7 @@ ${CXX_SUFFIXES:%=%.a}: mv lex.yy.c ${.TARGET} .l.o: ${LEX.l} ${.IMPSRC} - ${COMPILE.c} -o ${.TARGET} lex.yy.c + ${COMPILE.c} -o ${.TARGET} lex.yy.c rm -f lex.yy.c # Yacc diff --git a/mk/sys/HP-UX.mk b/mk/sys/HP-UX.mk index 34dd2881d83d..f1c23148c186 100644 --- a/mk/sys/HP-UX.mk +++ b/mk/sys/HP-UX.mk @@ -1,4 +1,4 @@ -# $Id: HP-UX.mk,v 1.14 2020/06/29 14:34:42 sjg Exp $ +# $Id: HP-UX.mk,v 1.15 2020/08/19 17:51:53 sjg Exp $ # $NetBSD: sys.mk,v 1.19.2.1 1994/07/26 19:58:31 cgd Exp $ # @(#)sys.mk 5.11 (Berkeley) 3/13/91 @@ -8,7 +8,7 @@ unix ?= We run ${OS}. # HP-UX's cc does not provide any clues as to wether this is 9.x or 10.x # nor does sys/param.h, so we'll use the existence of /hp-ux -.if exists("/hp-ux") +.if exists("/hp-ux") OSMAJOR ?=9 .endif OSMAJOR ?=10 @@ -60,7 +60,7 @@ PICFLAG ?= +z LD_x= DBG ?=-g -O .endif -DBG ?= +DBG ?= STATIC ?= -Wl,-a,archive .endif .if (${__HPUX_VERSION} == "10") @@ -180,7 +180,7 @@ ${CXX_SUFFIXES:%=%.a}: .s: ${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} .s.o: - ${COMPILE.s} -o ${.TARGET} ${.IMPSRC} + ${COMPILE.s} -o ${.TARGET} ${.IMPSRC} .s.a: ${COMPILE.s} ${.IMPSRC} ${AR} ${ARFLAGS} $@ $*.o @@ -204,7 +204,7 @@ ${CXX_SUFFIXES:%=%.a}: mv lex.yy.c ${.TARGET} .l.o: ${LEX.l} ${.IMPSRC} - ${COMPILE.c} -o ${.TARGET} lex.yy.c + ${COMPILE.c} -o ${.TARGET} lex.yy.c rm -f lex.yy.c # Yacc diff --git a/mk/sys/IRIX.mk b/mk/sys/IRIX.mk index a194c1e78a11..00af15027f6e 100644 --- a/mk/sys/IRIX.mk +++ b/mk/sys/IRIX.mk @@ -44,7 +44,7 @@ COMPILE.m ?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c LINK.m ?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS} CPP ?= CC -CPPFLAGS ?= +CPPFLAGS ?= FC ?= f77 FFLAGS ?= -O @@ -173,7 +173,7 @@ ${CXX_SUFFIXES:%=%.a}: mv lex.yy.c ${.TARGET} .l.o: ${LEX.l} ${.IMPSRC} - ${COMPILE.c} -o ${.TARGET} lex.yy.c + ${COMPILE.c} -o ${.TARGET} lex.yy.c rm -f lex.yy.c # Yacc diff --git a/mk/sys/Linux.mk b/mk/sys/Linux.mk index bf80bb3addce..3cdc4dbe1a62 100644 --- a/mk/sys/Linux.mk +++ b/mk/sys/Linux.mk @@ -1,4 +1,4 @@ -# $Id: Linux.mk,v 1.12 2020/06/29 14:34:42 sjg Exp $ +# $Id: Linux.mk,v 1.13 2020/08/19 17:51:53 sjg Exp $ # $NetBSD: sys.mk,v 1.19.2.1 1994/07/26 19:58:31 cgd Exp $ # @(#)sys.mk 5.11 (Berkeley) 3/13/91 @@ -141,7 +141,7 @@ ${CXX_SUFFIXES:%=%.a}: .s: ${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} .s.o: - ${COMPILE.s} -o ${.TARGET} ${.IMPSRC} + ${COMPILE.s} -o ${.TARGET} ${.IMPSRC} .s.a: ${COMPILE.s} ${.IMPSRC} ${AR} ${ARFLAGS} $@ $*.o @@ -165,7 +165,7 @@ ${CXX_SUFFIXES:%=%.a}: mv lex.yy.c ${.TARGET} .l.o: ${LEX.l} ${.IMPSRC} - ${COMPILE.c} -o ${.TARGET} lex.yy.c + ${COMPILE.c} -o ${.TARGET} lex.yy.c rm -f lex.yy.c # Yacc diff --git a/mk/sys/NetBSD.mk b/mk/sys/NetBSD.mk index 2e72cc742e4f..6629a4445a2e 100644 --- a/mk/sys/NetBSD.mk +++ b/mk/sys/NetBSD.mk @@ -79,7 +79,7 @@ COMPILE.m ?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c LINK.m ?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS} CPP ?= cpp -CPPFLAGS ?= +CPPFLAGS ?= FC ?= f77 FFLAGS ?= -O @@ -208,7 +208,7 @@ ${CXX_SUFFIXES:%=%.a}: mv lex.yy.c ${.TARGET} .l.o: ${LEX.l} ${.IMPSRC} - ${COMPILE.c} -o ${.TARGET} lex.yy.c + ${COMPILE.c} -o ${.TARGET} lex.yy.c rm -f lex.yy.c # Yacc diff --git a/mk/sys/OSF1.mk b/mk/sys/OSF1.mk index 4c1a09f6f5f7..88e0ea28b930 100644 --- a/mk/sys/OSF1.mk +++ b/mk/sys/OSF1.mk @@ -1,4 +1,4 @@ -# $Id: OSF1.mk,v 1.11 2020/06/29 14:34:42 sjg Exp $ +# $Id: OSF1.mk,v 1.12 2020/08/19 17:51:53 sjg Exp $ # $NetBSD: sys.mk,v 1.19.2.1 1994/07/26 19:58:31 cgd Exp $ # @(#)sys.mk 5.11 (Berkeley) 3/13/91 @@ -31,7 +31,7 @@ LINK.s ?= ${CC} ${AFLAGS} ${LDFLAGS} COMPILE.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} -c LINK.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS} .if exists(/opt/gnu/bin/gcc) || exists(/usr/local/bin/gcc) -CC ?= gcc +CC ?= gcc .else CC ?= cc -std .endif @@ -176,7 +176,7 @@ ${CXX_SUFFIXES:%=%.a}: mv lex.yy.c ${.TARGET} .l.o: ${LEX.l} ${.IMPSRC} - ${COMPILE.c} -o ${.TARGET} lex.yy.c + ${COMPILE.c} -o ${.TARGET} lex.yy.c rm -f lex.yy.c # Yacc diff --git a/mk/sys/OpenBSD.mk b/mk/sys/OpenBSD.mk index d73bb0d82c9a..7440a231e3bf 100644 --- a/mk/sys/OpenBSD.mk +++ b/mk/sys/OpenBSD.mk @@ -21,7 +21,7 @@ RANLIB ?= ranlib AS ?= as AFLAGS ?= -.if ${MACHINE_ARCH} == "sparc64" +.if ${MACHINE_ARCH} == "sparc64" AFLAGS+= -Wa,-Av9a .endif COMPILE.s ?= ${CC} ${AFLAGS} -c @@ -54,7 +54,7 @@ COMPILE.m ?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c LINK.m ?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS} CPP ?= cpp -CPPFLAGS ?= +CPPFLAGS ?= FC ?= f77 FFLAGS ?= -O @@ -183,7 +183,7 @@ ${CXX_SUFFIXES:%=%.a}: mv lex.yy.c ${.TARGET} .l.o: ${LEX.l} ${.IMPSRC} - ${COMPILE.c} -o ${.TARGET} lex.yy.c + ${COMPILE.c} -o ${.TARGET} lex.yy.c rm -f lex.yy.c # Yacc diff --git a/mk/sys/SunOS.mk b/mk/sys/SunOS.mk index e79cd3a7dbd4..4369c8d43b93 100644 --- a/mk/sys/SunOS.mk +++ b/mk/sys/SunOS.mk @@ -1,4 +1,4 @@ -# $Id: SunOS.mk,v 1.11 2020/06/29 14:34:42 sjg Exp $ +# $Id: SunOS.mk,v 1.12 2020/08/19 17:51:53 sjg Exp $ .if ${.PARSEFILE} == "sys.mk" .include <host-target.mk> @@ -197,7 +197,7 @@ ${CXX_SUFFIXES:%=%.a}: mv lex.yy.c ${.TARGET} .l.o: ${LEX.l} ${.IMPSRC} - ${COMPILE.c} -o ${.TARGET} lex.yy.c + ${COMPILE.c} -o ${.TARGET} lex.yy.c rm -f lex.yy.c # Yacc diff --git a/mk/sys/UnixWare.mk b/mk/sys/UnixWare.mk index 888f0d90c0b4..272d3e65c2d8 100644 --- a/mk/sys/UnixWare.mk +++ b/mk/sys/UnixWare.mk @@ -1,4 +1,4 @@ -# $Id: UnixWare.mk,v 1.6 2020/06/29 14:34:42 sjg Exp $ +# $Id: UnixWare.mk,v 1.7 2020/08/19 17:51:53 sjg Exp $ # based on "Id: SunOS.5.sys.mk,v 1.6 2003/09/30 16:42:23 sjg Exp " # $NetBSD: sys.mk,v 1.19.2.1 1994/07/26 19:58:31 cgd Exp $ # @(#)sys.mk 5.11 (Berkeley) 3/13/91 @@ -219,7 +219,7 @@ ${CXX_SUFFIXES:%=%.a}: mv lex.yy.c ${.TARGET} .l.o: ${LEX.l} ${.IMPSRC} - ${COMPILE.c} -o ${.TARGET} lex.yy.c + ${COMPILE.c} -o ${.TARGET} lex.yy.c rm -f lex.yy.c # Yacc diff --git a/mk/target-flags.mk b/mk/target-flags.mk index 4525dbd08d7b..789f09b23115 100644 --- a/mk/target-flags.mk +++ b/mk/target-flags.mk @@ -27,27 +27,27 @@ # variables. The original version of this macro file did # elaborate things with CFLAGS. The current, simpler # implementation is ultimately more flexible. -# +# # It is important that target-flags.mk is included after other # macro files and that target specific flags that may reference # _$v are set after that. -# +# # Only works with a make(1) that does nested evaluation correctly. # RCSid: -# $Id: target-flags.mk,v 1.9 2014/04/05 22:56:54 sjg Exp $ +# $Id: target-flags.mk,v 1.10 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 1998-2002, 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 +# 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 # diff --git a/mk/warnings.mk b/mk/warnings.mk index 7fb3ebd4a8f8..77635fbc8a29 100644 --- a/mk/warnings.mk +++ b/mk/warnings.mk @@ -1,15 +1,15 @@ # RCSid: -# $Id: warnings.mk,v 1.14 2016/04/05 15:58:37 sjg Exp $ +# $Id: warnings.mk,v 1.15 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 2002, 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 +# 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 # @@ -28,10 +28,10 @@ MIN_WARNINGS?= -Wall \ -Wformat \ -Wimplicit \ -Wunused \ - -Wuninitialized + -Wuninitialized LOW_WARNINGS?= ${MIN_WARNINGS} -W -Wstrict-prototypes -Wmissing-prototypes - + MEDIUM_WARNINGS?= ${LOW_WARNINGS} -Werror HIGH_WARNINGS?= ${MEDIUM_WARNINGS} \ @@ -84,7 +84,7 @@ W_uninitialized= # .for loops have the [dis]advantage of being evaluated when read, -# so adding to WARNINGS_SET[_${MACHINE_ARCH}] after this file is +# so adding to WARNINGS_SET[_${MACHINE_ARCH}] after this file is # read has no effect. # Replacing the above .for loops with the WARNINGS+= below solves that # but tiggers a double free bug in bmake-20040118 and earlier. @@ -95,11 +95,11 @@ W_uninitialized= # In the second :@ "loop", the ::?= noise sets W_foo?=-Wfoo etc # which makes it easy to turn off override individual flags # (see W_uninitialized above). -# +# # The last bit expands to ${W_foo_${.TARGET:T}:U${W_foo}} # which is the bit we ultimately want. It allows W_* to be set on a # per target basis. -# +# # NOTE: that we force the target extension to be .o # @@ -110,7 +110,7 @@ M_warnings_list = @s@$${$$s_WARNINGS}@:O:u:@w@$${$${w:C/-(.)/\1_/}::?=$$w} $${$$ _warnings = ${WARNINGS_SET_${MACHINE_ARCH}:U${WARNINGS_SET}:${M_warnings_list}} # now a list of all -Wno-* overrides not just those defined by WARNINGS_SET # since things like -Wall imply lots of others. -# this should be a super-set of the -Wno-* in _warnings, but +# this should be a super-set of the -Wno-* in _warnings, but # just in case... _no_warnings = ${_warnings:M-Wno-*} ${ALL_WARNINGS_SETS:${M_warnings_list}:M-Wno-*} # -Wno-* must follow any others diff --git a/mk/whats.mk b/mk/whats.mk index 1dacb4c14365..e10964463d4a 100644 --- a/mk/whats.mk +++ b/mk/whats.mk @@ -1,20 +1,20 @@ -# $Id: whats.mk,v 1.9 2020/05/09 19:48:53 sjg Exp $ +# $Id: whats.mk,v 1.10 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 2014-2020, 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 +# 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 # .if ${MK_WHATSTRING:Uno} == "yes" -# it can be useful to embed a what(1) string in binaries +# it can be useful to embed a what(1) string in binaries # so that the build location can be seen from a core file. .if defined(KMOD) what_thing ?= ${KMOD} diff --git a/mk/yacc.mk b/mk/yacc.mk index 910b004431df..7f7e99578d70 100644 --- a/mk/yacc.mk +++ b/mk/yacc.mk @@ -1,4 +1,4 @@ -# $Id: yacc.mk,v 1.6 2011/06/10 22:45:46 sjg Exp $ +# $Id: yacc.mk,v 1.7 2020/08/19 17:51:53 sjg Exp $ # # @(#) Copyright (c) 1999-2011, Simon J. Gerraty @@ -6,10 +6,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 # |