freebsd-src/boot-strap

504 lines
11 KiB
Plaintext
Raw Normal View History

:
# NAME:
# boot-strap
#
# SYNOPSIS:
# boot-strap ["options"]
# boot-strap --prefix=/opt --install
# boot-strap --prefix=$HOME --install-host-target -DWITH_PROG_VERSION
# boot-strap ["options"] op=build
# boot-strap ["options"] op=install
#
# DESCRIPTION:
# This script is used to configure/build bmake it builds for
# each host-target in a different subdir to keep the src clean.
# There is no requirement for an existing make(1).
#
# On successful completion if no '--install' flag is given,
# it echos a command to do installation.
#
# The variable "op" defaults to 'all', and is affected by
# '--install' flag as above.
# Other values include:
#
# configure
# Just run 'configure'
#
# build
# If 'configure' has not been done, do it, then
# run the build script, and finally 'test'.
#
# install
# If 'build' has not been done, do it, 'test' then
# install.
#
# clean
# attempt to clean up
#
# test
# run the unit-tests. Done automatically after 'build'
# and before 'install'.
#
# The above are leveraged by a trivial makefile for the benefit
# of those that have './configure; make; make install' baked
# into them.
#
# Options:
#
# -c "rc"
# Pick up settings from "rc".
# We look for '.bmake-boot-strap.rc' before processing
# options (unless SKIP_RC is set in environment).
#
# --share "share_dir"
# Where to put man pages and mk files.
# If $prefix ends in $HOST_TARGET, and $prefix/../share
# exits, the default will be that rather than $prefix/share.
#
# --mksrc "mksrc"
# Indicate where the mk files can be found.
# Default is $Mydir/mk
#
# --install
# If build and test work, run bmake install.
# BINDIR=$prefix/bin
# SHAREDIR=$prefix/share
#
# --install-host-target
# As for '--install' but BINDIR=$prefix/$HOST_TARGET/bin
# This is useful when $prefix/ is shared by multiple
# machines.
#
# Flags relevant when installing:
#
# -DWITHOUT_INSTALL_MK
# Skip installing mk files.
# By default they will be installed to $prefix/share/mk
#
# -DWITH_PROG_VERSION
# Install 'bmake' as 'bmake-$MAKE_VERSION'
# A symlink will be made as 'bmake' unless
# -DWITHOUT_PROG_LINK is set.
#
# Possibly useful configure_args:
#
Import bmake-20240108 Interesting/relevant changes since bmake-20230909 * VERSION (_MAKE_VERSION): 20240106 Merge with NetBSD make, pick up o fix duplicate progname when reporting an unknown target o unit tests for Cmd_Exec using temp file * VERSION (_MAKE_VERSION): 20240105 Merge with NetBSD make, pick up o main.c: Cmd_Exec write cmd to a file if too big avoid blowing commandline/env limits * VERSION (_MAKE_VERSION): 20240101 o util.c: flesh out more of strftime * configure.in: add --with-bmake-strftime it is not a full implementation but enough to pass all the unit-tests. * parse.c: LoadFile do not append \n to empty buffer. * VERSION (_MAKE_VERSION): 20231230 Merge with NetBSD make, pick up o simplify memory allocation for string buffers o fix declared types of list nodes o suff.c: clean up freeing of suffixes o var.c: simplify debug message for the ':@var@...@' modifier clean up variable handling * VERSION (_MAKE_VERSION): 20231226 Merge with NetBSD make, pick up o compat.c: ensure make's output is correctly ordered with that of the target when not going to a tty o main.c: check for shellPath whether to call Shell_Init() * VERSION (_MAKE_VERSION): 20231224 Merge with NetBSD make, pick up o compat.c: check for shellPath whether to call Shell_Init() tweak the unit test to detect the bug thus fixed. o make.1: do not claim .SHELL is only used by jobs mode. * VERSION (_MAKE_VERSION): 20231220 Merge with NetBSD make, pick up o str.c: speed up pattern matching in the ':M' modifier o var.c: fix confusing debug logging when deleting a variable use consistent debug messages style when ignoring variables * VERSION (_MAKE_VERSION): 20231210 Merge with NetBSD make, pick up o var.c: avoid segfault on empty :C match expression explain in debug log why variable assignment is ignored. * VERSION (_MAKE_VERSION): 20231208 Merge with NetBSD make, pick up o var.c: ensure fromCmd is set correctly for variables set on command line. * VERSION (_MAKE_VERSION): 20231124 Merge with NetBSD make, pick up o main.c: cleanup processing of -j fix lint warning about strchr o var.c: more accurate error message for invalid ':mtime' argument cleanup :[...] modifier avoid reading beyond substring when comparing o unit-tests cover all cases of :mtime, test and explain exporting of variables o cleanup comments * bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses $FreeBSD$ tag, so avoid adding it. mk/ChangeLog since bmake-20230909 * dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same limits on command line length, so skip export of lists to env. * jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating point. This keeps JOB_MAX numeric incase another makefile does comparisons. * gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-14 01:16:25 +00:00
# --without-makefile
# do not generate 'makefile'.
#
# 'makefile' is used to enable the classic
# './configure; make; make install' dance, but on
# systems with case insensitive filesystems it can lead
# to infinite recursion.
#
# It is disabled by default on Darwin, and Cygwin.
#
# --without-meta
# disable use of meta mode.
#
Import bmake-20240108 Interesting/relevant changes since bmake-20230909 * VERSION (_MAKE_VERSION): 20240106 Merge with NetBSD make, pick up o fix duplicate progname when reporting an unknown target o unit tests for Cmd_Exec using temp file * VERSION (_MAKE_VERSION): 20240105 Merge with NetBSD make, pick up o main.c: Cmd_Exec write cmd to a file if too big avoid blowing commandline/env limits * VERSION (_MAKE_VERSION): 20240101 o util.c: flesh out more of strftime * configure.in: add --with-bmake-strftime it is not a full implementation but enough to pass all the unit-tests. * parse.c: LoadFile do not append \n to empty buffer. * VERSION (_MAKE_VERSION): 20231230 Merge with NetBSD make, pick up o simplify memory allocation for string buffers o fix declared types of list nodes o suff.c: clean up freeing of suffixes o var.c: simplify debug message for the ':@var@...@' modifier clean up variable handling * VERSION (_MAKE_VERSION): 20231226 Merge with NetBSD make, pick up o compat.c: ensure make's output is correctly ordered with that of the target when not going to a tty o main.c: check for shellPath whether to call Shell_Init() * VERSION (_MAKE_VERSION): 20231224 Merge with NetBSD make, pick up o compat.c: check for shellPath whether to call Shell_Init() tweak the unit test to detect the bug thus fixed. o make.1: do not claim .SHELL is only used by jobs mode. * VERSION (_MAKE_VERSION): 20231220 Merge with NetBSD make, pick up o str.c: speed up pattern matching in the ':M' modifier o var.c: fix confusing debug logging when deleting a variable use consistent debug messages style when ignoring variables * VERSION (_MAKE_VERSION): 20231210 Merge with NetBSD make, pick up o var.c: avoid segfault on empty :C match expression explain in debug log why variable assignment is ignored. * VERSION (_MAKE_VERSION): 20231208 Merge with NetBSD make, pick up o var.c: ensure fromCmd is set correctly for variables set on command line. * VERSION (_MAKE_VERSION): 20231124 Merge with NetBSD make, pick up o main.c: cleanup processing of -j fix lint warning about strchr o var.c: more accurate error message for invalid ':mtime' argument cleanup :[...] modifier avoid reading beyond substring when comparing o unit-tests cover all cases of :mtime, test and explain exporting of variables o cleanup comments * bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses $FreeBSD$ tag, so avoid adding it. mk/ChangeLog since bmake-20230909 * dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same limits on command line length, so skip export of lists to env. * jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating point. This keeps JOB_MAX numeric incase another makefile does comparisons. * gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-14 01:16:25 +00:00
# Even without filemon(9) meta mode is very useful
# both for debugging build and improving reliability of
# update builds.
#
# --without-filemon
# disable use of filemon(9) which is currently only
# available for NetBSD and FreeBSD.
#
Import bmake-20200517 Changes since 20181221 are mostly portability related hence the large gap in versions imported. There are however some bug fixes, and a rework of filemon handling. In NetBSD make/filemon/filemon_ktrace.c allows use of fktrace and elimination of filemon(4) which has not had the TLC it needs. FreeBSD filemon(4) is in much better shape, so bmake/filemon/filemon_dev.c allows use of that, with a bit less overhead than the ktrace model. Summary of changes from ChangeLog o str.c: empty string does not match % pattern plus unit-test changes o var.c: import handling of old sysV style modifier using '%' o str.c: refactor brk_string o meta.c: meta_oodate, CHECK_VALID_META is too aggressive for CMD a blank command is perfectly valid. o meta.c: meta_oodate, check for corrupted meta file earlier and more often. * meta.c: meta_compat_parent check for USE_FILEMON patch from Soeren Tempel o meta.c: fix compat mode, need to call meta_job_output() o job.c: extra fds for meta mode not needed if using filemon_dev o meta.c: avoid passing NULL to filemon_*() when meta_needed() returns FALSE. o filemon/filemon_{dev,ktrace}.c: allow selection of filemon implementation. filemon_dev.c uses the kernel module while filemon_ktrace.c leverages the fktrace api available in NetBSD. filemon_ktrace.c can hopefully form the basis for adding support for other tracing mechanisms such as strace on Linux. o meta.c: when target is out-of-date per normal make rules record value of .OODATE in meta file. o parse.c: don't pass NULL to realpath(3) some versions cannot handle it. o parse.c: ParseDoDependency: free paths rather than assert plus more unit-tests
2020-05-20 19:34:48 +00:00
# --with-filemon=ktrace
# on NetBSD or others with fktrace(2), use ktrace
# version of filemon.
#
# --with-filemon="path/to/filemon.h"
# enables use of filemon(9) by meta mode.
#
# --with-machine="machine"
# set "machine" to override that determined by
# machine.sh
#
# --with-force-machine="machine"
# force "machine" even if uname(3) provides a value.
#
# --with-machine_arch="machine_arch"
# set "machine_arch" to override that determined by
# machine.sh
#
# --with-force_machine_arch="machine_arch"
# force "machine_arch" to override that determined by
# machine.sh
#
# --with-default-sys-path="syspath"
# set an explicit default "syspath" which is where bmake
# will look for sys.mk and friends.
#
# AUTHOR:
# Simon J. Gerraty <sjg@crufty.net>
# RCSid:
Import bmake-20240309 Intersting/relevant changes since bmake-20240108 ChangeLog since bmake-20240108 2024-03-10 Simon J Gerraty <sjg@beast.crufty.net> * boot-strap: tests can take a long time; use a cookie to skip them if bmake has not been updated since tests last ran successfully. * Makefile: Cygwin handles MANTARGET man * unit-tests/Makefile: set BROKEN_TESTS for Cygwin 2024-03-09 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240309 Merge with NetBSD make, pick up o set .ERROR_EXIT to the exit status of .ERROR_TARGET this allows a .ERROR target to ignore the case of .ERROR_EXIT==6 which just means that the build actually failed somewhere else. 2024-03-04 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240303 * var.c: on IRIX we need both inttypes.h and stdint.h 2024-03-01 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240301 Merge with NetBSD make, pick up o export variables with value from target scope when appropriate. 2024-02-12 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240212 Merge with NetBSD make, pick up o remove unneeded conditional-compilation toggles INCLUDES, LIBRARIES, POSIX, SYSVINCLUDE, SYSVVARSUB, GMAKEEXPORT NO_REGEX and SUNSHCMD * configure.in: add check for regex.h * var.c: replace use of NO_REGEX with HAVE_REGEX_H 2024-02-04 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240204 Merge with NetBSD make, pick up o var.c: fix some lint (-dL) mode parsing issues 2024-02-02 Simon J Gerraty <sjg@beast.crufty.net> * VERSION: (_MAKE_VERSION): 20240202 Merge with NetBSD make, pick up o make.1: note that arg to :D and :U can be empty o var.c: $$ is not a parse error when .MAKE.SAVE_DOLLARS=no mk/ChangeLog since bmake-20240108 2024-03-09 Simon J Gerraty <sjg@beast.crufty.net> * install-mk (MK_VERSION): 20240309 * meta.sys.mk: _metaError: if .ERROR_EXIT == 6, we do not want to save the .ERROR_META_FILE 2024-02-20 Simon J Gerraty <sjg@beast.crufty.net> * install-mk (MK_VERSION): 20240220 * sys.dirdeps.mk, dirdeps-targets.mk, init.mk: do not set .MAIN: dirdeps in sys.dirdeps.mk dirdeps-targets.mk will do that for top-level builds and init.mk will do it for others. This allows a Makefile which has no need of 'dirdeps' to set .MAIN for itself and "just work". 2024-02-18 Simon J Gerraty <sjg@beast.crufty.net> * bsd.*.mk: for makefiles that get a bsd. symlink, use _this in multiple inclusion tags since .PARSEFILE will not DTRT when such a makefile is included directly by Makefile and automatically (without bsd. prefix). Since we cannot guarantee that our sys.mk will be used, we provide a default _this in each makefile that gets a bsd. prefix such that the value is the same regardless of bsd. prefix. * subdir.mk: drop the !target guard on $SUBDIR_TARGETS 2024-02-12 Simon J Gerraty <sjg@beast.crufty.net> * install-mk (MK_VERSION): 20240212 * SPDX-License-Identifier: BSD-2-Clause Add SPDX-License-Identifier to inidicate that I consider my copyright on any of these makefiles equivalent to BSD-2-Clause * autoconf.mk: allow for configure.ac as currently recommended * subdir.mk: support @auto which is replaced with each subdir that has a [Mm]akefile. * subdir.mk: include local.subdir.mk if it exists. * subdir.mk: rework to handle .WAIT 2024-02-11 Simon J Gerraty <sjg@beast.crufty.net> * subdir.mk: _SUBDIRUSE report the target we are entering subdirs for. 2024-02-10 Simon J Gerraty <sjg@beast.crufty.net> * prog.mk: treat empty SRCS the same as undefined 2024-02-02 Simon J Gerraty <sjg@beast.crufty.net> * Avoid undefined errors in lint (-dL) mode * man.mk (CMT2DOC_FLAGS): note that -mm does mdoc(7) 2024-01-28 Simon J Gerraty <sjg@beast.crufty.net> * install-mk (MK_VERSION): 20240128 * FILES: add ccm.dep.mk for C++ modules add suffixes.mk for common location for generic SUFFIX rules. * auto.dep.mk autodep.mk meta.autodep.mk: include ccm.dep.mk replace OBJ_EXTENSIONS with OBJ_SUFFIXES * autodep.mk: leverage CXX_SUFFIXES for __depsrcs and update style (spaces around = etc) * init.mk: add OBJS_SRCS_FILTER to filter SRCS when setting OBJS * meta2deps.py: handle multiple ./ embedded in path better.
2024-03-14 02:14:41 +00:00
# $Id: boot-strap,v 1.61 2024/03/10 17:51:10 sjg Exp $
#
# @(#) Copyright (c) 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
# the above copyright notice and this notice are
# left intact.
#
# Please send copies of changes and bug-fixes to:
# sjg@crufty.net
#
Mydir=`dirname $0`
. "$Mydir/os.sh"
case "$Mydir" in
/*) ;;
*) Mydir=`cd "$Mydir" && 'pwd'`;;
esac
Usage() {
[ "$1" ] && echo "ERROR: $@" >&2
echo "Usage:" >&2
echo "$0 [--<configure_arg> ...][<prefix>][--install]" >&2
exit 1
}
Error() {
echo "ERROR: $@" >&2
exit 1
}
source_rc() {
rc="$1"; shift
for d in ${*:-""}
do
r="${d:+$d/}$rc"
[ -f "$r" -a -s "$r" ] || continue
echo "NOTE: reading $r"
. "$r"
break
done
}
cmd_args="$@"
2013-04-01 21:12:55 +00:00
# clear some things from the environment that we care about
unset MAKEOBJDIR MAKEOBJDIRPREFIX
Import bmake-20200517 Changes since 20181221 are mostly portability related hence the large gap in versions imported. There are however some bug fixes, and a rework of filemon handling. In NetBSD make/filemon/filemon_ktrace.c allows use of fktrace and elimination of filemon(4) which has not had the TLC it needs. FreeBSD filemon(4) is in much better shape, so bmake/filemon/filemon_dev.c allows use of that, with a bit less overhead than the ktrace model. Summary of changes from ChangeLog o str.c: empty string does not match % pattern plus unit-test changes o var.c: import handling of old sysV style modifier using '%' o str.c: refactor brk_string o meta.c: meta_oodate, CHECK_VALID_META is too aggressive for CMD a blank command is perfectly valid. o meta.c: meta_oodate, check for corrupted meta file earlier and more often. * meta.c: meta_compat_parent check for USE_FILEMON patch from Soeren Tempel o meta.c: fix compat mode, need to call meta_job_output() o job.c: extra fds for meta mode not needed if using filemon_dev o meta.c: avoid passing NULL to filemon_*() when meta_needed() returns FALSE. o filemon/filemon_{dev,ktrace}.c: allow selection of filemon implementation. filemon_dev.c uses the kernel module while filemon_ktrace.c leverages the fktrace api available in NetBSD. filemon_ktrace.c can hopefully form the basis for adding support for other tracing mechanisms such as strace on Linux. o meta.c: when target is out-of-date per normal make rules record value of .OODATE in meta file. o parse.c: don't pass NULL to realpath(3) some versions cannot handle it. o parse.c: ParseDoDependency: free paths rather than assert plus more unit-tests
2020-05-20 19:34:48 +00:00
# or that might be incompatible
unset MAKE MAKEFLAGS
2013-04-01 21:12:55 +00:00
# --install[-host-target] will set this
INSTALL_PREFIX=
# other things we pass to install step
INSTALL_ARGS=
CONFIGURE_ARGS=
MAKESYSPATH=
# pick a useful default prefix (for me at least ;-)
for prefix in /opt/$HOST_TARGET "$HOME/$HOST_TARGET" /usr/pkg /usr/local ""
do
[ -d "${prefix:-.}" ] || continue
case "$prefix" in
*/$HOST_TARGET)
p=`dirname $prefix`
if [ -d $p/share ]; then
INSTALL_BIN=$HOST_TARGET/bin
prefix=$p
fi
;;
esac
echo "NOTE: default prefix=$prefix ${INSTALL_BIN:+INSTALL_BIN=$INSTALL_BIN}"
break
done
srcdir=$Mydir
mksrc=$Mydir/mk
objdir=
quiet=:
${SKIP_RC:+:} source_rc .bmake-boot-strap.rc . "$Mydir/.." "$HOME"
get_optarg() {
expr "x$1" : "x[^=]*=\\(.*\\)"
}
here=`'pwd'`
if [ $here = $Mydir ]; then
2014-07-02 21:24:54 +00:00
# avoid pollution
OBJROOT=../
fi
op=all
BMAKE=
while :
do
case "$1" in
--) shift; break;;
--help) sed -n -e "1d;/RCSid/,\$d" -e '/^#\.[a-z]/d' -e '/^#/s,^# *,,p' $0; exit 0;;
--prefix) prefix="$2"; shift;;
--prefix=*) prefix=`get_optarg "$1"`;;
--src=*) srcdir=`get_optarg "$1"`;;
--with-mksrc=*|--mksrc=*) mksrc=`get_optarg "$1"`;;
--share=*) share_dir=`get_optarg "$1"`;;
--share) share_dir="$2"; shift;;
--with-default-sys-path=*)
2014-01-26 07:40:17 +00:00
CONFIGURE_ARGS="$1";;
--with-default-sys-path)
2014-01-26 07:40:17 +00:00
CONFIGURE_ARGS="$1 $2";;
--install) INSTALL_PREFIX=${INSTALL_PREFIX:-$prefix};;
--install-host-target)
INSTALL_PREFIX=${INSTALL_PREFIX:-$prefix}
INSTALL_BIN=$HOST_TARGET/bin;;
--install-destdir=*) INSTALL_DESTDIR=`get_optarg "$1"`;;
--install-prefix=*) INSTALL_PREFIX=`get_optarg "$1"`;;
-DWITH*) INSTALL_ARGS="$INSTALL_ARGS $1";;
-s|--src) srcdir="$2"; shift;;
-m|--mksrc) mksrc="$2"; shift;;
-o|--objdir) objdir="$2"; shift;;
-q) quiet=;;
-c) source_rc "$2"; shift;;
--*) CONFIGURE_ARGS="$CONFIGURE_ARGS $1";;
*=*) eval "$1"; export `expr "x$1" : "x\\(.[^=]*\\)=.*"`;;
*) break;;
esac
shift
done
AddConfigure() {
case " $CONFIGURE_ARGS " in
*" $1"*) ;;
*) CONFIGURE_ARGS="$CONFIGURE_ARGS $1$2";;
esac
}
GetDir() {
match="$1"
shift
fmatch="$1"
shift
for dir in $*
do
[ -d "$dir" ] || continue
case "/$dir/" in
*$match*) ;;
*) continue;;
esac
case "$fmatch" in
.) ;;
*) [ -s $dir/$fmatch ] || continue;;
esac
case "$dir/" in
*./*) cd "$dir" && 'pwd';;
/*) echo $dir;;
*) cd "$dir" && 'pwd';;
esac
break
done
}
FindHereOrAbove() {
(
_t=-s
while :
do
case "$1" in
-C) cd "$2"; shift; shift;;
-?) _t=$1; shift;;
*) break;;
esac
done
case "$1" in
/*) # we shouldn't be here
[ $_t "$1" ] && echo "$1"
return
;;
.../*) want=`echo "$1" | sed 's,^.../*,,'`;;
*) want="$1";;
esac
here=`'pwd'`
while :
do
if [ $_t "./$want" ]; then
echo "$here/$want"
return
fi
cd ..
here=`'pwd'`
case "$here" in
/) return;;
esac
done
)
}
Import bmake-20240309 Intersting/relevant changes since bmake-20240108 ChangeLog since bmake-20240108 2024-03-10 Simon J Gerraty <sjg@beast.crufty.net> * boot-strap: tests can take a long time; use a cookie to skip them if bmake has not been updated since tests last ran successfully. * Makefile: Cygwin handles MANTARGET man * unit-tests/Makefile: set BROKEN_TESTS for Cygwin 2024-03-09 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240309 Merge with NetBSD make, pick up o set .ERROR_EXIT to the exit status of .ERROR_TARGET this allows a .ERROR target to ignore the case of .ERROR_EXIT==6 which just means that the build actually failed somewhere else. 2024-03-04 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240303 * var.c: on IRIX we need both inttypes.h and stdint.h 2024-03-01 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240301 Merge with NetBSD make, pick up o export variables with value from target scope when appropriate. 2024-02-12 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240212 Merge with NetBSD make, pick up o remove unneeded conditional-compilation toggles INCLUDES, LIBRARIES, POSIX, SYSVINCLUDE, SYSVVARSUB, GMAKEEXPORT NO_REGEX and SUNSHCMD * configure.in: add check for regex.h * var.c: replace use of NO_REGEX with HAVE_REGEX_H 2024-02-04 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240204 Merge with NetBSD make, pick up o var.c: fix some lint (-dL) mode parsing issues 2024-02-02 Simon J Gerraty <sjg@beast.crufty.net> * VERSION: (_MAKE_VERSION): 20240202 Merge with NetBSD make, pick up o make.1: note that arg to :D and :U can be empty o var.c: $$ is not a parse error when .MAKE.SAVE_DOLLARS=no mk/ChangeLog since bmake-20240108 2024-03-09 Simon J Gerraty <sjg@beast.crufty.net> * install-mk (MK_VERSION): 20240309 * meta.sys.mk: _metaError: if .ERROR_EXIT == 6, we do not want to save the .ERROR_META_FILE 2024-02-20 Simon J Gerraty <sjg@beast.crufty.net> * install-mk (MK_VERSION): 20240220 * sys.dirdeps.mk, dirdeps-targets.mk, init.mk: do not set .MAIN: dirdeps in sys.dirdeps.mk dirdeps-targets.mk will do that for top-level builds and init.mk will do it for others. This allows a Makefile which has no need of 'dirdeps' to set .MAIN for itself and "just work". 2024-02-18 Simon J Gerraty <sjg@beast.crufty.net> * bsd.*.mk: for makefiles that get a bsd. symlink, use _this in multiple inclusion tags since .PARSEFILE will not DTRT when such a makefile is included directly by Makefile and automatically (without bsd. prefix). Since we cannot guarantee that our sys.mk will be used, we provide a default _this in each makefile that gets a bsd. prefix such that the value is the same regardless of bsd. prefix. * subdir.mk: drop the !target guard on $SUBDIR_TARGETS 2024-02-12 Simon J Gerraty <sjg@beast.crufty.net> * install-mk (MK_VERSION): 20240212 * SPDX-License-Identifier: BSD-2-Clause Add SPDX-License-Identifier to inidicate that I consider my copyright on any of these makefiles equivalent to BSD-2-Clause * autoconf.mk: allow for configure.ac as currently recommended * subdir.mk: support @auto which is replaced with each subdir that has a [Mm]akefile. * subdir.mk: include local.subdir.mk if it exists. * subdir.mk: rework to handle .WAIT 2024-02-11 Simon J Gerraty <sjg@beast.crufty.net> * subdir.mk: _SUBDIRUSE report the target we are entering subdirs for. 2024-02-10 Simon J Gerraty <sjg@beast.crufty.net> * prog.mk: treat empty SRCS the same as undefined 2024-02-02 Simon J Gerraty <sjg@beast.crufty.net> * Avoid undefined errors in lint (-dL) mode * man.mk (CMT2DOC_FLAGS): note that -mm does mdoc(7) 2024-01-28 Simon J Gerraty <sjg@beast.crufty.net> * install-mk (MK_VERSION): 20240128 * FILES: add ccm.dep.mk for C++ modules add suffixes.mk for common location for generic SUFFIX rules. * auto.dep.mk autodep.mk meta.autodep.mk: include ccm.dep.mk replace OBJ_EXTENSIONS with OBJ_SUFFIXES * autodep.mk: leverage CXX_SUFFIXES for __depsrcs and update style (spaces around = etc) * init.mk: add OBJS_SRCS_FILTER to filter SRCS when setting OBJS * meta2deps.py: handle multiple ./ embedded in path better.
2024-03-14 02:14:41 +00:00
# is $1 newer than $2 ...
is_newer() {
case `'ls' -1td "$@" 2> /dev/null | head -1` in
$1) return 0;;
esac
return 1
}
# is $1 missing from $2 (or PATH) ?
no_path() {
eval "__p=\$${2:-PATH}"
case ":$__p:" in *:"$1":*) return 1;; *) return 0;; esac
}
# if $1 exists and is not in path, append it
add_path () {
case "$1" in
-?) t=$1; shift;;
*) t=-d;;
esac
case "$2,$1" in
MAKESYSPATH,.../*) ;;
*) [ $t ${1:-.} ] || return;;
esac
no_path $* && eval ${2:-PATH}="$__p${__p:+:}$1"
}
srcdir=`GetDir /bmake make-bootstrap.sh.in "$srcdir" "$2" "$Mydir" ./bmake* "$Mydir"/../bmake*`
[ -d "${srcdir:-/dev/null}" ] || Usage
case "$mksrc" in
2014-01-26 07:40:17 +00:00
none|-) # we ignore this now
mksrc=$Mydir/mk
;;
.../*) # find here or above
mksrc=`FindHereOrAbove -C "$Mydir" -s "$mksrc/sys.mk"`
# that found a file
mksrc=`dirname $mksrc`
;;
*) # guess we want mksrc...
mksrc=`GetDir /mk sys.mk "$mksrc" "$3" ./mk* "$srcdir"/mk* "$srcdir"/../mk*`
[ -d "${mksrc:-/dev/null}" ] || Usage "Use '-m none' to build without mksrc"
;;
esac
# Ok, get to work...
objdir="${objdir:-$OBJROOT$HOST_TARGET}"
[ -d "$objdir" ] || mkdir -p "$objdir"
[ -d "$objdir" ] || mkdir "$objdir"
cd "$objdir" || exit 1
# make it absolute
objdir=`'pwd'`
ShareDir() {
case "/$1" in
/) [ -d /share ] || return;;
*/$HOST_TARGET)
if [ -d "$1/../share" ]; then
echo `dirname "$1"`/share
return
fi
;;
esac
echo $1/share
}
# make it easy to force prefix to use $HOST_TARGET
: looking at "$prefix"
case "$prefix" in
*/host?target) prefix=`echo "$prefix" | sed "s,host.target,${HOST_TARGET},"`;;
esac
share_dir="${share_dir:-`ShareDir $prefix`}"
AddConfigure --prefix= "$prefix"
case "$CONFIGURE_ARGS" in
*--with-*-sys-path*) ;; # skip
*) [ "$share_dir" ] && AddConfigure --with-default-sys-path= "$share_dir/mk";;
esac
if [ "$mksrc" ]; then
AddConfigure --with-mksrc= "$mksrc"
# not all cc's support this
CFLAGS_MF= CFLAGS_MD=
export CFLAGS_MF CFLAGS_MD
fi
# this makes it easy to run the bmake we just built
# the :tA dance is needed because 'pwd' and even /bin/pwd
# may not give the same result as realpath().
Bmake() {
(
cd $Mydir &&
MAKESYSPATH=$mksrc SRCTOP=$Mydir OBJTOP=$objdir \
MAKEOBJDIR='${.CURDIR:S,${SRCTOP:tA},${OBJTOP:tA},}' \
${BMAKE:-$objdir/bmake} -f $Mydir/Makefile "$@"
)
}
op_configure() {
$srcdir/configure $CONFIGURE_ARGS || exit 1
}
op_build() {
[ -s make-bootstrap.sh ] || op_configure
chmod 755 make-bootstrap.sh || exit 1
./make-bootstrap.sh || exit 1
case "$op" in
Import bmake-20240309 Intersting/relevant changes since bmake-20240108 ChangeLog since bmake-20240108 2024-03-10 Simon J Gerraty <sjg@beast.crufty.net> * boot-strap: tests can take a long time; use a cookie to skip them if bmake has not been updated since tests last ran successfully. * Makefile: Cygwin handles MANTARGET man * unit-tests/Makefile: set BROKEN_TESTS for Cygwin 2024-03-09 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240309 Merge with NetBSD make, pick up o set .ERROR_EXIT to the exit status of .ERROR_TARGET this allows a .ERROR target to ignore the case of .ERROR_EXIT==6 which just means that the build actually failed somewhere else. 2024-03-04 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240303 * var.c: on IRIX we need both inttypes.h and stdint.h 2024-03-01 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240301 Merge with NetBSD make, pick up o export variables with value from target scope when appropriate. 2024-02-12 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240212 Merge with NetBSD make, pick up o remove unneeded conditional-compilation toggles INCLUDES, LIBRARIES, POSIX, SYSVINCLUDE, SYSVVARSUB, GMAKEEXPORT NO_REGEX and SUNSHCMD * configure.in: add check for regex.h * var.c: replace use of NO_REGEX with HAVE_REGEX_H 2024-02-04 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240204 Merge with NetBSD make, pick up o var.c: fix some lint (-dL) mode parsing issues 2024-02-02 Simon J Gerraty <sjg@beast.crufty.net> * VERSION: (_MAKE_VERSION): 20240202 Merge with NetBSD make, pick up o make.1: note that arg to :D and :U can be empty o var.c: $$ is not a parse error when .MAKE.SAVE_DOLLARS=no mk/ChangeLog since bmake-20240108 2024-03-09 Simon J Gerraty <sjg@beast.crufty.net> * install-mk (MK_VERSION): 20240309 * meta.sys.mk: _metaError: if .ERROR_EXIT == 6, we do not want to save the .ERROR_META_FILE 2024-02-20 Simon J Gerraty <sjg@beast.crufty.net> * install-mk (MK_VERSION): 20240220 * sys.dirdeps.mk, dirdeps-targets.mk, init.mk: do not set .MAIN: dirdeps in sys.dirdeps.mk dirdeps-targets.mk will do that for top-level builds and init.mk will do it for others. This allows a Makefile which has no need of 'dirdeps' to set .MAIN for itself and "just work". 2024-02-18 Simon J Gerraty <sjg@beast.crufty.net> * bsd.*.mk: for makefiles that get a bsd. symlink, use _this in multiple inclusion tags since .PARSEFILE will not DTRT when such a makefile is included directly by Makefile and automatically (without bsd. prefix). Since we cannot guarantee that our sys.mk will be used, we provide a default _this in each makefile that gets a bsd. prefix such that the value is the same regardless of bsd. prefix. * subdir.mk: drop the !target guard on $SUBDIR_TARGETS 2024-02-12 Simon J Gerraty <sjg@beast.crufty.net> * install-mk (MK_VERSION): 20240212 * SPDX-License-Identifier: BSD-2-Clause Add SPDX-License-Identifier to inidicate that I consider my copyright on any of these makefiles equivalent to BSD-2-Clause * autoconf.mk: allow for configure.ac as currently recommended * subdir.mk: support @auto which is replaced with each subdir that has a [Mm]akefile. * subdir.mk: include local.subdir.mk if it exists. * subdir.mk: rework to handle .WAIT 2024-02-11 Simon J Gerraty <sjg@beast.crufty.net> * subdir.mk: _SUBDIRUSE report the target we are entering subdirs for. 2024-02-10 Simon J Gerraty <sjg@beast.crufty.net> * prog.mk: treat empty SRCS the same as undefined 2024-02-02 Simon J Gerraty <sjg@beast.crufty.net> * Avoid undefined errors in lint (-dL) mode * man.mk (CMT2DOC_FLAGS): note that -mm does mdoc(7) 2024-01-28 Simon J Gerraty <sjg@beast.crufty.net> * install-mk (MK_VERSION): 20240128 * FILES: add ccm.dep.mk for C++ modules add suffixes.mk for common location for generic SUFFIX rules. * auto.dep.mk autodep.mk meta.autodep.mk: include ccm.dep.mk replace OBJ_EXTENSIONS with OBJ_SUFFIXES * autodep.mk: leverage CXX_SUFFIXES for __depsrcs and update style (spaces around = etc) * init.mk: add OBJS_SRCS_FILTER to filter SRCS when setting OBJS * meta2deps.py: handle multiple ./ embedded in path better.
2024-03-14 02:14:41 +00:00
build) rm -f tested; op_test;;
esac
}
op_test() {
[ -x bmake ] || op_build
Import bmake-20240309 Intersting/relevant changes since bmake-20240108 ChangeLog since bmake-20240108 2024-03-10 Simon J Gerraty <sjg@beast.crufty.net> * boot-strap: tests can take a long time; use a cookie to skip them if bmake has not been updated since tests last ran successfully. * Makefile: Cygwin handles MANTARGET man * unit-tests/Makefile: set BROKEN_TESTS for Cygwin 2024-03-09 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240309 Merge with NetBSD make, pick up o set .ERROR_EXIT to the exit status of .ERROR_TARGET this allows a .ERROR target to ignore the case of .ERROR_EXIT==6 which just means that the build actually failed somewhere else. 2024-03-04 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240303 * var.c: on IRIX we need both inttypes.h and stdint.h 2024-03-01 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240301 Merge with NetBSD make, pick up o export variables with value from target scope when appropriate. 2024-02-12 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240212 Merge with NetBSD make, pick up o remove unneeded conditional-compilation toggles INCLUDES, LIBRARIES, POSIX, SYSVINCLUDE, SYSVVARSUB, GMAKEEXPORT NO_REGEX and SUNSHCMD * configure.in: add check for regex.h * var.c: replace use of NO_REGEX with HAVE_REGEX_H 2024-02-04 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240204 Merge with NetBSD make, pick up o var.c: fix some lint (-dL) mode parsing issues 2024-02-02 Simon J Gerraty <sjg@beast.crufty.net> * VERSION: (_MAKE_VERSION): 20240202 Merge with NetBSD make, pick up o make.1: note that arg to :D and :U can be empty o var.c: $$ is not a parse error when .MAKE.SAVE_DOLLARS=no mk/ChangeLog since bmake-20240108 2024-03-09 Simon J Gerraty <sjg@beast.crufty.net> * install-mk (MK_VERSION): 20240309 * meta.sys.mk: _metaError: if .ERROR_EXIT == 6, we do not want to save the .ERROR_META_FILE 2024-02-20 Simon J Gerraty <sjg@beast.crufty.net> * install-mk (MK_VERSION): 20240220 * sys.dirdeps.mk, dirdeps-targets.mk, init.mk: do not set .MAIN: dirdeps in sys.dirdeps.mk dirdeps-targets.mk will do that for top-level builds and init.mk will do it for others. This allows a Makefile which has no need of 'dirdeps' to set .MAIN for itself and "just work". 2024-02-18 Simon J Gerraty <sjg@beast.crufty.net> * bsd.*.mk: for makefiles that get a bsd. symlink, use _this in multiple inclusion tags since .PARSEFILE will not DTRT when such a makefile is included directly by Makefile and automatically (without bsd. prefix). Since we cannot guarantee that our sys.mk will be used, we provide a default _this in each makefile that gets a bsd. prefix such that the value is the same regardless of bsd. prefix. * subdir.mk: drop the !target guard on $SUBDIR_TARGETS 2024-02-12 Simon J Gerraty <sjg@beast.crufty.net> * install-mk (MK_VERSION): 20240212 * SPDX-License-Identifier: BSD-2-Clause Add SPDX-License-Identifier to inidicate that I consider my copyright on any of these makefiles equivalent to BSD-2-Clause * autoconf.mk: allow for configure.ac as currently recommended * subdir.mk: support @auto which is replaced with each subdir that has a [Mm]akefile. * subdir.mk: include local.subdir.mk if it exists. * subdir.mk: rework to handle .WAIT 2024-02-11 Simon J Gerraty <sjg@beast.crufty.net> * subdir.mk: _SUBDIRUSE report the target we are entering subdirs for. 2024-02-10 Simon J Gerraty <sjg@beast.crufty.net> * prog.mk: treat empty SRCS the same as undefined 2024-02-02 Simon J Gerraty <sjg@beast.crufty.net> * Avoid undefined errors in lint (-dL) mode * man.mk (CMT2DOC_FLAGS): note that -mm does mdoc(7) 2024-01-28 Simon J Gerraty <sjg@beast.crufty.net> * install-mk (MK_VERSION): 20240128 * FILES: add ccm.dep.mk for C++ modules add suffixes.mk for common location for generic SUFFIX rules. * auto.dep.mk autodep.mk meta.autodep.mk: include ccm.dep.mk replace OBJ_EXTENSIONS with OBJ_SUFFIXES * autodep.mk: leverage CXX_SUFFIXES for __depsrcs and update style (spaces around = etc) * init.mk: add OBJS_SRCS_FILTER to filter SRCS when setting OBJS * meta2deps.py: handle multiple ./ embedded in path better.
2024-03-14 02:14:41 +00:00
case "$op" in
test) ;;
*) is_newer bmake tested || return;;
esac
Import bmake-20230909 Update import.sh to generate below ChangeLog since bmake-20230622 2023-09-09 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20230909 Merge with NetBSD make, pick up o main.c: allow -j to compute a multiple of ncpu If _SC_NPROCESSORS_ONLN is supported; and -j arg is a floating point number or ends in 'C' compute .MAKE.JOBS as a multiple of _SC_NPROCESSORS_ONLN .MAKE.JOBS.C will be "yes" if -jC is supported 2023-08-20 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20230820 Merge with NetBSD make, pick up o make.1: note that :localtime is better for %s o parse.c: improve error messages for invalid input. o var.c: fix for %s:L:gmtime - set TZ=UTC and use localtime to get correct result, it is still better to use %s:L:localtime. 2023-08-18 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20230818 Merge with NetBSD make, pick up o meta.c: meta_ignore - check raw path against metaIgnorePaths to potentially skip call to realpath. o var.c: be strict when parsing the argument of the ':mtime' modifier o unit-tests/varmod-mtime.mk: document why '${%s:L:localtime}' should be used to get an equivalent value to time(3). 2023-08-16 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20230816 Merge with NetBSD make, pick up o cond.c: clean up multiple-inclusion guards 2023-07-25 Simon J Gerraty <sjg@beast.crufty.net> * unit-tests/Makefile: addd varmod-localtime to BROKEN_TESTS if configure cannot work out how to control TZ. Remove varmod-localtime from BROKEN_TESTS for IRIX* 2023-07-24 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20230723 * configure.in: fix the test for wether TZ=Europe/Berlin works. Depending on the time of year, if run between 22:00 and 00:00 UTC the check in configure would fail incorrectly. Take the day into account as well. 2023-07-18 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20230711 Merge with NetBSD make, pick up o make.1: clean up wording, clarify scope of '!' in conditions 2023-07-15 Simon J Gerraty <sjg@beast.crufty.net> * make-bootstrap.sh.in: set prefix If configure is run using ksh we get unexpanded ${prefix} in DEFAULT_SYS_PATH, by ensuring prefix is set we should still get correct result. 2023-07-13 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20230711 bump version for IRIX tweaks * make.h: undef OP_NONE if defined * unit-tests/Makefile: set BROKEN_TESTS for IRIX * configure.in: override INSTALL on IRIX 2023-06-27 Simon J Gerraty <sjg@beast.crufty.net> * boot-strap op_test: ensure we set TEST_MAKE as we want it. mk/ChangeLog since bmake-20230622 2023-09-09 Simon J Gerraty <sjg@beast.crufty.net> * jobs.mk (JOB_MAX): use -jC if we can we actually use JOB_MAX_C which defaults to 1.33C 2023-08-18 Simon J Gerraty <sjg@beast.crufty.net> * now_utc: %s only works with :localtime 2023-07-14 Simon J Gerraty <sjg@beast.crufty.net> * install-sh: ignore -c as claimed and only insist on a directory for destination when more than one file to copy. * sys.mk: when looking for SYS_OS_MK try ${.MAKE.OS} and ${.MAKE.OS:S,64,,} early (so we find sys/IRIX.mk for IRIX64) 2023-07-13 Simon J Gerraty <sjg@beast.crufty.net> * install-mk (MK_VERSION): 20230711 * sys.mk: set SYS_MK and INSTALL_SH for systems with incompatible install(1) * sys/IRIX.mk: when setting ROOT_GROUP only match the first :0: set INSTALL to install-sh rather than pathname that may not exist (yet). 2023-07-07 Simon J Gerraty <sjg@beast.crufty.net> * dirdeps.mk: pass DIRDEP_TARGETS to DIRDEP_MAKE normally this is empty - for the default target, but there are use-cases where we might set it to something else. 2023-07-04 Simon J Gerraty <sjg@beast.crufty.net> * install-mk (MK_VERSION): 20230704 * dirdeps.mk: apply DEBUG_DIRDEPS_LIST_FILTER to lists we output when DEBUG_DIRDEPS is in effect. Eg. DEBUG_DIRDEPS_LIST_FILTER=ts\n can greatly improve readability.
2023-09-17 17:03:11 +00:00
Bmake test TEST_MAKE=$objdir/bmake "$@" || exit 1
Import bmake-20240309 Intersting/relevant changes since bmake-20240108 ChangeLog since bmake-20240108 2024-03-10 Simon J Gerraty <sjg@beast.crufty.net> * boot-strap: tests can take a long time; use a cookie to skip them if bmake has not been updated since tests last ran successfully. * Makefile: Cygwin handles MANTARGET man * unit-tests/Makefile: set BROKEN_TESTS for Cygwin 2024-03-09 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240309 Merge with NetBSD make, pick up o set .ERROR_EXIT to the exit status of .ERROR_TARGET this allows a .ERROR target to ignore the case of .ERROR_EXIT==6 which just means that the build actually failed somewhere else. 2024-03-04 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240303 * var.c: on IRIX we need both inttypes.h and stdint.h 2024-03-01 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240301 Merge with NetBSD make, pick up o export variables with value from target scope when appropriate. 2024-02-12 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240212 Merge with NetBSD make, pick up o remove unneeded conditional-compilation toggles INCLUDES, LIBRARIES, POSIX, SYSVINCLUDE, SYSVVARSUB, GMAKEEXPORT NO_REGEX and SUNSHCMD * configure.in: add check for regex.h * var.c: replace use of NO_REGEX with HAVE_REGEX_H 2024-02-04 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240204 Merge with NetBSD make, pick up o var.c: fix some lint (-dL) mode parsing issues 2024-02-02 Simon J Gerraty <sjg@beast.crufty.net> * VERSION: (_MAKE_VERSION): 20240202 Merge with NetBSD make, pick up o make.1: note that arg to :D and :U can be empty o var.c: $$ is not a parse error when .MAKE.SAVE_DOLLARS=no mk/ChangeLog since bmake-20240108 2024-03-09 Simon J Gerraty <sjg@beast.crufty.net> * install-mk (MK_VERSION): 20240309 * meta.sys.mk: _metaError: if .ERROR_EXIT == 6, we do not want to save the .ERROR_META_FILE 2024-02-20 Simon J Gerraty <sjg@beast.crufty.net> * install-mk (MK_VERSION): 20240220 * sys.dirdeps.mk, dirdeps-targets.mk, init.mk: do not set .MAIN: dirdeps in sys.dirdeps.mk dirdeps-targets.mk will do that for top-level builds and init.mk will do it for others. This allows a Makefile which has no need of 'dirdeps' to set .MAIN for itself and "just work". 2024-02-18 Simon J Gerraty <sjg@beast.crufty.net> * bsd.*.mk: for makefiles that get a bsd. symlink, use _this in multiple inclusion tags since .PARSEFILE will not DTRT when such a makefile is included directly by Makefile and automatically (without bsd. prefix). Since we cannot guarantee that our sys.mk will be used, we provide a default _this in each makefile that gets a bsd. prefix such that the value is the same regardless of bsd. prefix. * subdir.mk: drop the !target guard on $SUBDIR_TARGETS 2024-02-12 Simon J Gerraty <sjg@beast.crufty.net> * install-mk (MK_VERSION): 20240212 * SPDX-License-Identifier: BSD-2-Clause Add SPDX-License-Identifier to inidicate that I consider my copyright on any of these makefiles equivalent to BSD-2-Clause * autoconf.mk: allow for configure.ac as currently recommended * subdir.mk: support @auto which is replaced with each subdir that has a [Mm]akefile. * subdir.mk: include local.subdir.mk if it exists. * subdir.mk: rework to handle .WAIT 2024-02-11 Simon J Gerraty <sjg@beast.crufty.net> * subdir.mk: _SUBDIRUSE report the target we are entering subdirs for. 2024-02-10 Simon J Gerraty <sjg@beast.crufty.net> * prog.mk: treat empty SRCS the same as undefined 2024-02-02 Simon J Gerraty <sjg@beast.crufty.net> * Avoid undefined errors in lint (-dL) mode * man.mk (CMT2DOC_FLAGS): note that -mm does mdoc(7) 2024-01-28 Simon J Gerraty <sjg@beast.crufty.net> * install-mk (MK_VERSION): 20240128 * FILES: add ccm.dep.mk for C++ modules add suffixes.mk for common location for generic SUFFIX rules. * auto.dep.mk autodep.mk meta.autodep.mk: include ccm.dep.mk replace OBJ_EXTENSIONS with OBJ_SUFFIXES * autodep.mk: leverage CXX_SUFFIXES for __depsrcs and update style (spaces around = etc) * init.mk: add OBJS_SRCS_FILTER to filter SRCS when setting OBJS * meta2deps.py: handle multiple ./ embedded in path better.
2024-03-14 02:14:41 +00:00
touch tested
}
op_clean() {
if [ -x bmake ]; then
ln bmake bmake$$
BMAKE=$objdir/bmake$$ Bmake clean
rm -f bmake$$
elif [ $objdir != $srcdir ]; then
rm -rf *
fi
}
op_install() {
op_test
case "$INSTALL_PREFIX,$INSTALL_BIN,$prefix" in
,$HOST_TARGET/bin,*/$HOST_TARGET)
INSTALL_PREFIX=`dirname $prefix`
;;
esac
INSTALL_PREFIX=${INSTALL_PREFIX:-$prefix}
Bmake install prefix=$INSTALL_PREFIX BINDIR=$INSTALL_PREFIX/${INSTALL_BIN:-bin} ${INSTALL_DESTDIR:+DESTDIR=$INSTALL_DESTDIR} $INSTALL_ARGS || exit 1
}
op_all() {
rm -f make-bootstrap.sh bmake *.o
if [ -n "$INSTALL_PREFIX" ]; then
op_install
else
op_test
MAKE_VERSION=`sed -n '/^_MAKE_VERSION/ { s,.*= *,,;p; }' $srcdir/Makefile`
cat << EOM
You can install by running:
$0 $cmd_args op=install
Use --install-prefix=/something to install somewhere other than $prefix
Use --install-destdir=/somewhere to set DESTDIR during install
Use --install-host-target to use INSTALL_BIN=$HOST_TARGET/bin
Use -DWITH_PROG_VERSION to install as bmake-$MAKE_VERSION
Use -DWITHOUT_PROG_LINK to suppress bmake -> bmake-$MAKE_VERSION symlink
Use -DWITHOUT_INSTALL_MK to skip installing files to $prefix/share/mk
EOM
fi
cat << EOM
Note: bmake.cat1 contains ANSI escape sequences.
You may need the -r or -R option to more/less to view it correctly.
EOM
}
op_$op "$@"
exit 0