summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
Diffstat (limited to 'mk')
-rw-r--r--mk/ChangeLog104
-rw-r--r--mk/FILES1
-rw-r--r--mk/auto.dep.mk52
-rw-r--r--mk/autoconf.mk23
-rw-r--r--mk/autodep.mk7
-rw-r--r--mk/compiler.mk10
-rw-r--r--mk/dep.mk4
-rw-r--r--mk/dirdeps.mk57
-rw-r--r--mk/doc.mk4
-rw-r--r--mk/dpadd.mk4
-rw-r--r--mk/final.mk4
-rw-r--r--mk/init.mk4
-rwxr-xr-xmk/install-mk4
-rw-r--r--mk/java.mk4
-rw-r--r--mk/ldorder.mk4
-rw-r--r--mk/lib.mk6
-rw-r--r--mk/man.mk54
-rw-r--r--mk/meta.autodep.mk12
-rw-r--r--mk/meta.stage.mk11
-rw-r--r--mk/meta.sys.mk26
-rwxr-xr-xmk/meta2deps.py29
-rw-r--r--mk/obj.mk4
-rw-r--r--mk/options.mk38
-rw-r--r--mk/own.mk6
-rw-r--r--mk/prlist.mk4
-rw-r--r--mk/prog.mk4
-rwxr-xr-xmk/stage-install.sh10
-rw-r--r--mk/sys.mk9
-rw-r--r--mk/sys.vars.mk4
-rw-r--r--mk/sys/SCO_SV.mk13
-rw-r--r--mk/sys/UnixWare.mk24
31 files changed, 379 insertions, 161 deletions
diff --git a/mk/ChangeLog b/mk/ChangeLog
index f73c4fb68c6b..93bde20d754d 100644
--- a/mk/ChangeLog
+++ b/mk/ChangeLog
@@ -1,3 +1,107 @@
+2021-12-12 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * sys.mk: simplify; include meta.sys.mk if MK_META_MODE is yes.
+
+ * meta.sys.mk: do not check for /dev/filemon if .MAKE.PATH_FILEMON
+ is something else.
+
+ * meta.autodep.mk: we can now reference ${.SUFFIXES}
+
+ * meta2deps.py: derive a list of dirdep extensions from
+ TARGET_SPEC to trim from dirdeps.
+
+ * dirdeps.mk: flip the computation of qualified vs unqualified
+ dirdeps - it is much simpler to check for unqualified first.
+
+2021-12-11 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * install-mk (MK_VERSION): 20211212
+
+ * auto.dep.mk: rearrange so that the trivial implementation
+ for recent bmake is more obvious.
+
+2021-12-07 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * install-mk (MK_VERSION): 20211207
+
+ * Ensure guard targets are .NOTMAIN
+
+ * meta.sys.mk: check for nofilemon support when we skip level 0
+
+ * auto.dep.mk: make this usable in meta mode
+ for platforms that cannot use meta.autodep.mk
+
+ * meta2deps.py: avoid confusion if MACHINE and another
+ TARGET_SPEC_VAR have same value.
+
+2021-11-27 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * dirdeps.mk: when building dirdeps.cache, minimize the amount of
+ data put into env, by stripping ${SRCTOP}/ from each entry.
+ A long sandbox name can double the amount of memory consumed and
+ in extreme cases cause failure.
+ While we are at it, strip ${SRCTOP}/ from a lot of the debug output.
+
+2021-11-11 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * install-mk (MK_VERSION): 20211111
+
+ * meta.stage.mk (LN_CP_SCRIPT): if staging to NFS cp -p can fail
+ so fallback to cp if necessary.
+
+2021-10-30 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * man.mk (CMT2DOC): use cmt2doc.py rather than the 30 year
+ old cmt2doc.pl
+
+2021-10-24 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * meta.stage.mk: stage_as_and_symlink use ${STAGE_LINK_AS_$f:U$f}
+ as the symlink (rare)
+
+2021-10-16 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * autoconf.mk: if AUTOCONF_GENERATED_MAKEFILE is set and has not
+ been read, throw an error after running configure telling user to
+ restart.
+
+2021-10-13 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * install-mk (MK_VERSION): 20211011
+
+ * Add support for SCO_SV
+
+2021-10-01 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * install-mk (MK_VERSION): 20211001
+
+ * man.mk: use MAN_SUFFIXES and CMT2DOC_SUFFIXES for more
+ flexibility
+
+2021-09-13 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * options.mk (describe-options): print options and their values
+ and optional description
+
+2021-09-11 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * install-mk (MK_VERSION): 20210911
+
+ * options.mk (show-options): print options and their values
+
+2021-09-08 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * install-mk (MK_VERSION): 20210909
+
+ * lib.mk: apply patch from <daniel@octaforge.org>
+ to fix shared libs on Linux
+
+2021-08-08 Simon J Gerraty <sjg@beast.crufty.net>
+
+ * install-mk (MK_VERSION): 20210808
+
+ * options.mk: issue warning for WITH_*=no
+
2021-06-16 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20210616
diff --git a/mk/FILES b/mk/FILES
index 51b1acd716b2..91c4387e8ccb 100644
--- a/mk/FILES
+++ b/mk/FILES
@@ -54,6 +54,7 @@ sys/Linux.mk
sys/NetBSD.mk
sys/OSF1.mk
sys/OpenBSD.mk
+sys/SCO_SV.mk
sys/SunOS.mk
sys/UnixWare.mk
target-flags.mk
diff --git a/mk/auto.dep.mk b/mk/auto.dep.mk
index d905649ab206..c30b37f44053 100644
--- a/mk/auto.dep.mk
+++ b/mk/auto.dep.mk
@@ -1,8 +1,8 @@
#
# RCSid:
-# $Id: auto.dep.mk,v 1.6 2020/08/19 17:51:53 sjg Exp $
+# $Id: auto.dep.mk,v 1.10 2021/12/11 18:57:41 sjg Exp $
#
-# @(#) Copyright (c) 2010, Simon J. Gerraty
+# @(#) Copyright (c) 2010-2021, Simon J. Gerraty
#
# This file is provided in the hope that it will
# be of use. There is absolutely NO WARRANTY.
@@ -30,45 +30,59 @@
# dep.mk will handle that itself.
#
.if !target(__${.PARSEFILE}__)
-__${.PARSEFILE}__:
-
-# this what bmake > 20100401 will look for
-.MAKE.DEPENDFILE ?= .depend
+__${.PARSEFILE}__: .NOTMAIN
# set this to -MMD to ignore /usr/include
# actually it ignores <> so may not be a great idea
CFLAGS_MD ?= -MD
# -MF etc not available on all gcc versions.
+.if ${COMPILER_TYPE:Ugcc} == "gcc" && ${COMPILER_VERSION:U0} < 30000
+CFLAGS_MF=
+.endif
CFLAGS_MF ?= -MF ${.TARGET:T}.d -MT ${.TARGET:T}
CFLAGS += ${CFLAGS_MD} ${CFLAGS_MF}
CXXFLAGS += ${CFLAGS_MD} ${CFLAGS_MF}
-CLEANFILES += .depend ${.MAKE.DEPENDFILE} *.d
+CLEANFILES += .depend *.d
+
+.if ${MAKE_VERSION} >= 20160218
+
+# we have .dinclude and this is all that is required
+.if empty(_SKIP_BUILD)
+_all_objs = ${OBJS} ${POBJS} ${SOBJS}
+.for d in ${_all_objs:M*o:T:O:u:%=%.d}
+.dinclude <$d>
+.endfor
+.endif
+
+.else # we lack .dinclude
+
+.if ${.MAKE.MODE:Unormal:Mmeta} != ""
+# ignore .MAKE.DEPENDFILE
+DEPENDFILE = .depend
+.else
+# this what bmake > 20100401 will look for
+.MAKE.DEPENDFILE ?= .depend
+DEPENDFILE ?= ${.MAKE.DEPENDFILE}
+.endif
+
+CLEANFILES += ${DEPENDFILE}
-.if ${MAKE_VERSION} < 20160218
# skip generating dependfile for misc targets
.if ${.TARGETS:Uall:M*all} != ""
-.END: ${.MAKE.DEPENDFILE}
+.END: ${DEPENDFILE}
.endif
# doing 'make depend' isn't a big win with this model
.if !target(depend)
-depend: ${.MAKE.DEPENDFILE}
+depend: ${DEPENDFILE}
.endif
# this is trivial
-${.MAKE.DEPENDFILE}: ${OBJS} ${POBJS} ${SOBJS}
+${DEPENDFILE}: ${OBJS} ${POBJS} ${SOBJS}
-@for f in ${.ALLSRC:M*o:T:O:u:%=%.d}; do \
echo ".-include \"$$f\""; \
done > $@
-.else
-# we have .dinclude
-.if empty(_SKIP_BUILD)
-_all_objs = ${OBJS} ${POBJS} ${SOBJS}
-.for d in ${_all_objs:M*o:T:O:u:%=%.d}
-.dinclude <$d>
-.endfor
-.endif
.endif
.endif
diff --git a/mk/autoconf.mk b/mk/autoconf.mk
index 61e6978043a8..6011a8af4df5 100644
--- a/mk/autoconf.mk
+++ b/mk/autoconf.mk
@@ -1,4 +1,4 @@
-# $Id: autoconf.mk,v 1.10 2020/08/19 17:51:53 sjg Exp $
+# $Id: autoconf.mk,v 1.16 2021/10/19 17:36:06 sjg Exp $
#
# @(#) Copyright (c) 1996-2009, Simon J. Gerraty
#
@@ -13,32 +13,37 @@
# sjg@crufty.net
#
-.NOPATH: config.h config.status
+.NOPATH: config.h config.gen config.recheck config.status
CONFIGURE_DEPS += ${.CURDIR}/config.h.in ${.CURDIR}/configure
.if !target(config.h)
-config.h: ${CONFIGURE_DEPS} config.status
+config.h: .NOTMAIN ${CONFIGURE_DEPS} config.status
./config.status
+.if !empty(AUTOCONF_GENERATED_MAKEFILE) && ${AUTOCONF_GENERATED_MAKEFILE:T:@m@${"${.MAKE.MAKEFILES:T:M$m}":?yes:no}@:Mno} != ""
+ @echo Generated ${AUTOCONF_GENERATED_MAKEFILE}, you need to restart; exit 1
+.endif
.endif
.if !target(config.status)
# avoid the targets behaving differently
+config.status: .NOTMAIN
.if exists(${.OBJDIR}/config.status)
config.status: config.recheck
.else
config.status: config.gen
.endif
-config.recheck: ${CONFIGURE_DEPS}
+config.recheck: .NOTMAIN ${CONFIGURE_DEPS} config.gen
./config.status --recheck
@touch $@
-config.gen: ${CONFIGURE_DEPS}
+config.gen: .NOTMAIN ${CONFIGURE_DEPS}
CC="${CC} ${CCMODE}" ${.CURDIR}/configure --no-create ${CONFIGURE_ARGS}
@touch $@ config.recheck
-CLEANFILES+= config.recheck config.gen config.status *.meta
+CLEANFILES+= config.recheck config.gen config.status *.meta \
+ ${AUTOCONF_GENERATED_MAKEFILE:U}
.endif
# avoid things blowing up if these are not here...
@@ -67,14 +72,14 @@ ACLOCAL += aclocal.m4
ACCONFIG += acconfig.h
.endif
-config.h.in: ${.CURDIR}/configure.in ${ACCONFIG}
+config.h.in: .NOTMAIN ${.CURDIR}/configure.in ${ACCONFIG}
(cd ${.CURDIR} && ${AUTOHEADER})
-configure: ${.CURDIR}/configure.in ${ACLOCAL}
+configure: .NOTMAIN ${.CURDIR}/configure.in ${ACLOCAL}
(cd ${.CURDIR} && ${AUTOCONF})
AUTOCONF_INPUTS += configure
-autoconf-input: ${AUTOCONF_INPUTS}
+autoconf-input: .NOTMAIN ${AUTOCONF_INPUTS}
.endif
.endif
diff --git a/mk/autodep.mk b/mk/autodep.mk
index a7bb942278c9..9104da2e2567 100644
--- a/mk/autodep.mk
+++ b/mk/autodep.mk
@@ -1,6 +1,6 @@
#
# RCSid:
-# $Id: autodep.mk,v 1.38 2020/08/19 17:51:53 sjg Exp $
+# $Id: autodep.mk,v 1.40 2021/12/08 05:56:50 sjg Exp $
#
# @(#) Copyright (c) 1999-2010, Simon J. Gerraty
#
@@ -20,7 +20,7 @@
# dependencies are normally updated as part of compilation.
.if !target(__${.PARSEFILE}__)
-__${.PARSEFILE}__:
+__${.PARSEFILE}__: .NOTMAIN
DEPENDFILE?= .depend
.for d in ${DEPENDFILE:N.depend}
@@ -67,6 +67,9 @@ __dependsrcs= ${__dependsrcsx:O:u}
CFLAGS_MD?=-MD
# -MF etc not available on all gcc versions.
# we "fix" the .o later
+.if ${COMPILER_TYPE:Ugcc} == "gcc" && ${COMPILER_VERSION:U0} < 30000
+CFLAGS_MF=
+.endif
CFLAGS_MF?=-MF ${.TARGET:T:R}.d -MT ${.TARGET:T:R}.o
CFLAGS+= ${CFLAGS_MD} ${CFLAGS_MF}
RM?= rm
diff --git a/mk/compiler.mk b/mk/compiler.mk
index b20ecaa047e3..83c0cead8f25 100644
--- a/mk/compiler.mk
+++ b/mk/compiler.mk
@@ -1,4 +1,4 @@
-# $Id: compiler.mk,v 1.7 2020/08/19 17:51:53 sjg Exp $
+# $Id: compiler.mk,v 1.10 2021/12/08 05:56:50 sjg Exp $
#
# @(#) Copyright (c) 2019, Simon J. Gerraty
#
@@ -14,7 +14,7 @@
#
.if !target(__${.PARSEFILE}__)
-__${.PARSEFILE}__:
+__${.PARSEFILE}__: .NOTMAIN
.if ${MACHINE} == "common"
COMPILER_TYPE = none
@@ -22,12 +22,12 @@ COMPILER_VERSION = 0
.endif
.if empty(COMPILER_TYPE) || empty(COMPILER_VERSION)
# gcc does not always say gcc
-_v != ${CC} --version 2> /dev/null | \
- egrep -i 'clang|cc|[1-9]\.[0-9]|Free Software Foundation'
+_v != (${CC} --version) 2> /dev/null | \
+ egrep -i 'clang|cc|[1-9]\.[0-9]|Free Software Foundation'; echo
.if empty(COMPILER_TYPE)
.if ${_v:Mclang} != ""
COMPILER_TYPE = clang
-.elif ${_v:M[Gg][Cc][Cc]} != "" || ${_v:MFoundation*} != ""
+.elif ${_v:M[Gg][Cc][Cc]} != "" || ${_v:MFoundation*} != "" || ${CC:T:M*gcc*} != ""
COMPILER_TYPE = gcc
.endif
.endif
diff --git a/mk/dep.mk b/mk/dep.mk
index b07191a09cbf..ea73846f5fd8 100644
--- a/mk/dep.mk
+++ b/mk/dep.mk
@@ -1,7 +1,7 @@
-# $Id: dep.mk,v 1.17 2014/08/04 05:12:27 sjg Exp $
+# $Id: dep.mk,v 1.18 2021/12/08 05:56:50 sjg Exp $
.if !target(__${.PARSEFILE}__)
-__${.PARSEFILE}__:
+__${.PARSEFILE}__: .NOTMAIN
# handle Proc*C as well...
.if defined(SRCS)
diff --git a/mk/dirdeps.mk b/mk/dirdeps.mk
index 38ead3de37cd..5e735f236b9f 100644
--- a/mk/dirdeps.mk
+++ b/mk/dirdeps.mk
@@ -1,4 +1,4 @@
-# $Id: dirdeps.mk,v 1.140 2021/06/20 23:42:38 sjg Exp $
+# $Id: dirdeps.mk,v 1.147 2021/12/14 02:09:53 sjg Exp $
# Copyright (c) 2010-2021, Simon J. Gerraty
# Copyright (c) 2010-2018, Juniper Networks, Inc.
@@ -66,6 +66,10 @@
# processing is recursive and results in .MAKE.LEVEL 0 learning the
# dependencies of the tree wrt the initial directory (_DEP_RELDIR).
#
+# NOTE: given the extent of processing that DIRDEPS undergoes it
+# is important that any variables in entries use :U to guard
+# against surprises when undefined.
+#
# TARGET_SPEC_VARS
# The default value is just MACHINE, and for most environments
# this is sufficient. The _DIRDEP_USE target actually sets
@@ -399,7 +403,7 @@ DIRDEP_LOADAVG_REPORT = \
_DIRDEP_USE: .USE .MAKE
@for m in ${.MAKE.MAKEFILE_PREFERENCE}; do \
test -s ${.TARGET:R}/$$m || continue; \
- echo "${TRACER}Checking ${.TARGET:S,${SRCTOP}/,,} 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} \
@@ -562,7 +566,7 @@ ${DIRDEPS_CACHE}: .META .NOMETA_CMP
${"${DEBUG_DIRDEPS:Nno}":?DEBUG_DIRDEPS='${DEBUG_DIRDEPS}':} \
${.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;s,_{,$${,g' >> ${.TARGET}.new && \
+ 3>&1 1>&2 | sed 's,${SRCTOP},_{SRCTOP},g;s,_{,$${,g' >> ${.TARGET}.new && \
mv ${.TARGET}.new ${.TARGET}
.endif
@@ -638,6 +642,7 @@ _build_dirs += ${_machines:@m@${_CURDIR}.$m@}
.endif
.if ${_debug_reldir}
+.info ${DEP_RELDIR}.${DEP_TARGET_SPEC}: nDIRDEPS=${DIRDEPS:[#]}
.info ${DEP_RELDIR}.${DEP_TARGET_SPEC}: DIRDEPS='${DIRDEPS}'
.info ${DEP_RELDIR}.${DEP_TARGET_SPEC}: _machines='${_machines}'
.endif
@@ -656,11 +661,10 @@ DEP_DIRDEPS_FILTER = U
# this is what we start with
__depdirs := ${DIRDEPS:${NSkipDir}:${DEP_DIRDEPS_FILTER:ts:}:C,//+,/,g:O:u:@d@${SRCTOP}/$d@}
-# some entries may be qualified with .<machine>
-# the :M*/*/*.* just tries to limit the dirs we check to likely ones.
-# the ${d:E:M*/*} ensures we don't consider junos/usr.sbin/mgd
-__qual_depdirs := ${__depdirs:M*/*/*.*:@d@${exists($d):?:${"${d:E:M*/*}":?:${exists(${d:R}):?$d:}}}@}
-__unqual_depdirs := ${__depdirs:${__qual_depdirs:Uno:${M_ListToSkip}}}
+# some entries may be qualified with .<machine> or .<target_spec>
+# we can tell the unqualified ones easily - because they exist
+__unqual_depdirs := ${__depdirs:@d@${exists($d):?$d:}@}
+__qual_depdirs := ${__depdirs:${__unqual_depdirs:Uno:${M_ListToSkip}}}
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# if it was called out - we likely need it.
@@ -671,9 +675,9 @@ __qual_depdirs += ${__hostdpadd}
.if ${_debug_reldir}
.info DEP_DIRDEPS_FILTER=${DEP_DIRDEPS_FILTER:ts:}
-.info depdirs=${__depdirs}
-.info qualified=${__qual_depdirs}
-.info unqualified=${__unqual_depdirs}
+.info depdirs=${__depdirs:S,^${SRCTOP}/,,}
+.info qualified=${__qual_depdirs:S,^${SRCTOP}/,,}
+.info unqualified=${__unqual_depdirs:S,^${SRCTOP}/,,}
.endif
# _build_dirs is what we will feed to _DIRDEP_USE
@@ -694,13 +698,14 @@ _build_all_dirs := ${_build_all_dirs:O:u}
# Normally if doing make -V something,
# we do not want to waste time chasing DIRDEPS
# but if we want to count the number of Makefile.depend* read, we do.
-.if ${.MAKEFLAGS:M-V${_V_READ_DIRDEPS}} == ""
+.if ${.MAKEFLAGS:M-V${_V_READ_DIRDEPS:U}} == ""
.if !empty(_build_all_dirs)
.if ${BUILD_DIRDEPS_CACHE} == "yes"
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}@}
-.export _build_xtra_dirs _new_dirdeps
+_new_dirdeps := ${_build_all_dirs:@x@${target($x):?:$x}@:S,^${SRCTOP}/,,}
+_cache_xtra_deps := ${_build_xtra_dirs:S,^${SRCTOP}/,,}
+.export _cache_xtra_deps _new_dirdeps
.if !empty(DEP_EXPORT_VARS)
# Discouraged, but there are always exceptions.
# Handle it here rather than explain how.
@@ -713,7 +718,7 @@ dirdeps: ${_build_all_dirs}
${_build_all_dirs}: _DIRDEP_USE
.if ${_debug_reldir}
-.info ${DEP_RELDIR}.${DEP_TARGET_SPEC}: needs: ${_build_dirs}
+.info ${DEP_RELDIR}.${DEP_TARGET_SPEC}: needs: ${_build_dirs:S,^${SRCTOP}/,,}
.endif
.if !empty(DEP_EXPORT_VARS)
@@ -724,37 +729,37 @@ DEP_EXPORT_VARS=
# this builds the dependency graph
.for m in ${_machines}
.if ${BUILD_DIRDEPS_CACHE} == "yes" && !empty(_build_dirs)
-x!= echo; { echo; echo 'DIRDEPS.${_this_dir}.$m = \'; } >&3
_cache_deps =
+x!= echo; { echo; echo 'DIRDEPS.${_this_dir}.$m = \'; } >&3
.endif
# it would be nice to do :N${.TARGET}
.if !empty(__qual_depdirs)
.for q in ${__qual_depdirs:${M_dep_qual_fixes:ts:}:E:O:u:N$m}
.if ${_debug_reldir} || ${DEBUG_DIRDEPS:@x@${${DEP_RELDIR}.$m:L:M$x}${${DEP_RELDIR}.$q:L:M$x}@} != ""
-.info ${DEP_RELDIR}.$m: graph: ${_build_dirs:M*.$q}
+.info ${DEP_RELDIR}.$m: graph: ${_build_dirs:M*.$q:S,^${SRCTOP}/,,}
.endif
.if ${BUILD_DIRDEPS_CACHE} == "yes"
-_cache_deps += ${_build_dirs:M*.$q}
+_cache_deps += ${_build_dirs:M*.$q:S,^${SRCTOP}/,,}
.else
${_this_dir}.$m: ${_build_dirs:M*.$q}
.endif
.endfor
.endif
.if ${_debug_reldir}
-.info ${DEP_RELDIR}.$m: graph: ${_build_dirs:M*.$m:N${_this_dir}.$m}
+.info ${DEP_RELDIR}.$m: graph: ${_build_dirs:M*.$m:N${_this_dir}.$m:S,^${SRCTOP}/,,}
.endif
.if ${BUILD_DIRDEPS_CACHE} == "yes"
.if !empty(_build_dirs)
-_cache_deps += ${_build_dirs:M*.$m:N${_this_dir}.$m}
+_cache_deps += ${_build_dirs:M*.$m:N${_this_dir}.$m:S,^${SRCTOP}/,,}
.if !empty(_cache_deps)
.export _cache_deps
-x!= echo; for x in $$_cache_deps; do echo " $$x \\"; done >&3
+x!= echo; for x in $$_cache_deps; do echo " _{SRCTOP}/$$x \\"; done >&3
.endif
-# anything in _build_xtra_dirs is hooked to dirdeps: only
+# anything in _{build,env}_xtra_dirs is hooked to dirdeps: only
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
+ for x in $$_cache_xtra_deps; do echo " _{SRCTOP}/$$x \\"; done; \
+ echo; for x in $$_new_dirdeps; do echo "_{SRCTOP}/$$x: _DIRDEP_USE"; done; } >&3
.endif
.else
${_this_dir}.$m: ${_build_dirs:M*.$m:N${_this_dir}.$m}
@@ -769,7 +774,7 @@ ${_this_dir}.$m: ${_build_dirs:M*.$m:N${_this_dir}.$m}
# once only
_dirdeps_checked.$d:
.if ${_debug_search}
-.info checking $d
+.info checking ${d:S,^${SRCTOP}/,,}
.endif
# Note: _build_all_dirs is fully qualifed so d:R is always the directory
.if exists(${d:R})
@@ -798,7 +803,7 @@ _qm := ${_m:C;(\.depend)$;\1.${d:E};:${M_dep_qual_fixes:ts:}}
.endif
# set this "just in case"
# we can skip :tA since we computed the path above
-DEP_RELDIR := ${_m:H:S,${SRCTOP}/,,}
+DEP_RELDIR := ${_m:H:S,^${SRCTOP}/,,}
# and reset this
DIRDEPS =
.if ${_debug_reldir} && ${_qm} != ${_m}
diff --git a/mk/doc.mk b/mk/doc.mk
index b6ebd8ad3d3e..06dd517473ca 100644
--- a/mk/doc.mk
+++ b/mk/doc.mk
@@ -1,7 +1,7 @@
-# $Id: doc.mk,v 1.7 2019/06/09 16:22:08 sjg Exp $
+# $Id: doc.mk,v 1.8 2021/12/08 05:56:50 sjg Exp $
.if !target(__${.PARSEFILE}__)
-__${.PARSEFILE}__:
+__${.PARSEFILE}__: .NOTMAIN
.include <init.mk>
diff --git a/mk/dpadd.mk b/mk/dpadd.mk
index aef12528f163..07528f9e926c 100644
--- a/mk/dpadd.mk
+++ b/mk/dpadd.mk
@@ -1,4 +1,4 @@
-# $Id: dpadd.mk,v 1.29 2021/04/20 02:30:44 sjg Exp $
+# $Id: dpadd.mk,v 1.30 2021/12/08 05:56:50 sjg Exp $
#
# @(#) Copyright (c) 2004, Simon J. Gerraty
#
@@ -77,7 +77,7 @@
#
.if !target(__${.PARSEFILE}__)
-__${.PARSEFILE}__:
+__${.PARSEFILE}__: .NOTMAIN
# sometimes we play games with .CURDIR etc
# _* hold the original values of .*
diff --git a/mk/final.mk b/mk/final.mk
index e7285ee9a5c1..3670dfc67a55 100644
--- a/mk/final.mk
+++ b/mk/final.mk
@@ -1,7 +1,7 @@
-# $Id: final.mk,v 1.9 2018/01/24 22:57:11 sjg Exp $
+# $Id: final.mk,v 1.10 2021/12/08 05:56:50 sjg Exp $
.if !target(__${.PARSEFILE}__)
-__${.PARSEFILE}__:
+__${.PARSEFILE}__: .NOTMAIN
# provide a hook for folk who want to do scary stuff
.-include <${.CURDIR:H}/Makefile-final.inc>
diff --git a/mk/init.mk b/mk/init.mk
index 8f6f8f2fbaf4..356c8501367e 100644
--- a/mk/init.mk
+++ b/mk/init.mk
@@ -1,4 +1,4 @@
-# $Id: init.mk,v 1.25 2020/11/27 17:59:46 sjg Exp $
+# $Id: init.mk,v 1.26 2021/12/08 05:56:50 sjg Exp $
#
# @(#) Copyright (c) 2002, Simon J. Gerraty
#
@@ -14,7 +14,7 @@
#
.if !target(__${.PARSEFILE}__)
-__${.PARSEFILE}__:
+__${.PARSEFILE}__: .NOTMAIN
.if ${MAKE_VERSION:U0} > 20100408
_this_mk_dir := ${.PARSEDIR:tA}
diff --git a/mk/install-mk b/mk/install-mk
index 96c35b1052ec..21d00ae919a5 100755
--- a/mk/install-mk
+++ b/mk/install-mk
@@ -55,7 +55,7 @@
# Simon J. Gerraty <sjg@crufty.net>
# RCSid:
-# $Id: install-mk,v 1.196 2021/06/19 15:30:41 sjg Exp $
+# $Id: install-mk,v 1.206 2021/12/11 18:57:41 sjg Exp $
#
# @(#) Copyright (c) 1994 Simon J. Gerraty
#
@@ -70,7 +70,7 @@
# sjg@crufty.net
#
-MK_VERSION=20210616
+MK_VERSION=20211212
OWNER=
GROUP=
MODE=444
diff --git a/mk/java.mk b/mk/java.mk
index e2149e7089a7..3a4e7911e536 100644
--- a/mk/java.mk
+++ b/mk/java.mk
@@ -1,6 +1,6 @@
#
# RCSid:
-# $Id: java.mk,v 1.15 2020/08/19 17:51:53 sjg Exp $
+# $Id: java.mk,v 1.16 2021/12/08 05:56:50 sjg Exp $
# @(#) Copyright (c) 1998-2001, Simon J. Gerraty
#
@@ -16,7 +16,7 @@
#
.if !target(__${.PARSEFILE}__)
-__${.PARSEFILE}__:
+__${.PARSEFILE}__: .NOTMAIN
.include <init.mk>
diff --git a/mk/ldorder.mk b/mk/ldorder.mk
index 3d44df5874fe..5ae54385993e 100644
--- a/mk/ldorder.mk
+++ b/mk/ldorder.mk
@@ -1,4 +1,4 @@
-# $Id: ldorder.mk,v 1.25 2018/04/24 23:50:26 sjg Exp $
+# $Id: ldorder.mk,v 1.26 2021/12/08 05:56:50 sjg Exp $
#
# @(#) Copyright (c) 2015, Simon J. Gerraty
#
@@ -130,7 +130,7 @@ ${_ldorder}: ${_ldorders}
# it can also add to CFLAGS etc.
.for __inc in ${LDORDER_LIBS:S,$,.${LDORDER_INC},}
.if !target(__${__inc}__)
-__${__inc}__:
+__${__inc}__: .NOTMAIN
# make sure this is reset
LDORDER_LIBS =
_ldorders =
diff --git a/mk/lib.mk b/mk/lib.mk
index c3979414ec49..259107458ae9 100644
--- a/mk/lib.mk
+++ b/mk/lib.mk
@@ -1,7 +1,7 @@
-# $Id: lib.mk,v 1.71 2020/08/19 17:51:53 sjg Exp $
+# $Id: lib.mk,v 1.73 2021/12/08 05:56:50 sjg Exp $
.if !target(__${.PARSEFILE}__)
-__${.PARSEFILE}__:
+__${.PARSEFILE}__: .NOTMAIN
.include <init.mk>
@@ -170,7 +170,7 @@ LD_solib= lib${LIB}_pic.a
.elif ${TARGET_OSNAME} == "Linux"
SHLIB_LD = ${CC}
# this is ambiguous of course
-LD_shared=-shared -Wl,"-soname lib${LIB}.so.${SHLIB_MAJOR}"
+LD_shared=-shared -Wl,-soname,lib${LIB}.so.${SHLIB_MAJOR}
LD_solib= -Wl,--whole-archive lib${LIB}_pic.a -Wl,--no-whole-archive
.if ${COMPILER_TYPE} == "gcc"
# Linux uses GNU ld, which is a multi-pass linker
diff --git a/mk/man.mk b/mk/man.mk
index 391b08afe491..ce4380fedc55 100644
--- a/mk/man.mk
+++ b/mk/man.mk
@@ -1,9 +1,12 @@
-# $Id: man.mk,v 1.20 2012/12/13 01:51:01 sjg Exp $
+# $Id: man.mk,v 1.25 2021/10/31 03:03:14 sjg Exp $
.if !target(__${.PARSEFILE}__)
-__${.PARSEFILE}__:
+__${.PARSEFILE}__: .NOTMAIN
+
+OPTIONS_DEFAULT_NO += CMT2DOC
.include <init.mk>
+.include <options.mk>
# unlike bsd.man.mk we handle 3 approaches
# 1. install unformated nroff (default)
@@ -21,45 +24,38 @@ NROFF?= nroff
MANDIR?= /usr/share/man
MANDOC?= man
-.SUFFIXES: .1 .2 .3 .4 .5 .6 .7 .8 .9 .cat1 .cat2 .cat3 .cat4 .cat5 .cat6 \
- .cat7 .cat8 .cat9
+MAN_SUFFIXES?= .1 .2 .3 .4 .5 .6 .7 .8 .9
+.SUFFIXES: ${MAN_SUFFIXES}
+.if ${MANTARGET} == "cat"
+.SUFFIXES: ${MAN_SUFFIXES:S,.,.cat,}
+.endif
-.9.cat9 .8.cat8 .7.cat7 .6.cat6 .5.cat5 .4.cat4 .3.cat3 .2.cat2 .1.cat1:
+${MAN_SUFFIXES:@s@$s${s:S,.,.cat,}@}:
@echo "${NROFF} -${MANDOC} ${.IMPSRC} > ${.TARGET:T}"
- @${NROFF} -${MANDOC} ${.IMPSRC} > ${.TARGET:T} || ( rm -f ${.TARGET:T} ; false )
+ @${NROFF} -${MANDOC} ${.IMPSRC} > ${.TARGET:T}.new && \
+ mv ${.TARGET:T}.new ${.TARGET:T}
.if defined(MAN) && !empty(MAN)
-# we use cmt2doc.pl to extract manpages from source
-# this is triggered by the setting of EXTRACT_MAN or MAN being set but
-# not existsing.
-
-.if !exists(${MAN:[1]}) && !target(${MAN:[1]})
-.if defined(EXTRACT_MAN) && ${EXTRACT_MAN} == "no"
-MAN=
-.else
-.if exists(/usr/local/share/bin/cmt2doc.pl)
-CMT2DOC?= cmt2doc.pl
+.if ${MK_CMT2DOC} == "yes"
+# use cmt2doc.py to extract manpages from source
+CMT2DOC?= cmt2doc.py
CMT2DOC_OPTS?= ${CMT2DOC_ORGOPT} -pmS${.TARGET:E}
-.endif
-.ifdef CMT2DOC
-.c.8 .c.5 .c.3 .c.4 .c.1 \
- .cc.8 .cc.5 .cc.3 .cc.4 .cc.1 \
- .h.8 .h.5 .h.3 .h.4 .h.1 \
- .sh.8 .sh.5 .sh.3 .sh.4 .sh.1 \
- .pl.8 .pl.5 .pl.3 .pl.4 .pl.1:
+CMT2DOC_SUFFIXES+= .c .h .sh .pl .py
+
+.SUFFIXES: ${CMT2DOC_SUFFIXES}
+
+${CMT2DOC_SUFFIXES:@s@${MAN_SUFFIXES:@m@$s$m@}@}:
@echo "${CMT2DOC} ${.IMPSRC} > ${.TARGET:T}"
- @${CMT2DOC} ${CMT2DOC_OPTS} ${.IMPSRC} > ${.TARGET:T} || ( rm -f ${.TARGET:T} ; false )
-.else
-MAN=
-.endif
-.endif
+ @${CMT2DOC} ${CMT2DOC_OPTS} ${.IMPSRC} > ${.TARGET:T}.new && \
+ mv ${.TARGET:T}.new ${.TARGET:T}
+
.endif
_mandir=${DESTDIR}${MANDIR}/${MANTARGET}`echo $$page | sed -e 's/.*\.cat/./' -e 's/.*\.//'`
.if ${MANTARGET} == "cat"
_mfromdir?=.
-MANALL= ${MAN:S/.1$/.cat1/g:S/.2$/.cat2/g:S/.3$/.cat3/g:S/.4$/.cat4/g:S/.5$/.cat5/g:S/.6$/.cat6/g:S/.7$/.cat7/g:S/.8$/.cat8/g:S/.9$/.cat9/g}
+MANALL= ${MAN:${MAN_SUFFIXES:S,.,,:@m@S/.$m/.cat$m/@:ts:}}
.if ${MCATEXT} == ""
_minstpage=`echo $$page | sed 's/\.cat/./'`
.else
diff --git a/mk/meta.autodep.mk b/mk/meta.autodep.mk
index 5d09dbd88e81..f9ed6d305b99 100644
--- a/mk/meta.autodep.mk
+++ b/mk/meta.autodep.mk
@@ -1,4 +1,4 @@
-# $Id: meta.autodep.mk,v 1.54 2021/03/06 17:03:18 sjg Exp $
+# $Id: meta.autodep.mk,v 1.55 2021/12/13 08:12:01 sjg Exp $
#
# @(#) Copyright (c) 2010, Simon J. Gerraty
@@ -23,8 +23,12 @@ __${_this}__: .NOTMAIN
PICO?= .pico
.if defined(SRCS)
+.if ${MAKE_VERSION:U0} >= 20211212
+OBJ_EXTENSIONS += ${.SUFFIXES:M*o}
+.else
# it would be nice to be able to query .SUFFIXES
-OBJ_EXTENSIONS+= .o .po .lo ${PICO}
+OBJ_EXTENSIONS += .o .po .lo ${PICO}
+.endif
# explicit dependencies help short-circuit .SUFFIX searches
SRCS_DEP_FILTER+= N*.[hly]
@@ -163,7 +167,11 @@ _depend = .depend
# it would be nice to be able to get .SUFFIXES as ${.SUFFIXES}
# we actually only care about the .SUFFIXES of files that might be
# generated by tools like yacc.
+.if ${MAKE_VERSION:U0} >= 20211212
+DEPEND_SUFFIXES += ${.SUFFIXES:N.sh:N*[0-9aFfglopmnrSsty]}
+.else
DEPEND_SUFFIXES += .c .h .cpp .hpp .cxx .hxx .cc .hh
+.endif
.depend: .NOMETA $${.MAKE.META.CREATED} ${_this}
@echo "Updating $@: ${.OODATE:T:[1..8]}"
@egrep -i '^R .*\.(${DEPEND_SUFFIXES:tl:O:u:S,^.,,:ts|})$$' /dev/null ${.MAKE.META.FILES:T:O:u:${META_FILE_FILTER:ts:}:M*o.meta} | \
diff --git a/mk/meta.stage.mk b/mk/meta.stage.mk
index 463521b79595..1da45f4f2167 100644
--- a/mk/meta.stage.mk
+++ b/mk/meta.stage.mk
@@ -1,4 +1,4 @@
-# $Id: meta.stage.mk,v 1.61 2021/01/31 04:43:12 sjg Exp $
+# $Id: meta.stage.mk,v 1.64 2021/12/08 05:56:50 sjg Exp $
#
# @(#) Copyright (c) 2011-2017, Simon J. Gerraty
#
@@ -66,7 +66,7 @@ GENDIRDEPS_FILTER += Nnot-empty-is-important \
LN_CP_SCRIPT = LnCp() { \
rm -f $$2 2> /dev/null; \
{ [ -z "$$mode" ] && ${LN:Uln} $$1 $$2 2> /dev/null; } || \
- cp -p $$1 $$2; }
+ cp -p $$1 $$2 2> /dev/null || cp $$1 $$2; }
# a staging conflict should cause an error
# a warning is handy when bootstapping different options.
@@ -264,7 +264,8 @@ CLEANFILES += ${STAGE_AS_SETS:@s@stage*$s@}
# sometimes things need to be renamed as they are staged
# each ${file} will be staged as ${STAGE_AS_${file:T}}
# one could achieve the same with SYMLINKS
-# stage_as_and_symlink makes the original name a symlink to the new name
+# stage_as_and_symlink makes the original name (or ${STAGE_LINK_AS_${name}})
+# a symlink to the new name
# it is the same as using stage_as and stage_symlinks but ensures
# both operations happen together
.for s in ${STAGE_AS_SETS:O:u}
@@ -294,7 +295,7 @@ STAGE_AS_AND_SYMLINK.$s ?= ${.ALLSRC:N.dirdep:Nstage_*}
stage_as_and_symlink: stage_as_and_symlink.$s
stage_as_and_symlink.$s: .dirdep
@${STAGE_AS_SCRIPT}; StageAs ${FLAGS.$@} ${STAGE_FILES_DIR.$s:U${STAGE_DIR.$s}:${STAGE_DIR_FILTER}} ${STAGE_AS_AND_SYMLINK.$s:O:@f@$f ${STAGE_AS_${f:tA}:U${STAGE_AS_${f:T}:U${f:T}}}@}
- @${STAGE_LINKS_SCRIPT}; StageLinks -s ${STAGE_FILES_DIR.$s:U${STAGE_DIR.$s}:${STAGE_DIR_FILTER}} ${STAGE_AS_AND_SYMLINK.$s:O:@f@${STAGE_AS_${f:tA}:U${STAGE_AS_${f:T}:U${f:T}}} $f@}
+ @${STAGE_LINKS_SCRIPT}; StageLinks -s ${STAGE_FILES_DIR.$s:U${STAGE_DIR.$s}:${STAGE_DIR_FILTER}} ${STAGE_AS_AND_SYMLINK.$s:O:@f@${STAGE_AS_${f:tA}:U${STAGE_AS_${f:T}:U${f:T}}} ${STAGE_LINK_AS_${f}:U$f}@}
@touch $@
.endif
.endif
@@ -306,7 +307,7 @@ CLEANFILES += ${STAGE_TARGETS} stage_incs stage_includes
# this lot also only makes sense the first time...
.if !target(__${.PARSEFILE}__)
-__${.PARSEFILE}__:
+__${.PARSEFILE}__: .NOTMAIN
# stage_*links usually needs to follow any others.
# for non-jobs mode the order here matters
diff --git a/mk/meta.sys.mk b/mk/meta.sys.mk
index 77b4893a8785..7cc802e2f2fe 100644
--- a/mk/meta.sys.mk
+++ b/mk/meta.sys.mk
@@ -1,7 +1,7 @@
-# $Id: meta.sys.mk,v 1.38 2020/08/19 17:51:53 sjg Exp $
+# $Id: meta.sys.mk,v 1.42 2021/12/13 05:50:55 sjg Exp $
#
-# @(#) Copyright (c) 2010-2020, Simon J. Gerraty
+# @(#) Copyright (c) 2010-2021, Simon J. Gerraty
#
# This file is provided in the hope that it will
# be of use. There is absolutely NO WARRANTY.
@@ -30,21 +30,31 @@ SYS_MK_DIR := ${_PARSEDIR}
.endif
META_MODE += meta verbose
+.if ${MAKE_VERSION:U0} > 20130323 && empty(.MAKE.PATH_FILEMON)
+# we do not support filemon
+META_MODE += nofilemon
+MKDEP_MK ?= auto.dep.mk
+.endif
+
.MAKE.MODE ?= ${META_MODE}
-.if ${.MAKE.LEVEL} == 0
+_filemon := ${.MAKE.PATH_FILEMON:U/dev/filemon}
+
+.if empty(UPDATE_DEPENDFILE)
_make_mode := ${.MAKE.MODE} ${META_MODE}
.if ${_make_mode:M*read*} != "" || ${_make_mode:M*nofilemon*} != ""
# tell everyone we are not updating Makefile.depend*
UPDATE_DEPENDFILE = NO
.export UPDATE_DEPENDFILE
.endif
-.if ${UPDATE_DEPENDFILE:Uyes:tl} == "no" && !exists(/dev/filemon)
+.if ${_filemon:T:Mfilemon} == "filemon"
+.if ${UPDATE_DEPENDFILE:Uyes:tl} == "no" && !exists(${_filemon})
# we should not get upset
META_MODE += nofilemon
.export META_MODE
.endif
.endif
+.endif
.if !defined(NO_SILENT)
.if ${MAKE_VERSION} > 20110818
@@ -106,7 +116,7 @@ _metaError: .NOMETA .NOTMAIN
# Are we, after all, in meta mode?
.if ${.MAKE.MODE:Uno:Mmeta*} != ""
-MKDEP_MK = meta.autodep.mk
+MKDEP_MK ?= meta.autodep.mk
.if ${.MAKE.MAKEFILES:M*sys.dependfile.mk} == ""
# this does all the smarts of setting .MAKE.DEPENDFILE
@@ -140,12 +150,13 @@ META_NOECHO= :
.warning Setting UPDATE_DEPENDFILE=NO due to -k
UPDATE_DEPENDFILE= NO
.export UPDATE_DEPENDFILE
-.elif !exists(/dev/filemon)
-.error ${.newline}ERROR: The filemon module (/dev/filemon) is not loaded.
+.elif ${_filemon:T} == "filemon" && !exists(${_filemon})
+.error ${.newline}ERROR: The filemon module (${_filemon}) is not loaded.
.endif
.endif
.if ${.MAKE.LEVEL} == 0
+.if ${MK_DIRDEPS_BUILD:Uyes} == "yes"
# make sure dirdeps target exists and do it first
all: dirdeps .WAIT
dirdeps:
@@ -156,6 +167,7 @@ dirdeps:
# by default dirdeps is all we want at level0
.MAIN: dirdeps
.endif
+.endif
.endif
.else
diff --git a/mk/meta2deps.py b/mk/meta2deps.py
index 193e303de3da..76ac59465b9b 100755
--- a/mk/meta2deps.py
+++ b/mk/meta2deps.py
@@ -37,7 +37,7 @@ We only pay attention to a subset of the information in the
"""
RCSid:
- $Id: meta2deps.py,v 1.38 2021/06/17 05:20:08 sjg Exp $
+ $Id: meta2deps.py,v 1.40 2021/12/13 19:32:46 sjg Exp $
Copyright (c) 2011-2020, Simon J. Gerraty
Copyright (c) 2011-2017, Juniper Networks, Inc.
@@ -165,6 +165,19 @@ def add_trims(x):
x + '/',
x]
+def target_spec_exts(target_spec):
+ """return a list of dirdep extensions that could match target_spec"""
+
+ if target_spec.find(',') < 0:
+ return ['.'+target_spec]
+ w = target_spec.split(',')
+ n = len(w)
+ e = []
+ while n > 0:
+ e.append('.'+','.join(w[0:n]))
+ n -= 1
+ return e
+
class MetaFile:
"""class to parse meta files generated by bmake."""
@@ -226,7 +239,8 @@ class MetaFile:
self.machine = conf.get('MACHINE', '')
self.machine_arch = conf.get('MACHINE_ARCH', '')
- self.target_spec = conf.get('TARGET_SPEC', '')
+ self.target_spec = conf.get('TARGET_SPEC', self.machine)
+ self.exts = target_spec_exts(self.target_spec)
self.curdir = conf.get('CURDIR')
self.reldir = conf.get('RELDIR')
self.dpdeps = conf.get('DPDEPS')
@@ -250,7 +264,7 @@ class MetaFile:
trim_list = add_trims(self.machine)
if self.machine == 'host':
trim_list += add_trims(self.host_target)
- if self.target_spec:
+ if self.target_spec != self.machine:
trim_list += add_trims(self.target_spec)
for objroot in conf.get('OBJROOTS', []):
@@ -280,6 +294,7 @@ class MetaFile:
print("srctops=", self.srctops, file=self.debug_out)
print("objroots=", self.objroots, file=self.debug_out)
print("excludes=", self.excludes, file=self.debug_out)
+ print("ext_list=", self.exts, file=self.debug_out)
self.dirdep_re = re.compile(r'([^/]+)/(.+)')
@@ -355,10 +370,10 @@ class MetaFile:
ddep = open(ddepf, 'r').readline().strip('# \n')
if self.debug > 1:
print("found %s: %s\n" % (ddepf, ddep), file=self.debug_out)
- if ddep.endswith(self.machine):
- ddep = ddep[0:-(1+len(self.machine))]
- elif self.target_spec and ddep.endswith(self.target_spec):
- ddep = ddep[0:-(1+len(self.target_spec))]
+ for e in self.exts:
+ if ddep.endswith(e):
+ ddep = ddep[0:-len(e)]
+ break
if not ddep:
# no .dirdeps, so remember that we've seen the raw input
diff --git a/mk/obj.mk b/mk/obj.mk
index 487e25a55b6c..0df5a087f972 100644
--- a/mk/obj.mk
+++ b/mk/obj.mk
@@ -1,4 +1,4 @@
-# $Id: obj.mk,v 1.16 2020/08/19 17:51:53 sjg Exp $
+# $Id: obj.mk,v 1.17 2021/12/08 05:56:50 sjg Exp $
#
# @(#) Copyright (c) 1999-2010, Simon J. Gerraty
#
@@ -14,7 +14,7 @@
#
.if !target(__${.PARSEFILE:S,bsd.,,}__)
-__${.PARSEFILE:S,bsd.,,}__:
+__${.PARSEFILE:S,bsd.,,}__: .NOTMAIN
.include <init.mk>
diff --git a/mk/options.mk b/mk/options.mk
index eb5253a6b7e8..bf78ba24f1ca 100644
--- a/mk/options.mk
+++ b/mk/options.mk
@@ -1,4 +1,4 @@
-# $Id: options.mk,v 1.13 2020/08/19 17:51:53 sjg Exp $
+# $Id: options.mk,v 1.19 2021/10/03 16:29:51 sjg Exp $
#
# @(#) Copyright (c) 2012, Simon J. Gerraty
#
@@ -26,8 +26,8 @@
# User sets WITH_* and WITHOUT_* to indicate what they want.
# We set ${OPTION_PREFIX:UMK_}* which is then all we need care about.
OPTIONS_DEFAULT_VALUES += \
- ${OPTIONS_DEFAULT_NO:O:u:S,$,/no,} \
- ${OPTIONS_DEFAULT_YES:O:u:S,$,/yes,}
+ ${OPTIONS_DEFAULT_NO:U:O:u:S,$,/no,} \
+ ${OPTIONS_DEFAULT_YES:U:O:u:S,$,/yes,}
OPTION_PREFIX ?= MK_
@@ -36,6 +36,10 @@ OPTION_PREFIX ?= MK_
# DOMINANT_* is set to "yes"
# Otherwise WITH_* and WITHOUT_* override the default.
.for o in ${OPTIONS_DEFAULT_VALUES:M*/*}
+.if defined(WITH_${o:H}) && ${WITH_${o:H}} == "no"
+# a common miss-use - point out correct usage
+.warning use WITHOUT_${o:H}=1 not WITH_${o:H}=no
+.endif
.if defined(NO_${o:H}) || defined(NO${o:H})
# we cannot do it
${OPTION_PREFIX}${o:H} ?= no
@@ -77,6 +81,32 @@ ${OPTION_PREFIX}${o:H} ?= no
${OPTION_PREFIX}${o:H} ?= ${${OPTION_PREFIX}${o:T}}
.endif
.endfor
-.undef OPTIONS_DEFAULT_VALUES
+
+# allow displaying/describing set options
+.set_options := ${.set_options} \
+ ${OPTIONS_DEFAULT_VALUES:H:N.} \
+ ${OPTIONS_DEFAULT_DEPENDENT:U:H:N.} \
+
+# this can be used in .info as well as target below
+OPTIONS_SHOW ?= ${.set_options:O:u:@o@${OPTION_PREFIX}$o=${${OPTION_PREFIX}$o}@}
+# prefix for variables describing options
+OPTION_DESCRIPTION_PREFIX ?= DESCRIPTION_
+OPTION_DESCRIPTION_SEPARATOR ?= ==
+
+OPTIONS_DESCRIBE ?= ${.set_options:O:u:@o@${OPTION_PREFIX}$o=${${OPTION_PREFIX}$o}${${OPTION_DESCRIPTION_PREFIX}$o:S,^, ${OPTION_DESCRIPTION_SEPARATOR} ,1}${.newline}@}
+
+.if !commands(show-options)
+show-options: .NOTMAIN .PHONY
+ @echo; echo "${OPTIONS_SHOW:ts\n}"; echo
+.endif
+
+.if !commands(describe-options)
+describe-options: .NOTMAIN .PHONY
+ @echo; echo "${OPTIONS_DESCRIBE}"; echo
+.endif
+
+# we expect to be included more than once
+.undef OPTIONS_DEFAULT_DEPENDENT
.undef OPTIONS_DEFAULT_NO
+.undef OPTIONS_DEFAULT_VALUES
.undef OPTIONS_DEFAULT_YES
diff --git a/mk/own.mk b/mk/own.mk
index 63322297420b..7b0d74caba8a 100644
--- a/mk/own.mk
+++ b/mk/own.mk
@@ -1,7 +1,7 @@
-# $Id: own.mk,v 1.42 2020/11/27 18:00:08 sjg Exp $
+# $Id: own.mk,v 1.44 2021/12/08 05:56:50 sjg Exp $
.if !target(__${.PARSEFILE}__)
-__${.PARSEFILE}__:
+__${.PARSEFILE}__: .NOTMAIN
.if !target(__init.mk__)
.include "init.mk"
@@ -257,11 +257,13 @@ MK_NLS= no
.if ${MK_META_MODE:Uno} == "yes"
# should all be set by sys.mk if not default
TARGET_SPEC_VARS ?= MACHINE
+.if ${MAKE_VERSION} >= 20120325
.if ${TARGET_SPEC_VARS:[#]} > 1
TARGET_SPEC_VARS_REV := ${TARGET_SPEC_VARS:[-1..1]}
.else
TARGET_SPEC_VARS_REV = ${TARGET_SPEC_VARS}
.endif
+.endif
.if ${MK_STAGING} == "yes"
STAGE_ROOT?= ${OBJROOT}/stage
STAGE_OBJTOP?= ${STAGE_ROOT}/${TARGET_SPEC_VARS_REV:ts/}
diff --git a/mk/prlist.mk b/mk/prlist.mk
index aca1fde25555..3308a9522c89 100644
--- a/mk/prlist.mk
+++ b/mk/prlist.mk
@@ -1,4 +1,4 @@
-# $Id: prlist.mk,v 1.4 2020/08/19 17:51:53 sjg Exp $
+# $Id: prlist.mk,v 1.5 2021/12/08 05:56:50 sjg Exp $
#
# @(#) Copyright (c) 2006, Simon J. Gerraty
#
@@ -14,7 +14,7 @@
#
.if !target(__${.PARSEFILE}__)
-__${.PARSEFILE}__:
+__${.PARSEFILE}__: .NOTMAIN
# this needs to be included after all the lists it will process
# are defined - which is why it is a separate file.
diff --git a/mk/prog.mk b/mk/prog.mk
index ea48837d5544..902b221f7fe5 100644
--- a/mk/prog.mk
+++ b/mk/prog.mk
@@ -1,7 +1,7 @@
-# $Id: prog.mk,v 1.36 2020/08/19 17:51:53 sjg Exp $
+# $Id: prog.mk,v 1.37 2021/12/08 05:56:50 sjg Exp $
.if !target(__${.PARSEFILE}__)
-__${.PARSEFILE}__:
+__${.PARSEFILE}__: .NOTMAIN
.include <init.mk>
diff --git a/mk/stage-install.sh b/mk/stage-install.sh
index 674652d1d482..97d50871f95c 100755
--- a/mk/stage-install.sh
+++ b/mk/stage-install.sh
@@ -37,7 +37,7 @@
#
# RCSid:
-# $Id: stage-install.sh,v 1.9 2020/08/28 01:04:13 sjg Exp $
+# $Id: stage-install.sh,v 1.10 2021/11/17 07:06:31 sjg Exp $
#
# @(#) Copyright (c) 2013-2020, Simon J. Gerraty
#
@@ -117,8 +117,12 @@ StageDirdep() {
t=$1
if [ -s $t.dirdep ]; then
cmp -s $_DIRDEP $t.dirdep && return
- echo "ERROR: $t installed by `cat $t.dirdep` not `cat $_DIRDEP`" >&2
- exit 1
+ case "${STAGE_CONFLICT:-error}" in
+ [Ee]*) STAGE_CONFLICT=ERROR action=exit;;
+ *) STAGE_CONFLICT=WARNING action=: ;;
+ esac
+ echo "$STAGE_CONFLICT: $t installed by `cat $t.dirdep` not `cat $_DIRDEP`" >&2
+ $action 1
fi
LnCp $_DIRDEP $t.dirdep || exit 1
}
diff --git a/mk/sys.mk b/mk/sys.mk
index 7ef8f724ef10..e39d5ac74548 100644
--- a/mk/sys.mk
+++ b/mk/sys.mk
@@ -1,4 +1,4 @@
-# $Id: sys.mk,v 1.52 2020/12/22 20:44:24 sjg Exp $
+# $Id: sys.mk,v 1.53 2021/12/13 05:50:13 sjg Exp $
#
# @(#) Copyright (c) 2003-2009, Simon J. Gerraty
#
@@ -81,11 +81,10 @@ OPTIONS_DEFAULT_DEPENDENT += \
.-include <options.mk>
-.if ${MK_DIRDEPS_BUILD:Uno} == "yes"
-MK_META_MODE = yes
+# :Uno incase options.mk not installed
+.if ${MK_META_MODE:Uno} == "yes"
.-include <meta.sys.mk>
-.elif ${MK_META_MODE:Uno} == "yes"
-.MAKE.MODE = meta verbose ${META_MODE}
+.MAKE.MODE ?= meta verbose {META_MODE}
.endif
# make sure we have a harmless value
.MAKE.MODE ?= normal
diff --git a/mk/sys.vars.mk b/mk/sys.vars.mk
index 592cbdc644dc..391967b18a2b 100644
--- a/mk/sys.vars.mk
+++ b/mk/sys.vars.mk
@@ -1,4 +1,4 @@
-# $Id: sys.vars.mk,v 1.6 2020/10/28 20:50:04 sjg Exp $
+# $Id: sys.vars.mk,v 1.7 2021/12/08 05:56:50 sjg Exp $
#
# @(#) Copyright (c) 2003-2009, Simon J. Gerraty
#
@@ -19,7 +19,7 @@
#
# _this ?= ${.PARSEFILE}
# .if !target(__${_this}__)
-# __${_this}__:
+# __${_this}__: .NOTMAIN
#
.if ${MAKE_VERSION:U0} > 20100408
_this = ${.PARSEDIR:tA}/${.PARSEFILE}
diff --git a/mk/sys/SCO_SV.mk b/mk/sys/SCO_SV.mk
new file mode 100644
index 000000000000..9bf4b7c587c5
--- /dev/null
+++ b/mk/sys/SCO_SV.mk
@@ -0,0 +1,13 @@
+# $Id: SCO_SV.mk,v 1.1 2021/10/13 16:45:52 sjg Exp $
+
+OS = SCO_SV
+OS_DEF_FLAG := -D${OS}
+
+CC ?= gcc
+CXX ?= g++
+DEV_TOOLS_PREFIX ?= /usr/xdev
+FC ?= gfortran
+INSTALL ?= /usr/gnu/bin/install
+LD ?= gcc
+
+.include "UnixWare.mk"
diff --git a/mk/sys/UnixWare.mk b/mk/sys/UnixWare.mk
index 272d3e65c2d8..9e0216399ade 100644
--- a/mk/sys/UnixWare.mk
+++ b/mk/sys/UnixWare.mk
@@ -1,16 +1,18 @@
-# $Id: UnixWare.mk,v 1.7 2020/08/19 17:51:53 sjg Exp $
+# $Id: UnixWare.mk,v 1.8 2021/10/13 16:45:52 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
OS ?= UnixWare
+OS_DEF_FLAG ?= -DUNIXWARE
unix ?= We run ${OS}.
ROOT_GROUP ?= root
+DEV_TOOLS_PREFIX ?= /usr/local
-# can't fine one anywhere, so just stop the dependency
+# can't find one anywhere, so just stop the dependency
LIBCRT0 ?= /dev/null
-PATH ?=/usr/sbin:/usr/bin:/usr/ccs/bin:/usr/ccs/lib:/usr/ucb:/usr/local/bin
+PATH ?= /usr/sbin:/usr/bin:/usr/ccs/bin:/usr/ccs/lib:/usr/ucb:${DEV_TOOLS_PREFIX}/bin
.SUFFIXES: .out .a .ln .o .c ${CXX_SUFFIXES} .F .f .r .y .l .s .S .cl .p .h .sh .m4
@@ -32,8 +34,8 @@ COMPILE.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} -c
LINK.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
# at least gcc 2.95 on UnixWare has no internal macro to identify the system
-.if exists(/usr/local/bin/gcc)
-CC ?= gcc -pipe -DUNIXWARE
+.if exists(${DEV_TOOLS_PREFIX}/bin/gcc)
+CC ?= gcc -pipe ${OS_DEF_FLAG}
DBG ?= -O -g
STATIC ?= -static
.else
@@ -45,8 +47,8 @@ CFLAGS ?= ${DBG}
COMPILE.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
-.if exists(/usr/local/bin/g++)
-CXX ?= g++ -DUNIXWARE
+.if exists(${DEV_TOOLS_PREFIX}/bin/g++)
+CXX ?= g++ ${OS_DEF_FLAG}
.else
CXX ?= c++ # XXX: don't know about UDK compilers
.endif
@@ -54,13 +56,17 @@ CXXFLAGS ?= ${CFLAGS}
COMPILE.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
+.if exists(${DEV_TOOLS_PREFIX}/bin/cpp)
+CPP ?= cpp
+.else
CPP ?= /usr/ccs/lib/cpp
+.endif
.if defined(DESTDIR)
CPPFLAGS+= -nostdinc -idirafter ${DESTDIR}/usr/include
.endif
MK_DEP ?= mkdeps.sh -N
-.if exists(/usr/local/bin/g77)
+.if exists(${DEV_TOOLS_PREFIX}/bin/g77)
FC ?= g77
.else
FC ?= f77 # XXX: don't know about UDK compilers
@@ -125,7 +131,7 @@ SIZE ?= size
TSORT ?= tsort
-.if exists(/usr/local/bin/bison)
+.if exists(${DEV_TOOLS_PREFIX}/bin/bison)
YACC ?= bison -y
.else
YACC ?= yacc