mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-13 10:02:38 +00:00
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.
This commit is contained in:
parent
7a05a7153a
commit
a6b892e1c7
57
ChangeLog
57
ChangeLog
@ -1,3 +1,60 @@
|
||||
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
|
||||
|
||||
2024-01-08 Simon J Gerraty <sjg@beast.crufty.net>
|
||||
|
||||
* VERSION (_MAKE_VERSION): 20240108
|
||||
|
7
Makefile
7
Makefile
@ -1,4 +1,4 @@
|
||||
# $Id: Makefile,v 1.125 2023/05/17 00:15:46 sjg Exp $
|
||||
# $Id: Makefile,v 1.126 2024/03/10 17:46:44 sjg Exp $
|
||||
|
||||
PROG= bmake
|
||||
|
||||
@ -90,9 +90,8 @@ OS := ${.MAKE.OS:U${uname -s:L:sh}}
|
||||
# are we 4.4BSD ?
|
||||
isBSD44:=${BSD44_LIST:M${OS}}
|
||||
|
||||
.if ${isBSD44} == "" && ${OS:NDarwin:NLinux} != ""
|
||||
MANTARGET= cat
|
||||
INSTALL?=${srcdir}/install-sh
|
||||
.if ${isBSD44} == "" && ${OS:NCYGWIN*:NDarwin:NLinux} != ""
|
||||
MANTARGET?= cat
|
||||
.if ${MACHINE} == "sun386"
|
||||
# even I don't have one of these anymore :-)
|
||||
CFLAGS+= -DPORTAR
|
||||
|
2
VERSION
2
VERSION
@ -1,2 +1,2 @@
|
||||
# keep this compatible with sh and make
|
||||
_MAKE_VERSION=20240108
|
||||
_MAKE_VERSION=20240309
|
||||
|
8
arch.c
8
arch.c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: arch.c,v 1.214 2023/11/19 22:50:11 rillig Exp $ */
|
||||
/* $NetBSD: arch.c,v 1.215 2024/02/07 06:43:02 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -147,7 +147,7 @@ struct ar_hdr {
|
||||
#include "dir.h"
|
||||
|
||||
/* "@(#)arch.c 8.2 (Berkeley) 1/2/94" */
|
||||
MAKE_RCSID("$NetBSD: arch.c,v 1.214 2023/11/19 22:50:11 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: arch.c,v 1.215 2024/02/07 06:43:02 rillig Exp $");
|
||||
|
||||
typedef struct List ArchList;
|
||||
typedef struct ListNode ArchListNode;
|
||||
@ -1026,11 +1026,7 @@ Arch_FindLib(GNode *gn, SearchPath *path)
|
||||
gn->path = Dir_FindFile(libName, path);
|
||||
free(libName);
|
||||
|
||||
#ifdef LIBRARIES
|
||||
Var_Set(gn, TARGET, gn->name);
|
||||
#else
|
||||
Var_Set(gn, TARGET, GNode_Path(gn));
|
||||
#endif
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
|
22
bmake.1
22
bmake.1
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: make.1,v 1.372 2023/12/24 16:48:30 sjg Exp $
|
||||
.\" $NetBSD: make.1,v 1.375 2024/03/10 02:53:37 sjg Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1990, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@ -29,7 +29,7 @@
|
||||
.\"
|
||||
.\" from: @(#)make.1 8.4 (Berkeley) 3/19/94
|
||||
.\"
|
||||
.Dd December 24, 2023
|
||||
.Dd March 9, 2024
|
||||
.Dt BMAKE 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -879,6 +879,9 @@ Is used in error handling, see
|
||||
.It Va .ERROR_CWD
|
||||
Is used in error handling, see
|
||||
.Va MAKE_PRINT_VAR_ON_ERROR .
|
||||
.It Va .ERROR_EXIT
|
||||
Is used in error handling, see
|
||||
.Va MAKE_PRINT_VAR_ON_ERROR .
|
||||
.It Va .ERROR_META_FILE
|
||||
Is used in error handling in
|
||||
.Dq meta
|
||||
@ -1185,6 +1188,8 @@ When
|
||||
stops due to an error, it sets
|
||||
.Sq Va .ERROR_TARGET
|
||||
to the name of the target that failed,
|
||||
.Sq Va .ERROR_EXIT
|
||||
to the exit status of the failed target,
|
||||
.Sq Va .ERROR_CMD
|
||||
to the commands of the failed target,
|
||||
and in
|
||||
@ -1775,8 +1780,9 @@ modifier which is later referenced using the index values from
|
||||
.Ql :range .
|
||||
.It Cm \&:U\| Ns Ar newval
|
||||
If the variable is undefined,
|
||||
the optional
|
||||
.Ar newval
|
||||
is the value.
|
||||
(which may be empty) is the value.
|
||||
If the variable is defined, the existing value is returned.
|
||||
This is another ODE make feature.
|
||||
It is handy for setting per-target CFLAGS for instance:
|
||||
@ -1786,7 +1792,7 @@ If a value is only required if the variable is undefined, use:
|
||||
.It Cm \&:D\| Ns Ar newval
|
||||
If the variable is defined,
|
||||
.Ar newval
|
||||
is the value.
|
||||
(which may be empty) is the value.
|
||||
.It Cm \&:L
|
||||
The name of the variable is the value.
|
||||
.It Cm \&:P
|
||||
@ -2405,11 +2411,9 @@ Any command lines attached to this target are executed after everything
|
||||
else is done successfully.
|
||||
.It Ic .ERROR
|
||||
Any command lines attached to this target are executed when another target fails.
|
||||
The
|
||||
.Va .ERROR_TARGET
|
||||
variable is set to the target that failed.
|
||||
See also
|
||||
.Va MAKE_PRINT_VAR_ON_ERROR .
|
||||
See
|
||||
.Va MAKE_PRINT_VAR_ON_ERROR
|
||||
for the variables that will be set.
|
||||
.It Ic .IGNORE
|
||||
Mark each of the sources with the
|
||||
.Ic .IGNORE
|
||||
|
2564
bmake.cat1
2564
bmake.cat1
File diff suppressed because it is too large
Load Diff
Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 55 KiB |
17
boot-strap
17
boot-strap
@ -133,7 +133,7 @@
|
||||
# Simon J. Gerraty <sjg@crufty.net>
|
||||
|
||||
# RCSid:
|
||||
# $Id: boot-strap,v 1.59 2023/11/26 18:19:43 sjg Exp $
|
||||
# $Id: boot-strap,v 1.61 2024/03/10 17:51:10 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2001 Simon J. Gerraty
|
||||
#
|
||||
@ -329,6 +329,14 @@ FindHereOrAbove() {
|
||||
)
|
||||
}
|
||||
|
||||
# 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}"
|
||||
@ -428,13 +436,18 @@ op_build() {
|
||||
chmod 755 make-bootstrap.sh || exit 1
|
||||
./make-bootstrap.sh || exit 1
|
||||
case "$op" in
|
||||
build) op_test;;
|
||||
build) rm -f tested; op_test;;
|
||||
esac
|
||||
}
|
||||
|
||||
op_test() {
|
||||
[ -x bmake ] || op_build
|
||||
case "$op" in
|
||||
test) ;;
|
||||
*) is_newer bmake tested || return;;
|
||||
esac
|
||||
Bmake test TEST_MAKE=$objdir/bmake "$@" || exit 1
|
||||
touch tested
|
||||
}
|
||||
|
||||
op_clean() {
|
||||
|
8
compat.c
8
compat.c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: compat.c,v 1.252 2024/01/05 23:22:06 rillig Exp $ */
|
||||
/* $NetBSD: compat.c,v 1.254 2024/03/10 02:53:37 sjg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
@ -94,7 +94,7 @@
|
||||
#include "pathnames.h"
|
||||
|
||||
/* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */
|
||||
MAKE_RCSID("$NetBSD: compat.c,v 1.252 2024/01/05 23:22:06 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: compat.c,v 1.254 2024/03/10 02:53:37 sjg Exp $");
|
||||
|
||||
static GNode *curTarg = NULL;
|
||||
static pid_t compatChild;
|
||||
@ -329,7 +329,7 @@ Compat_RunCommand(const char *cmdp, GNode *gn, StringListNode *ln)
|
||||
meta_compat_start();
|
||||
#endif
|
||||
|
||||
Var_ReexportVars();
|
||||
Var_ReexportVars(gn);
|
||||
|
||||
compatChild = cpid = vfork();
|
||||
if (cpid < 0)
|
||||
@ -393,6 +393,8 @@ Compat_RunCommand(const char *cmdp, GNode *gn, StringListNode *ln)
|
||||
meta_job_error(NULL, gn, false, status);
|
||||
#endif
|
||||
gn->made = ERROR;
|
||||
if (WIFEXITED(reason))
|
||||
gn->exit_status = status;
|
||||
if (opts.keepgoing) {
|
||||
/*
|
||||
* Abort the current target,
|
||||
|
66
cond.c
66
cond.c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cond.c,v 1.359 2023/12/29 12:59:43 rillig Exp $ */
|
||||
/* $NetBSD: cond.c,v 1.362 2024/02/07 07:21:22 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
@ -91,7 +91,7 @@
|
||||
#include "dir.h"
|
||||
|
||||
/* "@(#)cond.c 8.2 (Berkeley) 1/2/94" */
|
||||
MAKE_RCSID("$NetBSD: cond.c,v 1.359 2023/12/29 12:59:43 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: cond.c,v 1.362 2024/02/07 07:21:22 rillig Exp $");
|
||||
|
||||
/*
|
||||
* Conditional expressions conform to this grammar:
|
||||
@ -394,7 +394,7 @@ CondParser_StringExpr(CondParser *par, const char *start,
|
||||
{
|
||||
VarEvalMode emode;
|
||||
const char *p;
|
||||
bool atStart;
|
||||
bool atStart; /* true means an expression outside quotes */
|
||||
|
||||
emode = doEval && quoted ? VARE_WANTRES
|
||||
: doEval ? VARE_UNDEFERR
|
||||
@ -411,11 +411,6 @@ CondParser_StringExpr(CondParser *par, const char *start,
|
||||
}
|
||||
par->p = p;
|
||||
|
||||
/*
|
||||
* If the '$' started the string literal (which means no quotes), and
|
||||
* the expression is followed by a space, a comparison operator or
|
||||
* the end of the expression, we are done.
|
||||
*/
|
||||
if (atStart && is_separator(par->p[0]))
|
||||
return false;
|
||||
|
||||
@ -509,26 +504,12 @@ EvalTruthy(CondParser *par, const char *value, bool quoted)
|
||||
{
|
||||
double num;
|
||||
|
||||
/* For .ifxxx "...", check for non-empty string. */
|
||||
if (quoted)
|
||||
return value[0] != '\0';
|
||||
|
||||
/* For .ifxxx <number>, compare against zero */
|
||||
if (TryParseNumber(value, &num))
|
||||
return num != 0.0;
|
||||
|
||||
/*
|
||||
* For .if ${...}, check for non-empty string. This is different
|
||||
* from the evaluation function from that .if variant, which would
|
||||
* test whether a variable of the given name were defined.
|
||||
*/
|
||||
/*
|
||||
* XXX: Whitespace should count as empty, just as in
|
||||
* CondParser_FuncCallEmpty.
|
||||
*/
|
||||
if (par->plain)
|
||||
return value[0] != '\0';
|
||||
|
||||
return par->evalBare(value) != par->negateEvalBare;
|
||||
}
|
||||
|
||||
@ -867,12 +848,13 @@ CondParser_Term(CondParser *par, bool doEval)
|
||||
{
|
||||
CondResult res;
|
||||
Token t;
|
||||
bool neg = false;
|
||||
|
||||
t = CondParser_Token(par, doEval);
|
||||
if (t == TOK_TRUE)
|
||||
return CR_TRUE;
|
||||
if (t == TOK_FALSE)
|
||||
return CR_FALSE;
|
||||
while ((t = CondParser_Token(par, doEval)) == TOK_NOT)
|
||||
neg = !neg;
|
||||
|
||||
if (t == TOK_TRUE || t == TOK_FALSE)
|
||||
return neg == (t == TOK_FALSE) ? CR_TRUE : CR_FALSE;
|
||||
|
||||
if (t == TOK_LPAREN) {
|
||||
res = CondParser_Or(par, doEval);
|
||||
@ -880,16 +862,7 @@ CondParser_Term(CondParser *par, bool doEval)
|
||||
return CR_ERROR;
|
||||
if (CondParser_Token(par, doEval) != TOK_RPAREN)
|
||||
return CR_ERROR;
|
||||
return res;
|
||||
}
|
||||
|
||||
if (t == TOK_NOT) {
|
||||
res = CondParser_Term(par, doEval);
|
||||
if (res == CR_TRUE)
|
||||
res = CR_FALSE;
|
||||
else if (res == CR_FALSE)
|
||||
res = CR_TRUE;
|
||||
return res;
|
||||
return neg == (res == CR_FALSE) ? CR_TRUE : CR_FALSE;
|
||||
}
|
||||
|
||||
return CR_ERROR;
|
||||
@ -937,20 +910,6 @@ CondParser_Or(CondParser *par, bool doEval)
|
||||
return res;
|
||||
}
|
||||
|
||||
static CondResult
|
||||
CondParser_Eval(CondParser *par)
|
||||
{
|
||||
CondResult res;
|
||||
|
||||
DEBUG1(COND, "CondParser_Eval: %s\n", par->p);
|
||||
|
||||
res = CondParser_Or(par, true);
|
||||
if (res != CR_ERROR && CondParser_Token(par, false) != TOK_EOF)
|
||||
return CR_ERROR;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* Evaluate the condition, including any side effects from the
|
||||
* expressions in the condition. The condition consists of &&, ||, !,
|
||||
@ -974,7 +933,10 @@ CondEvalExpression(const char *cond, bool plain,
|
||||
par.curr = TOK_NONE;
|
||||
par.printedError = false;
|
||||
|
||||
rval = CondParser_Eval(&par);
|
||||
DEBUG1(COND, "CondParser_Eval: %s\n", par.p);
|
||||
rval = CondParser_Or(&par, true);
|
||||
if (par.curr != TOK_EOF)
|
||||
rval = CR_ERROR;
|
||||
|
||||
if (rval == CR_ERROR && eprint && !par.printedError)
|
||||
Parse_Error(PARSE_FATAL, "Malformed conditional (%s)", cond);
|
||||
|
@ -95,6 +95,9 @@
|
||||
/* Define to 1 if you have the `realpath' function. */
|
||||
#undef HAVE_REALPATH
|
||||
|
||||
/* Define to 1 if you have the <regex.h> header file. */
|
||||
#undef HAVE_REGEX_H
|
||||
|
||||
/* Define to 1 if you have the `select' function. */
|
||||
#undef HAVE_SELECT
|
||||
|
||||
|
24
configure
vendored
24
configure
vendored
@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.71 for bmake 20240101.
|
||||
# Generated by GNU Autoconf 2.71 for bmake 20240212.
|
||||
#
|
||||
# Report bugs to <sjg@NetBSD.org>.
|
||||
#
|
||||
@ -610,8 +610,8 @@ MAKEFLAGS=
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME='bmake'
|
||||
PACKAGE_TARNAME='bmake'
|
||||
PACKAGE_VERSION='20240101'
|
||||
PACKAGE_STRING='bmake 20240101'
|
||||
PACKAGE_VERSION='20240212'
|
||||
PACKAGE_STRING='bmake 20240212'
|
||||
PACKAGE_BUGREPORT='sjg@NetBSD.org'
|
||||
PACKAGE_URL=''
|
||||
|
||||
@ -1291,7 +1291,7 @@ if test "$ac_init_help" = "long"; then
|
||||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures bmake 20240101 to adapt to many kinds of systems.
|
||||
\`configure' configures bmake 20240212 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
@ -1353,7 +1353,7 @@ fi
|
||||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of bmake 20240101:";;
|
||||
short | recursive ) echo "Configuration of bmake 20240212:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
@ -1463,7 +1463,7 @@ fi
|
||||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
bmake configure 20240101
|
||||
bmake configure 20240212
|
||||
generated by GNU Autoconf 2.71
|
||||
|
||||
Copyright (C) 2021 Free Software Foundation, Inc.
|
||||
@ -1970,7 +1970,7 @@ cat >config.log <<_ACEOF
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by bmake $as_me 20240101, which was
|
||||
It was created by bmake $as_me 20240212, which was
|
||||
generated by GNU Autoconf 2.71. Invocation command line was
|
||||
|
||||
$ $0$ac_configure_args_raw
|
||||
@ -5213,6 +5213,12 @@ if test "x$ac_cv_header_ranlib_h" = xyes
|
||||
then :
|
||||
printf "%s\n" "#define HAVE_RANLIB_H 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
ac_fn_c_check_header_compile "$LINENO" "regex.h" "ac_cv_header_regex_h" "$ac_includes_default"
|
||||
if test "x$ac_cv_header_regex_h" = xyes
|
||||
then :
|
||||
printf "%s\n" "#define HAVE_REGEX_H 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
ac_fn_c_check_header_compile "$LINENO" "sys/mman.h" "ac_cv_header_sys_mman_h" "$ac_includes_default"
|
||||
if test "x$ac_cv_header_sys_mman_h" = xyes
|
||||
@ -7588,7 +7594,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
||||
# report actual input values of CONFIG_FILES etc. instead of their
|
||||
# values after options handling.
|
||||
ac_log="
|
||||
This file was extended by bmake $as_me 20240101, which was
|
||||
This file was extended by bmake $as_me 20240212, which was
|
||||
generated by GNU Autoconf 2.71. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@ -7652,7 +7658,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
|
||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_config='$ac_cs_config_escaped'
|
||||
ac_cs_version="\\
|
||||
bmake config.status 20240101
|
||||
bmake config.status 20240212
|
||||
configured by $0, generated by GNU Autoconf 2.71,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
dnl
|
||||
dnl RCSid:
|
||||
dnl $Id: configure.in,v 1.101 2024/01/04 23:04:07 sjg Exp $
|
||||
dnl $Id: configure.in,v 1.103 2024/02/16 17:54:38 sjg Exp $
|
||||
dnl
|
||||
dnl Process this file with autoconf to produce a configure script
|
||||
dnl
|
||||
AC_PREREQ([2.71])
|
||||
AC_INIT([bmake],[20240101],[sjg@NetBSD.org])
|
||||
AC_INIT([bmake],[20240212],[sjg@NetBSD.org])
|
||||
AC_CONFIG_HEADERS(config.h)
|
||||
|
||||
dnl make srcdir absolute
|
||||
@ -250,6 +250,7 @@ AC_CHECK_HEADERS( \
|
||||
paths.h \
|
||||
poll.h \
|
||||
ranlib.h \
|
||||
regex.h \
|
||||
sys/mman.h \
|
||||
sys/select.h \
|
||||
sys/socket.h \
|
||||
|
6
for.c
6
for.c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: for.c,v 1.177 2023/11/19 22:50:11 rillig Exp $ */
|
||||
/* $NetBSD: for.c,v 1.178 2024/01/21 15:02:17 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, The Regents of the University of California.
|
||||
@ -58,7 +58,7 @@
|
||||
#include "make.h"
|
||||
|
||||
/* "@(#)for.c 8.1 (Berkeley) 6/6/93" */
|
||||
MAKE_RCSID("$NetBSD: for.c,v 1.177 2023/11/19 22:50:11 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: for.c,v 1.178 2024/01/21 15:02:17 rillig Exp $");
|
||||
|
||||
|
||||
typedef struct ForLoop {
|
||||
@ -434,7 +434,7 @@ static void
|
||||
ForLoop_SubstVarShort(ForLoop *f, unsigned int firstItem, Buffer *body,
|
||||
const char *p, const char **inout_mark)
|
||||
{
|
||||
const char ch = *p;
|
||||
char ch = *p;
|
||||
const char **vars;
|
||||
size_t i;
|
||||
|
||||
|
@ -92,6 +92,7 @@ gen_import_F() {
|
||||
else
|
||||
last="last import"
|
||||
fi
|
||||
echo Intersting/relevant changes since $last; echo
|
||||
for C in ChangeLog */ChangeLog
|
||||
do
|
||||
$GIT diff --staged $C |
|
||||
|
@ -53,8 +53,10 @@
|
||||
# Simon J. Gerraty <sjg@crufty.net>
|
||||
#
|
||||
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# RCSid:
|
||||
# $Id: install-sh,v 1.25 2023/07/15 05:33:38 sjg Exp $
|
||||
# $Id: install-sh,v 1.26 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 1993-2023 Simon J. Gerraty
|
||||
#
|
||||
|
8
job.c
8
job.c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: job.c,v 1.465 2024/01/07 11:39:04 rillig Exp $ */
|
||||
/* $NetBSD: job.c,v 1.467 2024/03/10 02:53:37 sjg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
@ -154,7 +154,7 @@
|
||||
#include "trace.h"
|
||||
|
||||
/* "@(#)job.c 8.2 (Berkeley) 3/19/94" */
|
||||
MAKE_RCSID("$NetBSD: job.c,v 1.465 2024/01/07 11:39:04 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: job.c,v 1.467 2024/03/10 02:53:37 sjg Exp $");
|
||||
|
||||
/*
|
||||
* A shell defines how the commands are run. All commands for a target are
|
||||
@ -1433,7 +1433,7 @@ JobExec(Job *job, char **argv)
|
||||
/* Pre-emptively mark job running, pid still zero though */
|
||||
job->status = JOB_ST_RUNNING;
|
||||
|
||||
Var_ReexportVars();
|
||||
Var_ReexportVars(job->node);
|
||||
|
||||
cpid = vfork();
|
||||
if (cpid == -1)
|
||||
@ -2059,6 +2059,8 @@ JobReapChild(pid_t pid, WAIT_T status, bool isJobs)
|
||||
|
||||
job->status = JOB_ST_FINISHED;
|
||||
job->exit_status = WAIT_STATUS(status);
|
||||
if (WIFEXITED(status))
|
||||
job->node->exit_status = WEXITSTATUS(status);
|
||||
|
||||
JobFinish(job, status);
|
||||
}
|
||||
|
39
main.c
39
main.c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: main.c,v 1.609 2024/01/07 01:33:57 sjg Exp $ */
|
||||
/* $NetBSD: main.c,v 1.612 2024/03/10 02:53:37 sjg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -111,7 +111,7 @@
|
||||
#include "trace.h"
|
||||
|
||||
/* "@(#)main.c 8.3 (Berkeley) 3/19/94" */
|
||||
MAKE_RCSID("$NetBSD: main.c,v 1.609 2024/01/07 01:33:57 sjg Exp $");
|
||||
MAKE_RCSID("$NetBSD: main.c,v 1.612 2024/03/10 02:53:37 sjg Exp $");
|
||||
#if defined(MAKE_NATIVE)
|
||||
__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
|
||||
"The Regents of the University of California. "
|
||||
@ -698,20 +698,6 @@ Main_ParseArgLine(const char *line)
|
||||
if (p[0] == '\0')
|
||||
return;
|
||||
|
||||
#ifndef POSIX
|
||||
{
|
||||
/*
|
||||
* $MAKE may simply be naming the make(1) binary
|
||||
*/
|
||||
char *cp;
|
||||
|
||||
if (!(cp = strrchr(line, '/')))
|
||||
cp = line;
|
||||
if ((cp = strstr(cp, "make")) &&
|
||||
strcmp(cp, "make") == 0)
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
{
|
||||
FStr argv0 = Var_Value(SCOPE_GLOBAL, ".MAKE");
|
||||
buf = str_concat3(argv0.str, " ", p);
|
||||
@ -1450,20 +1436,11 @@ main_Init(int argc, char **argv)
|
||||
#endif
|
||||
Dir_Init();
|
||||
|
||||
#ifdef POSIX
|
||||
{
|
||||
char *makeflags = explode(getenv("MAKEFLAGS"));
|
||||
Main_ParseArgLine(makeflags);
|
||||
free(makeflags);
|
||||
}
|
||||
#else
|
||||
/*
|
||||
* First snag any flags out of the MAKE environment variable.
|
||||
* (Note this is *not* MAKEFLAGS since /bin/make uses that and it's
|
||||
* in a different format).
|
||||
*/
|
||||
Main_ParseArgLine(getenv("MAKE"));
|
||||
#endif
|
||||
|
||||
if (getcwd(curdir, MAXPATHLEN) == NULL) {
|
||||
(void)fprintf(stderr, "%s: getcwd: %s.\n",
|
||||
@ -1776,7 +1753,7 @@ Cmd_Exec(const char *cmd, char **error)
|
||||
return bmake_strdup("");
|
||||
}
|
||||
|
||||
Var_ReexportVars();
|
||||
Var_ReexportVars(SCOPE_GLOBAL);
|
||||
|
||||
switch (cpid = vfork()) {
|
||||
case 0:
|
||||
@ -2078,10 +2055,13 @@ static void
|
||||
SetErrorVars(GNode *gn)
|
||||
{
|
||||
StringListNode *ln;
|
||||
char sts[16];
|
||||
|
||||
/*
|
||||
* We can print this even if there is no .ERROR target.
|
||||
*/
|
||||
snprintf(sts, sizeof(sts), "%d", gn->exit_status);
|
||||
Global_Set(".ERROR_EXIT", sts);
|
||||
Global_Set(".ERROR_TARGET", gn->name);
|
||||
Global_Delete(".ERROR_CMD");
|
||||
|
||||
@ -2155,13 +2135,8 @@ Main_ExportMAKEFLAGS(bool first)
|
||||
"${.MAKEFLAGS} ${.MAKEOVERRIDES:O:u:@v@$v=${$v:Q}@}",
|
||||
SCOPE_CMDLINE, VARE_WANTRES);
|
||||
/* TODO: handle errors */
|
||||
if (flags[0] != '\0') {
|
||||
#ifdef POSIX
|
||||
if (flags[0] != '\0')
|
||||
setenv("MAKEFLAGS", flags, 1);
|
||||
#else
|
||||
setenv("MAKE", flags, 1);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
char *
|
||||
|
50
make-conf.h
50
make-conf.h
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: config.h,v 1.28 2020/12/11 22:53:08 rillig Exp $ */
|
||||
/* $NetBSD: config.h,v 1.29 2024/02/07 06:43:02 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
@ -72,20 +72,6 @@
|
||||
* from: @(#)config.h 8.1 (Berkeley) 6/6/93
|
||||
*/
|
||||
|
||||
/*
|
||||
* INCLUDES
|
||||
* LIBRARIES
|
||||
* These control the handling of the .INCLUDES and .LIBS variables.
|
||||
*
|
||||
* If INCLUDES is defined, the .INCLUDES variable will be filled
|
||||
* from the search paths of those suffixes which are marked by
|
||||
* .INCLUDES dependency lines. Similarly for LIBRARIES and .LIBS.
|
||||
*
|
||||
* See varname-dot-include.mk and varname-dot-libs.mk for more details.
|
||||
*/
|
||||
#define INCLUDES
|
||||
#define LIBRARIES
|
||||
|
||||
/*
|
||||
* LIBSUFF
|
||||
* Is the suffix used to denote libraries and is used by the Suff module
|
||||
@ -108,40 +94,6 @@
|
||||
*/
|
||||
#define RECHECK
|
||||
|
||||
/*
|
||||
* POSIX
|
||||
* Adhere to the POSIX 1003.2 draft for the make(1) program.
|
||||
* - Use MAKEFLAGS instead of MAKE to pick arguments from the
|
||||
* environment.
|
||||
*/
|
||||
#define POSIX
|
||||
|
||||
/*
|
||||
* SYSVINCLUDE
|
||||
* Recognize system V like include directives [include "filename"]
|
||||
* (required by POSIX 2018)
|
||||
* SYSVVARSUB
|
||||
* Recognize system V like ${VAR:x=y} variable substitutions
|
||||
* (required by POSIX 2018)
|
||||
*/
|
||||
#define SYSVINCLUDE
|
||||
#define SYSVVARSUB
|
||||
|
||||
/*
|
||||
* GMAKEEXPORT
|
||||
* Recognize gmake like variable export directives [export <VAR>=<VALUE>]
|
||||
*/
|
||||
#define GMAKEEXPORT
|
||||
|
||||
/*
|
||||
* SUNSHCMD
|
||||
* Recognize SunOS and Solaris:
|
||||
* VAR :sh= CMD # Assign VAR to the command substitution of CMD
|
||||
* ${VAR:sh} # Return the command substitution of the value
|
||||
* # of ${VAR}
|
||||
*/
|
||||
#define SUNSHCMD
|
||||
|
||||
#if defined(MAKE_NATIVE) && !defined(__ELF__)
|
||||
# ifndef RANLIBMAG
|
||||
# define RANLIBMAG "__.SYMDEF"
|
||||
|
22
make.1
22
make.1
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: make.1,v 1.372 2023/12/24 16:48:30 sjg Exp $
|
||||
.\" $NetBSD: make.1,v 1.375 2024/03/10 02:53:37 sjg Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1990, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@ -29,7 +29,7 @@
|
||||
.\"
|
||||
.\" from: @(#)make.1 8.4 (Berkeley) 3/19/94
|
||||
.\"
|
||||
.Dd December 24, 2023
|
||||
.Dd March 9, 2024
|
||||
.Dt MAKE 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -879,6 +879,9 @@ Is used in error handling, see
|
||||
.It Va .ERROR_CWD
|
||||
Is used in error handling, see
|
||||
.Va MAKE_PRINT_VAR_ON_ERROR .
|
||||
.It Va .ERROR_EXIT
|
||||
Is used in error handling, see
|
||||
.Va MAKE_PRINT_VAR_ON_ERROR .
|
||||
.It Va .ERROR_META_FILE
|
||||
Is used in error handling in
|
||||
.Dq meta
|
||||
@ -1185,6 +1188,8 @@ When
|
||||
stops due to an error, it sets
|
||||
.Sq Va .ERROR_TARGET
|
||||
to the name of the target that failed,
|
||||
.Sq Va .ERROR_EXIT
|
||||
to the exit status of the failed target,
|
||||
.Sq Va .ERROR_CMD
|
||||
to the commands of the failed target,
|
||||
and in
|
||||
@ -1775,8 +1780,9 @@ modifier which is later referenced using the index values from
|
||||
.Ql :range .
|
||||
.It Cm \&:U\| Ns Ar newval
|
||||
If the variable is undefined,
|
||||
the optional
|
||||
.Ar newval
|
||||
is the value.
|
||||
(which may be empty) is the value.
|
||||
If the variable is defined, the existing value is returned.
|
||||
This is another ODE make feature.
|
||||
It is handy for setting per-target CFLAGS for instance:
|
||||
@ -1786,7 +1792,7 @@ If a value is only required if the variable is undefined, use:
|
||||
.It Cm \&:D\| Ns Ar newval
|
||||
If the variable is defined,
|
||||
.Ar newval
|
||||
is the value.
|
||||
(which may be empty) is the value.
|
||||
.It Cm \&:L
|
||||
The name of the variable is the value.
|
||||
.It Cm \&:P
|
||||
@ -2405,11 +2411,9 @@ Any command lines attached to this target are executed after everything
|
||||
else is done successfully.
|
||||
.It Ic .ERROR
|
||||
Any command lines attached to this target are executed when another target fails.
|
||||
The
|
||||
.Va .ERROR_TARGET
|
||||
variable is set to the target that failed.
|
||||
See also
|
||||
.Va MAKE_PRINT_VAR_ON_ERROR .
|
||||
See
|
||||
.Va MAKE_PRINT_VAR_ON_ERROR
|
||||
for the variables that will be set.
|
||||
.It Ic .IGNORE
|
||||
Mark each of the sources with the
|
||||
.Ic .IGNORE
|
||||
|
5
make.h
5
make.h
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: make.h,v 1.327 2023/12/17 09:02:26 rillig Exp $ */
|
||||
/* $NetBSD: make.h,v 1.329 2024/03/10 02:53:37 sjg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -527,6 +527,7 @@ typedef struct GNode {
|
||||
const char *fname;
|
||||
/* Line number where the GNode got defined, 1-based */
|
||||
unsigned lineno;
|
||||
int exit_status;
|
||||
} GNode;
|
||||
|
||||
/*
|
||||
@ -1034,7 +1035,7 @@ char *Var_Subst(const char *, GNode *, VarEvalMode);
|
||||
void Var_Expand(FStr *, GNode *, VarEvalMode);
|
||||
void Var_Stats(void);
|
||||
void Var_Dump(GNode *);
|
||||
void Var_ReexportVars(void);
|
||||
void Var_ReexportVars(GNode *);
|
||||
void Var_Export(VarExportMode, const char *);
|
||||
void Var_ExportVars(const char *);
|
||||
void Var_UnExport(bool, const char *);
|
||||
|
80
mk/ChangeLog
80
mk/ChangeLog
@ -1,3 +1,83 @@
|
||||
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-01-05 Simon J Gerraty <sjg@beast.crufty.net>
|
||||
|
||||
* install-mk (MK_VERSION): 20240105
|
||||
|
2
mk/FILES
2
mk/FILES
@ -7,6 +7,7 @@ autoconf.mk
|
||||
autodep.mk
|
||||
auto.dep.mk
|
||||
cc-wrap.mk
|
||||
ccm.dep.mk
|
||||
compiler.mk
|
||||
cython.mk
|
||||
dep.mk
|
||||
@ -45,6 +46,7 @@ scripts.mk
|
||||
srctop.mk
|
||||
stage-install.sh
|
||||
subdir.mk
|
||||
suffixes.mk
|
||||
sys.mk
|
||||
sys.clean-env.mk
|
||||
sys.debug.mk
|
||||
|
@ -1,6 +1,7 @@
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# RCSid:
|
||||
# $Id: auto.dep.mk,v 1.10 2021/12/11 18:57:41 sjg Exp $
|
||||
# $Id: auto.dep.mk,v 1.12 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2010-2021, Simon J. Gerraty
|
||||
#
|
||||
@ -85,4 +86,7 @@ ${DEPENDFILE}: ${OBJS} ${POBJS} ${SOBJS}
|
||||
done > $@
|
||||
|
||||
.endif
|
||||
|
||||
.-include <ccm.dep.mk>
|
||||
|
||||
.endif
|
||||
|
@ -1,4 +1,6 @@
|
||||
# $Id: auto.obj.mk,v 1.16 2020/08/19 17:51:53 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: auto.obj.mk,v 1.17 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2004, Simon J. Gerraty
|
||||
#
|
||||
|
@ -1,6 +1,8 @@
|
||||
# $Id: autoconf.mk,v 1.18 2023/03/22 15:37:19 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# @(#) Copyright (c) 1996-2009, Simon J. Gerraty
|
||||
# $Id: autoconf.mk,v 1.20 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 1996-2024, Simon J. Gerraty
|
||||
#
|
||||
# This file is provided in the hope that it will
|
||||
# be of use. There is absolutely NO WARRANTY.
|
||||
@ -52,7 +54,7 @@ CLEANFILES+= config.recheck config.gen config.status *.meta \
|
||||
# this is not quite per the autoconf manual,
|
||||
# and is extremely convoluted - but all utterly necessary!
|
||||
|
||||
.if make(autoconf-in) || make(configure) || make(config.h.in) || ${AUTO_AUTOCONF:Uno:tl} == "yes"
|
||||
.if make(autoconf-input) || make(configure) || make(config.h.in) || ${MK_AUTO_AUTOCONF:Uno} == "yes"
|
||||
AUTOCONF ?= autoconf
|
||||
AUTOHEADER ?= autoheader
|
||||
|
||||
@ -73,14 +75,23 @@ ACLOCAL += aclocal.m4
|
||||
.if exists(${.CURDIR}/acconfig.h)
|
||||
ACCONFIG += acconfig.h
|
||||
.endif
|
||||
.if exists(${.CURDIR}/configure.ac)
|
||||
CONFIGURE_SRC = ${.CURDIR}/configure.ac
|
||||
.else
|
||||
CONFIGURE_SRC ?= ${.CURDIR}/configure.in
|
||||
.endif
|
||||
|
||||
config.h.in: .NOTMAIN ${.CURDIR}/configure.in ${ACCONFIG}
|
||||
config.h.in: .NOTMAIN ${CONFIGURE_SRC} ${ACCONFIG}
|
||||
(cd ${.CURDIR} && ${AUTOHEADER})
|
||||
|
||||
configure: .NOTMAIN ${.CURDIR}/configure.in ${ACLOCAL}
|
||||
configure: .NOTMAIN ${CONFIGURE_SRC} ${ACLOCAL}
|
||||
(cd ${.CURDIR} && ${AUTOCONF})
|
||||
|
||||
AUTOCONF_INPUTS += configure
|
||||
.if exists(${.CURDIR}/config.h.in)
|
||||
AUTOCONF_INPUTS += config.h.in
|
||||
.endif
|
||||
|
||||
autoconf-input: .NOTMAIN ${AUTOCONF_INPUTS}
|
||||
|
||||
.endif
|
||||
|
@ -1,8 +1,9 @@
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# RCSid:
|
||||
# $Id: autodep.mk,v 1.40 2021/12/08 05:56:50 sjg Exp $
|
||||
# $Id: autodep.mk,v 1.43 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 1999-2010, Simon J. Gerraty
|
||||
# @(#) Copyright (c) 1999-2024, Simon J. Gerraty
|
||||
#
|
||||
# This file is provided in the hope that it will
|
||||
# be of use. There is absolutely NO WARRANTY.
|
||||
@ -32,59 +33,58 @@ DEPENDFILE?= .depend
|
||||
.endif
|
||||
.endfor
|
||||
|
||||
# should have been set by sys.mk
|
||||
CXX_SUFFIXES ?= .cc .ccm .cpp .cxx .C
|
||||
|
||||
# it does nothing if SRCS is not defined or is empty
|
||||
.if defined(SRCS) && !empty(SRCS)
|
||||
DEPSRCS?=${SRCS}
|
||||
__depsrcs=${DEPSRCS:M*.c}
|
||||
__depsrcs+=${DEPSRCS:M*.y}
|
||||
__depsrcs+=${DEPSRCS:M*.l}
|
||||
__depsrcs+=${DEPSRCS:M*.s}
|
||||
__depsrcs+=${DEPSRCS:M*.S}
|
||||
__depsrcs+=${DEPSRCS:M*.cc}
|
||||
__depsrcs+=${DEPSRCS:M*.cpp}
|
||||
__depsrcs+=${DEPSRCS:M*.C}
|
||||
__depsrcs+=${DEPSRCS:M*.cxx}
|
||||
__depsrcs+=${DEPSRCS:M*.pc}
|
||||
DEPSRCS ?= ${SRCS}
|
||||
__depsrcs = ${DEPSRCS:M*.c}
|
||||
__depsrcs += ${DEPSRCS:M*.y}
|
||||
__depsrcs += ${DEPSRCS:M*.l}
|
||||
__depsrcs += ${DEPSRCS:M*.s}
|
||||
__depsrcs += ${DEPSRCS:M*.S}
|
||||
__depsrcs += ${DEPSRCS:M*.pc}
|
||||
.for s in ${CXX_SUFFIXES}
|
||||
__depsrcs += ${DEPSRCS:M*$s}
|
||||
.endfor
|
||||
|
||||
.for s in ${__depsrcs}
|
||||
${s:T:R}.d: $s
|
||||
.endfor
|
||||
|
||||
__depsrcs:=${__depsrcs:T:R:S/$/.d/g}
|
||||
__depsrcs := ${__depsrcs:T:R:S/$/.d/g}
|
||||
# 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.
|
||||
__dependsrcsx?= ${__depsrcs} ${OBJS:S/.o/.d/}
|
||||
__dependsrcs= ${__dependsrcsx:O:u}
|
||||
__dependsrcsx ?= ${__depsrcs} ${OBJS:S/.o/.d/}
|
||||
__dependsrcs = ${__dependsrcsx:O:u}
|
||||
|
||||
# clean up any .c files we may have generated
|
||||
#__gensrcs:= ${DEPSRCS:M*.y} ${DEPSRCS:M*.l}
|
||||
#CLEANFILES+= ${__gensrcs:T:R:S/$/.c/g}
|
||||
#__gensrcs := ${DEPSRCS:M*.y} ${DEPSRCS:M*.l}
|
||||
#CLEANFILES += ${__gensrcs:T:R:S/$/.c/g}
|
||||
|
||||
# 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
|
||||
.if ${COMPILER_TYPE:Ugcc} == "gcc" && ${COMPILER_VERSION:U0} < 30000
|
||||
CFLAGS_MF=
|
||||
CFLAGS_MF =
|
||||
.endif
|
||||
CFLAGS_MF?=-MF ${.TARGET:T:R}.d -MT ${.TARGET:T:R}.o
|
||||
CFLAGS+= ${CFLAGS_MD} ${CFLAGS_MF}
|
||||
CFLAGS_MF ?= -MF ${.TARGET:T:R}.d -MT ${.TARGET:T:R}.o
|
||||
CFLAGS += ${CFLAGS_MD} ${CFLAGS_MF}
|
||||
RM?= rm
|
||||
MAKE_SHELL?= sh
|
||||
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}
|
||||
CXX_MD?=${CXX}
|
||||
|
||||
# should have been set by sys.mk
|
||||
CXX_SUFFIXES?= .cc .cpp .cxx .C
|
||||
CC_MD ?= ${CC}
|
||||
CXX_MD ?= ${CXX}
|
||||
|
||||
# so we can do an explicit make depend, but not otherwise
|
||||
.if make(depend)
|
||||
@ -114,7 +114,9 @@ CXX_SUFFIXES?= .cc .cpp .cxx .C
|
||||
${CXX_SUFFIXES:%=%.d}:
|
||||
@echo updating dependencies for $<
|
||||
@${MAKE_SHELL} -ec "${CXX_MD} -M ${CXXFLAGS_MD} $< | sed '/:/s/^/$@ /' > $@" || { ${RM} -f $@; false; }
|
||||
|
||||
.else
|
||||
|
||||
.y.d:
|
||||
${YACC} ${YFLAGS} $<
|
||||
${CC_MD} ${CFLAGS_MD:S/D//} ${CPPFLAGS_MD} y.tab.c > $@ || { ${RM} -f y.tab.c $@; false; }
|
||||
@ -133,6 +135,7 @@ ${CXX_SUFFIXES:%=%.d}:
|
||||
|
||||
${CXX_SUFFIXES:%=%.d}:
|
||||
${CXX_MD} ${CFLAGS_MD:S/D//} ${CXXFLAGS_MD} $< > $@ || { ${RM} -f $@; false; }
|
||||
|
||||
.endif
|
||||
|
||||
.if !target(depend)
|
||||
@ -152,47 +155,47 @@ ${PROG} ${_LIBS}: ${DEPENDFILE}
|
||||
.ORDER: beforedepend ${DEPENDFILE} afterdepend
|
||||
|
||||
.if ${.OBJDIR} != ${.CURDIR}
|
||||
__depfiles= *.d
|
||||
__depfiles = *.d
|
||||
.else
|
||||
__depfiles= ${__dependsrcs}
|
||||
__depfiles = ${__dependsrcs}
|
||||
.endif
|
||||
|
||||
DEPCLEANFILES= ${DEPENDFILE} ${__depfiles} y.tab.d *.tmp.d
|
||||
DEPCLEANFILES = ${DEPENDFILE} ${__depfiles} y.tab.d *.tmp.d
|
||||
|
||||
cleandir: cleanautodepend
|
||||
cleanautodepend:
|
||||
${RM} -f ${DEPCLEANFILES}
|
||||
|
||||
CLEANFILES+= ${DEPCLEANFILES}
|
||||
CLEANFILES += ${DEPCLEANFILES}
|
||||
|
||||
.if defined(__dependsrcs) && !empty(__dependsrcs)
|
||||
.if make(depend) || !(make(clean*) || make(destroy*) || make(obj) || make(*install) || make(install-*))
|
||||
# this ensures we do the right thing if only building a shared or
|
||||
# profiled lib
|
||||
OBJ_EXTENSIONS?=.o .po .so .So
|
||||
MDLIB_SED= -e '/:/s,^\([^\.:]*\)\.[psS]*o,${OBJ_EXTENSIONS:S,^,\1,},'
|
||||
OBJ_SUFFIXES ?= .o .po .so .So
|
||||
MDLIB_SED = -e '/:/s,^\([^\.:]*\)\.[psS]*o,${OBJ_SUFFIXES:S,^,\1,},'
|
||||
.ifdef NOMD_SED
|
||||
.ifdef LIB
|
||||
MD_SED=sed ${MDLIB_SED}
|
||||
MD_SED = sed ${MDLIB_SED}
|
||||
.else
|
||||
MD_SED=cat
|
||||
MD_SED = cat
|
||||
.endif
|
||||
.else
|
||||
# arrange to put some variable names into ${DEPENDFILE}
|
||||
.ifdef LIB
|
||||
MD_SED=sed ${MDLIB_SED}
|
||||
MD_SED = sed ${MDLIB_SED}
|
||||
.else
|
||||
MD_SED=sed
|
||||
MD_SED = sed
|
||||
.endif
|
||||
SUBST_DEPVARS+= SB TOP BACKING SRC SRCDIR BASE BASEDIR
|
||||
SUBST_DEPVARS += SB TOP BACKING SRC SRCDIR BASE BASEDIR
|
||||
.for v in ${SUBST_DEPVARS}
|
||||
.if defined(${v}) && !empty(${v})
|
||||
MD_SED+= -e 's,${$v},$${$v},'
|
||||
MD_SED += -e 's,${$v},$${$v},'
|
||||
.endif
|
||||
.endfor
|
||||
.endif
|
||||
.if (${MD_SED} == "sed")
|
||||
MD_SED=cat
|
||||
MD_SED = cat
|
||||
.endif
|
||||
|
||||
# this will be done whenever make finishes successfully
|
||||
@ -219,4 +222,6 @@ beforedepend:
|
||||
afterdepend:
|
||||
.endif
|
||||
|
||||
.-include <ccm.dep.mk>
|
||||
|
||||
.endif
|
||||
|
@ -1,4 +1,6 @@
|
||||
# $Id: cc-wrap.mk,v 1.6 2022/02/16 17:41:52 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: cc-wrap.mk,v 1.7 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2022, Simon J. Gerraty
|
||||
#
|
||||
|
60
mk/ccm.dep.mk
Normal file
60
mk/ccm.dep.mk
Normal file
@ -0,0 +1,60 @@
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# RCSid:
|
||||
# $Id: ccm.dep.mk,v 1.3 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2024, 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
|
||||
#
|
||||
|
||||
# C++ Modules need extra help - at least in a clean tree
|
||||
|
||||
.if !target(__${_this}__)
|
||||
__${_this}__: .NOTMAIN
|
||||
|
||||
# These should all be set by now
|
||||
CCM_SUFFIXES ?= ${.SUFFIXES:M*.c*m}
|
||||
PCM ?= .pcm
|
||||
OBJ_SUFFIXES ?= ${.SUFFIXES:M*o}
|
||||
|
||||
.ccm_srcs := ${CCM_SUFFIXES:@s@${SRCS:M*$s}@}
|
||||
.if !empty(.ccm_srcs)
|
||||
.ccm_srcs += ${CXX_SUFFIXES:@s@${SRCS:M*$s}@}
|
||||
# this is likely overkill, but
|
||||
# with .dinclude it should not matter
|
||||
.ccm_depend: ${.ccm_srcs}
|
||||
@rm -f ${.TARGET}
|
||||
.for s r e in ${.ccm_srcs:@x@$x ${x:T:R} ${x:E}@}
|
||||
@mlist=`sed -n '/^import/s,.*[[:space:]]\([^[:space:];]*\);.*,\1,p' ${.ALLSRC:M*$s}`; \
|
||||
for o in ${OBJ_SUFFIXES:O:u}; do \
|
||||
for m in $$mlist; do \
|
||||
echo $r$$o: $$m${PCM}; \
|
||||
done; \
|
||||
done >> ${.TARGET}
|
||||
.endfor
|
||||
|
||||
.if make(depend)
|
||||
x != echo; rm -f .ccm_depend
|
||||
.endif
|
||||
|
||||
.if !make(.ccm_depend)
|
||||
.if !exists(.ccm_depend)
|
||||
# ugly, but it does the trick
|
||||
x != echo; ${.MAKE} -B -C ${.CURDIR} -f ${MAKEFILE} .ccm_depend
|
||||
.endif
|
||||
|
||||
CLEANFILES += .ccm_depend
|
||||
# the ${.OBJDIR}/ is necessary!
|
||||
.dinclude <${.OBJDIR}/.ccm_depend>
|
||||
.endif
|
||||
.endif
|
||||
.endif
|
@ -1,4 +1,6 @@
|
||||
# $Id: compiler.mk,v 1.12 2023/10/03 18:47:48 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: compiler.mk,v 1.14 2024/02/19 00:05:50 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2019, Simon J. Gerraty
|
||||
#
|
||||
@ -27,7 +29,7 @@ _v != (${CC} --version) 2> /dev/null | \
|
||||
.if empty(COMPILER_TYPE)
|
||||
.if ${_v:Mclang} != ""
|
||||
COMPILER_TYPE = clang
|
||||
.elif ${_v:M[Gg][Cc][Cc]} != "" || ${_v:MFoundation*} != "" || ${CC:T:M*gcc*} != ""
|
||||
.elif ${_v:M[Gg][Cc][Cc]} != "" || ${_v:MFoundation*} != "" || ${CC:Ucc:T:M*gcc*} != ""
|
||||
COMPILER_TYPE = gcc
|
||||
.endif
|
||||
.endif
|
||||
|
@ -1,5 +1,7 @@
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# RCSid:
|
||||
# $Id: cython.mk,v 1.8 2020/08/19 17:51:53 sjg Exp $
|
||||
# $Id: cython.mk,v 1.9 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2014, Simon J. Gerraty
|
||||
#
|
||||
|
19
mk/dep.mk
19
mk/dep.mk
@ -1,7 +1,10 @@
|
||||
# $Id: dep.mk,v 1.18 2021/12/08 05:56:50 sjg Exp $
|
||||
# $Id: dep.mk,v 1.22 2024/02/19 00:06:19 sjg Exp $
|
||||
|
||||
.if !target(__${.PARSEFILE}__)
|
||||
__${.PARSEFILE}__: .NOTMAIN
|
||||
# should be set properly in sys.mk
|
||||
_this ?= ${.PARSEFILE:S,bsd.,,}
|
||||
|
||||
.if !target(__${_this}__)
|
||||
__${_this}__: .NOTMAIN
|
||||
|
||||
# handle Proc*C as well...
|
||||
.if defined(SRCS)
|
||||
@ -9,13 +12,18 @@ __${.PARSEFILE}__: .NOTMAIN
|
||||
.include <proc.mk>
|
||||
.endif
|
||||
|
||||
.if ${MAKE_VERSION:U0} >= 20211212
|
||||
OBJ_SUFFIXES += ${.SUFFIXES:M*o}
|
||||
.else
|
||||
# it would be nice to be able to query .SUFFIXES
|
||||
OBJ_EXTENSIONS+= .o .po .lo .So
|
||||
OBJ_SUFFIXES += .o .po .lo ${PICO}
|
||||
.endif
|
||||
OBJ_SUFFIXES += ${PCM}
|
||||
|
||||
# explicit dependencies help short-circuit .SUFFIX searches
|
||||
SRCS_DEP_FILTER+= N*.[hly]
|
||||
.for s in ${SRCS:${SRCS_DEP_FILTER:O:u:ts:}}
|
||||
.for e in ${OBJ_EXTENSIONS:O:u}
|
||||
.for e in ${OBJ_SUFFIXES:O:u}
|
||||
.if !target(${s:T:R}$e)
|
||||
${s:T:R}$e: $s
|
||||
.endif
|
||||
@ -94,6 +102,7 @@ depend: beforedepend .depend _SUBDIRUSE afterdepend
|
||||
${CXXFLAGS:M-[ID]*} ${CPPFLAGS} $$files;; \
|
||||
esac
|
||||
.endif
|
||||
.-include <ccm.dep.mk>
|
||||
.else
|
||||
.depend:
|
||||
.endif
|
||||
|
@ -1,4 +1,6 @@
|
||||
# $Id: dirdeps-cache-update.mk,v 1.22 2020/09/10 00:14:38 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: dirdeps-cache-update.mk,v 1.23 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2020, Simon J. Gerraty
|
||||
#
|
||||
|
@ -1,4 +1,6 @@
|
||||
# $Id: dirdeps-options.mk,v 1.21 2022/09/06 22:18:45 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: dirdeps-options.mk,v 1.22 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2018-2022, Simon J. Gerraty
|
||||
#
|
||||
|
@ -1,5 +1,7 @@
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# RCSid:
|
||||
# $Id: dirdeps-targets.mk,v 1.25 2023/05/11 05:07:28 sjg Exp $
|
||||
# $Id: dirdeps-targets.mk,v 1.27 2024/02/25 19:12:13 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2019-2020 Simon J. Gerraty
|
||||
#
|
||||
@ -40,6 +42,9 @@
|
||||
# pickup customizations
|
||||
.-include <local.dirdeps-targets.mk>
|
||||
|
||||
# this is what we are here for
|
||||
.MAIN: dirdeps
|
||||
|
||||
# for DIRDEPS_BUILD this is how we prime the pump
|
||||
# include . to allow any directory to work as a target
|
||||
DIRDEPS_TARGETS_DIRS ?= targets targets/pseudo
|
||||
|
@ -1,7 +1,10 @@
|
||||
# $Id: doc.mk,v 1.8 2021/12/08 05:56:50 sjg Exp $
|
||||
# $Id: doc.mk,v 1.9 2024/02/19 00:06:19 sjg Exp $
|
||||
|
||||
.if !target(__${.PARSEFILE}__)
|
||||
__${.PARSEFILE}__: .NOTMAIN
|
||||
# should be set properly in sys.mk
|
||||
_this ?= ${.PARSEFILE:S,bsd.,,}
|
||||
|
||||
.if !target(__${_this}__)
|
||||
__${_this}__: .NOTMAIN
|
||||
|
||||
.include <init.mk>
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
# $Id: dpadd.mk,v 1.31 2023/11/25 01:07:49 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: dpadd.mk,v 1.33 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2004-2023, Simon J. Gerraty
|
||||
#
|
||||
@ -254,7 +256,7 @@ SHLDADD+= -L${__lib:H}
|
||||
# Now for the bits we actually need
|
||||
__dpadd_incs=
|
||||
.for __lib in ${__dpadd_libs:u}
|
||||
.if (make(${PROG}_p) || defined(NEED_GPROF)) && exists(${__lib:R}_p.a)
|
||||
.if (make(${PROG:U}_p) || defined(NEED_GPROF)) && exists(${__lib:R}_p.a)
|
||||
__ldadd=-l${__lib:T:R:S,lib,,}
|
||||
LDADD := ${LDADD:S,^${__ldadd}$,${__ldadd}_p,g}
|
||||
.endif
|
||||
|
@ -1,4 +1,6 @@
|
||||
# $Id: files.mk,v 1.7 2020/08/19 17:51:53 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: files.mk,v 1.8 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2017, Simon J. Gerraty
|
||||
#
|
||||
|
@ -1,5 +1,19 @@
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# RCSid:
|
||||
# $Id: host-target.mk,v 1.19 2023/09/21 06:44:53 sjg Exp $
|
||||
# $Id: host-target.mk,v 1.20 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2007-2023 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
|
||||
|
||||
# Host platform information; may be overridden
|
||||
.if !target(__${.PARSEFILE}__)
|
||||
|
@ -1,4 +1,6 @@
|
||||
# $Id: inc.mk,v 1.8 2020/08/19 17:51:53 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: inc.mk,v 1.9 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2008, Simon J. Gerraty
|
||||
#
|
||||
|
29
mk/init.mk
29
mk/init.mk
@ -1,6 +1,8 @@
|
||||
# $Id: init.mk,v 1.30 2023/10/03 16:25:01 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# @(#) Copyright (c) 2002, Simon J. Gerraty
|
||||
# $Id: init.mk,v 1.37 2024/02/25 19:12:13 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2002-2024, Simon J. Gerraty
|
||||
#
|
||||
# This file is provided in the hope that it will
|
||||
# be of use. There is absolutely NO WARRANTY.
|
||||
@ -13,8 +15,11 @@
|
||||
# sjg@crufty.net
|
||||
#
|
||||
|
||||
.if !target(__${.PARSEFILE}__)
|
||||
__${.PARSEFILE}__: .NOTMAIN
|
||||
# should be set properly in sys.mk
|
||||
_this ?= ${.PARSEFILE:S,bsd.,,}
|
||||
|
||||
.if !target(__${_this}__)
|
||||
__${_this}__: .NOTMAIN
|
||||
|
||||
.if ${MAKE_VERSION:U0} > 20100408
|
||||
_this_mk_dir := ${.PARSEDIR:tA}
|
||||
@ -27,10 +32,16 @@ _this_mk_dir := ${.PARSEDIR}
|
||||
.include <own.mk>
|
||||
.include <compiler.mk>
|
||||
|
||||
.MAIN: all
|
||||
|
||||
# should have been set by sys.mk
|
||||
CXX_SUFFIXES?= .cc .cpp .cxx .C
|
||||
CXX_SUFFIXES ?= .cc .cpp .cxx .C
|
||||
CCM_SUFFIXES ?= .ccm
|
||||
PCM ?= .pcm
|
||||
# ${PICO} is used for PIC object files.
|
||||
PICO ?= .pico
|
||||
|
||||
# SRCS which do not end up in OBJS
|
||||
NO_OBJS_SRCS_SUFFIXES ?= .h ${CCM_SUFFIXES} .sh
|
||||
OBJS_SRCS_FILTER += ${NO_OBJS_SRCS_SUFFIXES:@x@N*$x@:ts:}
|
||||
|
||||
.if defined(PROG_CXX) || ${SRCS:Uno:${CXX_SUFFIXES:S,^,N*,:ts:}} != ${SRCS:Uno:N/}
|
||||
_CCLINK ?= ${CXX}
|
||||
@ -82,9 +93,13 @@ _SKIP_BUILD = not building at level 0
|
||||
.endif
|
||||
.elif ${.TARGETS:U:Nall} == ""
|
||||
_SKIP_BUILD = not building at level 0
|
||||
# first .MAIN is what counts
|
||||
.MAIN: dirdeps
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.MAIN: all
|
||||
|
||||
.if !defined(.PARSEDIR)
|
||||
# no-op is the best we can do if not bmake.
|
||||
.WAIT:
|
||||
|
@ -59,7 +59,7 @@
|
||||
# Simon J. Gerraty <sjg@crufty.net>
|
||||
|
||||
# RCSid:
|
||||
# $Id: install-mk,v 1.244 2024/01/05 23:16:34 sjg Exp $
|
||||
# $Id: install-mk,v 1.250 2024/03/10 02:57:17 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 1994-2023 Simon J. Gerraty
|
||||
#
|
||||
@ -74,7 +74,7 @@
|
||||
# sjg@crufty.net
|
||||
#
|
||||
|
||||
MK_VERSION=20240105
|
||||
MK_VERSION=20240309
|
||||
OWNER=
|
||||
GROUP=
|
||||
MODE=444
|
||||
|
@ -1,4 +1,6 @@
|
||||
# $Id: install-new.mk,v 1.4 2020/08/19 17:51:53 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: install-new.mk,v 1.5 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2009, Simon J. Gerraty
|
||||
#
|
||||
|
@ -53,8 +53,10 @@
|
||||
# Simon J. Gerraty <sjg@crufty.net>
|
||||
#
|
||||
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# RCSid:
|
||||
# $Id: install-sh,v 1.25 2023/07/15 05:33:38 sjg Exp $
|
||||
# $Id: install-sh,v 1.26 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 1993-2023 Simon J. Gerraty
|
||||
#
|
||||
|
@ -1,6 +1,7 @@
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# RCSid:
|
||||
# $Id: java.mk,v 1.16 2021/12/08 05:56:50 sjg Exp $
|
||||
# $Id: java.mk,v 1.17 2024/02/17 17:26:57 sjg Exp $
|
||||
|
||||
# @(#) Copyright (c) 1998-2001, Simon J. Gerraty
|
||||
#
|
||||
|
@ -1,4 +1,6 @@
|
||||
# $Id: jobs.mk,v 1.16 2023/11/29 15:59:50 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: jobs.mk,v 1.17 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2012-2023, Simon J. Gerraty
|
||||
#
|
||||
|
@ -1,4 +1,6 @@
|
||||
# $Id: ldorder.mk,v 1.26 2021/12/08 05:56:50 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: ldorder.mk,v 1.27 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2015, Simon J. Gerraty
|
||||
#
|
||||
|
28
mk/lib.mk
28
mk/lib.mk
@ -1,7 +1,10 @@
|
||||
# $Id: lib.mk,v 1.81 2023/10/03 18:18:57 sjg Exp $
|
||||
# $Id: lib.mk,v 1.84 2024/02/19 00:06:19 sjg Exp $
|
||||
|
||||
.if !target(__${.PARSEFILE}__)
|
||||
__${.PARSEFILE}__: .NOTMAIN
|
||||
# should be set properly in sys.mk
|
||||
_this ?= ${.PARSEFILE:S,bsd.,,}
|
||||
|
||||
.if !target(__${_this}__)
|
||||
__${_this}__: .NOTMAIN
|
||||
|
||||
.include <init.mk>
|
||||
|
||||
@ -30,10 +33,9 @@ SHLIB_FULLVERSION := ${SHLIB_FULLVERSION}
|
||||
|
||||
# add additional suffixes not exported.
|
||||
# .po is used for profiling object files.
|
||||
# ${PICO} is used for PIC object files.
|
||||
PICO?= .pico
|
||||
.SUFFIXES: .out .a .ln ${PICO} .po .o .s .S .c .cc .C .m .F .f .r .y .l .cl .p .h
|
||||
.SUFFIXES: .sh .m4 .m
|
||||
.SUFFIXES: .out .a .ln ${PICO} ${PCM} .po .o .s .S .c ${CXX_SUFFIXES} \
|
||||
${CCM_SUFFIXES} .m .F .f .r .y .l .cl .p .h \
|
||||
.sh .m4 .m
|
||||
|
||||
CFLAGS+= ${COPTS}
|
||||
|
||||
@ -267,6 +269,10 @@ SHLIB_AGE != . ${.CURDIR}/shlib_version ; echo $$age
|
||||
.c.o:
|
||||
${COMPILE.c} ${.IMPSRC}
|
||||
|
||||
# precompiled C++ Modules
|
||||
${CCM_SUFFIXES:%=%${PCM}}:
|
||||
${COMPILE.pcm} ${.IMPSRC}
|
||||
|
||||
# for the normal .a we do not want to strip symbols
|
||||
${CXX_SUFFIXES:%=%.o}:
|
||||
${COMPILE.cc} ${.IMPSRC}
|
||||
@ -380,6 +386,8 @@ _LIBS+= ${libLDORDER_INC}
|
||||
|
||||
.include <ldorder.mk>
|
||||
.endif
|
||||
# avoid -dL errors
|
||||
LDADD_LDORDER ?=
|
||||
|
||||
.if !defined(_SKIP_BUILD)
|
||||
realbuild: ${_LIBS}
|
||||
@ -387,11 +395,13 @@ realbuild: ${_LIBS}
|
||||
|
||||
all: _SUBDIRUSE
|
||||
|
||||
.for s in ${SRCS:N*.h:M*/*}
|
||||
OBJS_SRCS = ${SRCS:${OBJS_SRCS_FILTER}}
|
||||
|
||||
.for s in ${OBJS_SRCS:M*/*}
|
||||
${.o ${PICO} .po .lo:L:@o@${s:T:R}$o@}: $s
|
||||
.endfor
|
||||
|
||||
OBJS+= ${SRCS:T:N*.h:R:S/$/.o/g}
|
||||
OBJS+= ${OBJS_SRCS:T:R:S/$/.o/g}
|
||||
.NOPATH: ${OBJS}
|
||||
|
||||
.if ${MK_LIBTOOL} == "yes"
|
||||
|
@ -1,4 +1,6 @@
|
||||
# $Id: libnames.mk,v 1.9 2020/08/19 17:51:53 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: libnames.mk,v 1.10 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2007-2009, Simon J. Gerraty
|
||||
#
|
||||
|
@ -1,4 +1,6 @@
|
||||
# $Id: libs.mk,v 1.6 2020/08/19 17:51:53 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: libs.mk,v 1.7 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2006, Simon J. Gerraty
|
||||
#
|
||||
|
@ -1,4 +1,6 @@
|
||||
# $Id: links.mk,v 1.7 2020/08/19 17:51:53 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: links.mk,v 1.8 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2005, Simon J. Gerraty
|
||||
#
|
||||
|
22
mk/man.mk
22
mk/man.mk
@ -1,7 +1,10 @@
|
||||
# $Id: man.mk,v 1.26 2023/12/30 02:10:38 sjg Exp $
|
||||
# $Id: man.mk,v 1.29 2024/02/19 00:06:19 sjg Exp $
|
||||
|
||||
.if !target(__${.PARSEFILE}__)
|
||||
__${.PARSEFILE}__: .NOTMAIN
|
||||
# should be set properly in sys.mk
|
||||
_this ?= ${.PARSEFILE:S,bsd.,,}
|
||||
|
||||
.if !target(__${_this}__)
|
||||
__${_this}__: .NOTMAIN
|
||||
|
||||
OPTIONS_DEFAULT_NO += CMT2DOC
|
||||
|
||||
@ -55,15 +58,18 @@ MANALL ?= ${MAN}
|
||||
|
||||
.if ${MK_CMT2DOC} == "yes"
|
||||
# use cmt2doc.py to extract manpages from source
|
||||
CMT2DOC?= cmt2doc.py
|
||||
CMT2DOC_OPTS?= ${CMT2DOC_ORGOPT} -pmS${.TARGET:E}
|
||||
CMT2DOC_SUFFIXES+= .c .h .sh .pl .py
|
||||
CMT2DOC ?= cmt2doc.py
|
||||
# -m produces man(7)
|
||||
# -mm produces mdoc(7)
|
||||
CMT2DOC_FLAGS ?= -pm
|
||||
CMT2DOC_OPTS ?= ${CMT2DOC_ORGOPT} -S${.TARGET:E}
|
||||
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}.new && \
|
||||
@${CMT2DOC} ${CMT2DOC_FLAGS} ${CMT2DOC_OPTS} ${.IMPSRC} > ${.TARGET:T}.new && \
|
||||
mv ${.TARGET:T}.new ${.TARGET:T}
|
||||
|
||||
.endif
|
||||
@ -111,7 +117,7 @@ _stage_man = stage_files
|
||||
STAGE_TARGETS += ${_stage_man}
|
||||
.for _page _as in ${MANALL:@x@$x ${x:T:S/.cat/./}@}
|
||||
${_stage_man}.man${_as:E}: ${_page}
|
||||
.if target(${_page:T}${MCOMPRESS_EXT})
|
||||
.if target(${_page:T}${MCOMPRESS_EXT:Umanz})
|
||||
${_man_stage}.man${_as:E}: ${_page:T}${MCOMPRESS_EXT}
|
||||
.endif
|
||||
STAGE_DIR.man${_as:E} ?= ${STAGE_OBJTOP}${MANDIR}/${MANTARGET}${_as:E}${MANSUBDIR}
|
||||
|
@ -1,4 +1,6 @@
|
||||
# $Id: manifest.mk,v 1.3 2020/08/19 17:51:53 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: manifest.mk,v 1.4 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2014, Simon J. Gerraty
|
||||
#
|
||||
|
@ -1,4 +1,6 @@
|
||||
# $Id: meta.autodep.mk,v 1.60 2024/01/09 23:42:22 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: meta.autodep.mk,v 1.62 2024/02/17 17:26:57 sjg Exp $
|
||||
|
||||
#
|
||||
# @(#) Copyright (c) 2010, Simon J. Gerraty
|
||||
@ -24,16 +26,16 @@ PICO?= .pico
|
||||
|
||||
.if defined(SRCS)
|
||||
.if ${MAKE_VERSION:U0} >= 20211212
|
||||
OBJ_EXTENSIONS += ${.SUFFIXES:M*o}
|
||||
OBJ_SUFFIXES += ${.SUFFIXES:M*o}
|
||||
.else
|
||||
# it would be nice to be able to query .SUFFIXES
|
||||
OBJ_EXTENSIONS += .o .po .lo ${PICO}
|
||||
OBJ_SUFFIXES += .o .po .lo ${PICO}
|
||||
.endif
|
||||
|
||||
# explicit dependencies help short-circuit .SUFFIX searches
|
||||
SRCS_DEP_FILTER+= N*.[hly]
|
||||
.for s in ${SRCS:${SRCS_DEP_FILTER:O:u:ts:}}
|
||||
.for e in ${OBJ_EXTENSIONS:O:u}
|
||||
.for e in ${OBJ_SUFFIXES:O:u}
|
||||
.if !target(${s:T:R}$e)
|
||||
${s:T:R}$e: $s
|
||||
.endif
|
||||
@ -190,7 +192,7 @@ DEPEND_SUFFIXES += .c .h .cpp .hpp .cxx .hxx .cc .hh
|
||||
@case "${.MAKE.META.FILES:T:M*.po.*}" in \
|
||||
*.po.*) mv $@.${.MAKE.PID} $@;; \
|
||||
*) { cat $@.${.MAKE.PID}; \
|
||||
sed ${OBJ_EXTENSIONS:N.o:N.po:@o@-e 's,\$o:,.o:,'@} \
|
||||
sed ${OBJ_SUFFIXES:N.o:N.po:@o@-e 's,\$o:,.o:,'@} \
|
||||
-e 's,\.o:,.po:,' $@.${.MAKE.PID}; } | sort -u > $@; \
|
||||
rm -f $@.${.MAKE.PID};; \
|
||||
esac
|
||||
@ -331,4 +333,6 @@ _reldir_failed: .NOMETA
|
||||
.ERROR: _reldir_failed
|
||||
.endif
|
||||
|
||||
.-include <ccm.dep.mk>
|
||||
|
||||
.endif
|
||||
|
@ -1,4 +1,6 @@
|
||||
# $Id: meta.stage.mk,v 1.67 2023/04/17 01:22:10 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: meta.stage.mk,v 1.69 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2011-2017, Simon J. Gerraty
|
||||
#
|
||||
@ -212,7 +214,7 @@ stage_files.$s: .dirdep
|
||||
STAGE_FILES ?= ${.ALLSRC:N.dirdep:Nstage_*}
|
||||
stage_files: .dirdep
|
||||
.endif
|
||||
@${STAGE_FILE_SCRIPT}; StageFiles ${FLAGS.$@} ${STAGE_FILES_DIR.$s:U${STAGE_DIR.$s}:${STAGE_DIR_FILTER}} ${STAGE_FILES.$s:O}
|
||||
@${STAGE_FILE_SCRIPT}; StageFiles ${FLAGS.$@:U} ${STAGE_FILES_DIR.$s:U${STAGE_DIR.$s}:${STAGE_DIR_FILTER}} ${STAGE_FILES.$s:O}
|
||||
@touch $@
|
||||
.endif
|
||||
.endif
|
||||
|
@ -1,4 +1,6 @@
|
||||
# $Id: meta.subdir.mk,v 1.13 2021/01/05 22:24:37 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: meta.subdir.mk,v 1.14 2024/02/17 17:26:57 sjg Exp $
|
||||
|
||||
#
|
||||
# @(#) Copyright (c) 2010, Simon J. Gerraty
|
||||
|
@ -1,4 +1,6 @@
|
||||
# $Id: meta.sys.mk,v 1.51 2023/05/11 20:05:32 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: meta.sys.mk,v 1.54 2024/03/10 15:53:51 sjg Exp $
|
||||
|
||||
#
|
||||
# @(#) Copyright (c) 2010-2023, Simon J. Gerraty
|
||||
@ -82,6 +84,7 @@ META2DEPS := ${META2DEPS}
|
||||
|
||||
MAKE_PRINT_VAR_ON_ERROR += \
|
||||
.ERROR_TARGET \
|
||||
.ERROR_EXIT \
|
||||
.ERROR_META_FILE \
|
||||
.MAKE.LEVEL \
|
||||
MAKEFILE \
|
||||
@ -98,10 +101,13 @@ SB = ${SRCTOP:H}
|
||||
ERROR_LOGDIR ?= ${SB}/error
|
||||
meta_error_log = ${ERROR_LOGDIR}/meta-${.MAKE.PID}.log
|
||||
|
||||
# we are not interested in make telling us a failure happened elsewhere
|
||||
.ERROR: _metaError
|
||||
# We are interested here in the target(s) that caused the build to fail.
|
||||
# We want to ignore targets that were "aborted" due to failure
|
||||
# elsewhere per the message below or a sub-make may just exit 6.
|
||||
_metaError: .NOMETA .NOTMAIN
|
||||
-@[ "${.ERROR_META_FILE}" ] && { \
|
||||
-@[ ${.ERROR_EXIT:U0} = 6 ] && exit 0; \
|
||||
[ "${.ERROR_META_FILE}" ] && { \
|
||||
grep -q 'failure has been detected in another branch' ${.ERROR_META_FILE} && exit 0; \
|
||||
mkdir -p ${meta_error_log:H}; \
|
||||
cp ${.ERROR_META_FILE} ${meta_error_log}; \
|
||||
|
@ -36,8 +36,10 @@
|
||||
"""
|
||||
|
||||
"""
|
||||
SPDX-License-Identifier: BSD-2-Clause
|
||||
|
||||
RCSid:
|
||||
$Id: meta2deps.py,v 1.45 2023/01/18 01:35:24 sjg Exp $
|
||||
$Id: meta2deps.py,v 1.47 2024/02/17 17:26:57 sjg Exp $
|
||||
|
||||
Copyright (c) 2011-2020, Simon J. Gerraty
|
||||
Copyright (c) 2011-2017, Juniper Networks, Inc.
|
||||
@ -74,8 +76,10 @@
|
||||
def resolve(path, cwd, last_dir=None, debug=0, debug_out=sys.stderr):
|
||||
"""
|
||||
Return an absolute path, resolving via cwd or last_dir if needed.
|
||||
|
||||
Cleanup any leading ``./`` and trailing ``/.``
|
||||
"""
|
||||
if path.endswith('/.'):
|
||||
while path.endswith('/.'):
|
||||
path = path[0:-2]
|
||||
if len(path) > 0 and path[0] == '/':
|
||||
if os.path.exists(path):
|
||||
@ -86,7 +90,9 @@ def resolve(path, cwd, last_dir=None, debug=0, debug_out=sys.stderr):
|
||||
if path == '.':
|
||||
return cwd
|
||||
if path.startswith('./'):
|
||||
return cwd + path[1:]
|
||||
while path.startswith('./'):
|
||||
path = path[1:]
|
||||
return cwd + path
|
||||
if last_dir == cwd:
|
||||
last_dir = None
|
||||
for d in [last_dir, cwd]:
|
||||
@ -144,6 +150,7 @@ def abspath(path, cwd, last_dir=None, debug=0, debug_out=sys.stderr):
|
||||
return None
|
||||
if (path.find('/') < 0 or
|
||||
path.find('./') > 0 or
|
||||
path.find('/../') > 0 or
|
||||
path.endswith('/..')):
|
||||
path = cleanpath(path)
|
||||
return path
|
||||
|
@ -77,8 +77,10 @@
|
||||
|
||||
|
||||
# RCSid:
|
||||
# $Id: meta2deps.sh,v 1.20 2023/01/18 01:35:24 sjg Exp $
|
||||
# $Id: meta2deps.sh,v 1.21 2024/02/17 17:26:57 sjg Exp $
|
||||
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# Copyright (c) 2010-2013, Juniper Networks, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
|
@ -1,6 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
# $Id: mkopt.sh,v 1.15 2022/06/06 21:34:21 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: mkopt.sh,v 1.16 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2014-2022, Simon J. Gerraty
|
||||
#
|
||||
|
@ -76,7 +76,9 @@
|
||||
#
|
||||
|
||||
# RCSid:
|
||||
# $Id: newlog.sh,v 1.26 2021/04/30 16:29:02 sjg Exp $
|
||||
# $Id: newlog.sh,v 1.27 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# @(#) Copyright (c) 1993-2016 Simon J. Gerraty
|
||||
#
|
||||
|
11
mk/obj.mk
11
mk/obj.mk
@ -1,4 +1,6 @@
|
||||
# $Id: obj.mk,v 1.17 2021/12/08 05:56:50 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: obj.mk,v 1.19 2024/02/19 00:06:19 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 1999-2010, Simon J. Gerraty
|
||||
#
|
||||
@ -13,8 +15,11 @@
|
||||
# sjg@crufty.net
|
||||
#
|
||||
|
||||
.if !target(__${.PARSEFILE:S,bsd.,,}__)
|
||||
__${.PARSEFILE:S,bsd.,,}__: .NOTMAIN
|
||||
# should be set properly in sys.mk
|
||||
_this ?= ${.PARSEFILE:S,bsd.,,}
|
||||
|
||||
.if !target(__${_this}__)
|
||||
__${_this}__: .NOTMAIN
|
||||
|
||||
.include <init.mk>
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
# $Id: options.mk,v 1.19 2021/10/03 16:29:51 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: options.mk,v 1.20 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2012, Simon J. Gerraty
|
||||
#
|
||||
|
30
mk/own.mk
30
mk/own.mk
@ -1,7 +1,10 @@
|
||||
# $Id: own.mk,v 1.45 2023/12/30 02:10:38 sjg Exp $
|
||||
# $Id: own.mk,v 1.47 2024/02/19 00:06:19 sjg Exp $
|
||||
|
||||
.if !target(__${.PARSEFILE}__)
|
||||
__${.PARSEFILE}__: .NOTMAIN
|
||||
# should be set properly in sys.mk
|
||||
_this ?= ${.PARSEFILE:S,bsd.,,}
|
||||
|
||||
.if !target(__${_this}__)
|
||||
__${_this}__: .NOTMAIN
|
||||
|
||||
.if !target(__init.mk__)
|
||||
.include "init.mk"
|
||||
@ -37,27 +40,6 @@ libprefix?= /usr
|
||||
# FreeBSD at least does not set this
|
||||
MACHINE_ARCH?= ${MACHINE}
|
||||
# we need to make sure these are defined too in case sys.mk fails to.
|
||||
COMPILE.s?= ${CC} ${AFLAGS} -c
|
||||
LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS}
|
||||
COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
|
||||
LINK.S?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
|
||||
COMPILE.c?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
|
||||
LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
|
||||
CXXFLAGS?= ${CFLAGS}
|
||||
COMPILE.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
|
||||
LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
|
||||
COMPILE.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
|
||||
LINK.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
|
||||
COMPILE.f?= ${FC} ${FFLAGS} -c
|
||||
LINK.f?= ${FC} ${FFLAGS} ${LDFLAGS}
|
||||
COMPILE.F?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
|
||||
LINK.F?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
|
||||
COMPILE.r?= ${FC} ${FFLAGS} ${RFLAGS} -c
|
||||
LINK.r?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
|
||||
LEX.l?= ${LEX} ${LFLAGS}
|
||||
COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
|
||||
LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
|
||||
YACC.y?= ${YACC} ${YFLAGS}
|
||||
|
||||
# for suffix rules
|
||||
IMPFLAGS?= ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}}
|
||||
|
@ -1,4 +1,6 @@
|
||||
# $Id: posix.mk,v 1.2 2022/03/25 23:55:37 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: posix.mk,v 1.3 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2022, Simon J. Gerraty
|
||||
#
|
||||
|
@ -1,4 +1,6 @@
|
||||
# $Id: prlist.mk,v 1.5 2021/12/08 05:56:50 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: prlist.mk,v 1.6 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2006, Simon J. Gerraty
|
||||
#
|
||||
|
46
mk/prog.mk
46
mk/prog.mk
@ -1,7 +1,10 @@
|
||||
# $Id: prog.mk,v 1.40 2023/10/02 21:35:43 sjg Exp $
|
||||
# $Id: prog.mk,v 1.44 2024/02/19 00:06:19 sjg Exp $
|
||||
|
||||
.if !target(__${.PARSEFILE}__)
|
||||
__${.PARSEFILE}__: .NOTMAIN
|
||||
# should be set properly in sys.mk
|
||||
_this ?= ${.PARSEFILE:S,bsd.,,}
|
||||
|
||||
.if !target(__${_this}__)
|
||||
__${_this}__: .NOTMAIN
|
||||
|
||||
.include <init.mk>
|
||||
|
||||
@ -11,7 +14,7 @@ _sect:=${MAN:E}
|
||||
MAN${_sect}=${MAN}
|
||||
.endif
|
||||
|
||||
.SUFFIXES: .out .o .c .cc .C .y .l .s .8 .7 .6 .5 .4 .3 .2 .1 .0
|
||||
.SUFFIXES: .out .o .c ${CXX_SUFFIXES} .y .l ${CCM_SUFFIXES} ${PCM}
|
||||
|
||||
CFLAGS+= ${COPTS}
|
||||
|
||||
@ -62,14 +65,21 @@ LDADD_LAST+= ${LDADD_LIBC_P}
|
||||
.if defined(SHAREDSTRINGS)
|
||||
CLEANFILES+=strings
|
||||
.c.o:
|
||||
${CC} -E ${CFLAGS} ${.IMPSRC} | xstr -c -
|
||||
@${CC} ${CFLAGS} -c x.c -o ${.TARGET}
|
||||
@${COMPILE.c:N-c} -E ${.IMPSRC} | xstr -c -
|
||||
@${COMPILE.c} x.c -o ${.TARGET}
|
||||
@rm -f x.c
|
||||
|
||||
${CXX_SUFFIXES:%=%.o}:
|
||||
${CXX} -E ${CXXFLAGS} ${.IMPSRC} | xstr -c -
|
||||
# precompiled C++ Modules
|
||||
${CCM_SUFFIXES:%=%${PCM}}:
|
||||
@${COMIPILE.cc:N-c} -E ${.IMPSRC} | xstr -c -
|
||||
@mv -f x.c x.cc
|
||||
@${CXX} ${CXXFLAGS} -c x.cc -o ${.TARGET}
|
||||
@${COMPILE.pcm} x.cc -o ${.TARGET}
|
||||
@rm -f x.cc
|
||||
|
||||
${CXX_SUFFIXES:N.c*m:%=%.o}:
|
||||
@${COMIPILE.cc:N-c} -E ${.IMPSRC} | xstr -c -
|
||||
@mv -f x.c x.cc
|
||||
@${COMPILE.cc} x.cc -o ${.TARGET}
|
||||
@rm -f x.cc
|
||||
.endif
|
||||
|
||||
@ -81,12 +91,19 @@ _SUPCXX?= -lstdc++ -lm
|
||||
.if defined(PROG)
|
||||
BINDIR ?= ${prefix}/bin
|
||||
|
||||
SRCS?= ${PROG}.c
|
||||
.for s in ${SRCS:N*.h:N*.sh:M*/*}
|
||||
.if empty(SRCS)
|
||||
# init.mk handling of QUALIFIED_VAR_LIST means
|
||||
# SRCS will be defined - even if empty.
|
||||
SRCS = ${PROG}.c
|
||||
.endif
|
||||
|
||||
SRCS ?= ${PROG}.c
|
||||
OBJS_SRCS = ${SRCS:${OBJS_SRCS_FILTER}}
|
||||
.for s in ${OBJS_SRCS:M*/*}
|
||||
${.o .po .lo:L:@o@${s:T:R}$o@}: $s
|
||||
.endfor
|
||||
.if !empty(SRCS:N*.h:N*.sh)
|
||||
OBJS+= ${SRCS:T:N*.h:N*.sh:R:S/$/.o/g}
|
||||
.if !empty(OBJS_SRCS)
|
||||
OBJS+= ${OBJS_SRCS:T:R:S/$/.o/g}
|
||||
LOBJS+= ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
|
||||
.endif
|
||||
|
||||
@ -111,6 +128,9 @@ ${PROG}: ldorder
|
||||
|
||||
.include <ldorder.mk>
|
||||
.endif
|
||||
# avoid -dL errors
|
||||
LDADD_LDORDER ?=
|
||||
LDSTATIC ?=
|
||||
|
||||
.if defined(DESTDIR) && exists(${LIBCRT0}) && ${LIBCRT0} != "/dev/null"
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
# $Id: progs.mk,v 1.16 2020/08/19 17:51:53 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: progs.mk,v 1.17 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2006, Simon J. Gerraty
|
||||
#
|
||||
|
@ -1,4 +1,6 @@
|
||||
# $Id: rst2htm.mk,v 1.14 2023/09/19 22:27:28 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: rst2htm.mk,v 1.15 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2009, Simon J. Gerraty
|
||||
#
|
||||
|
@ -1,4 +1,6 @@
|
||||
# $Id: scripts.mk,v 1.4 2020/08/19 17:51:53 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: scripts.mk,v 1.5 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2006, Simon J. Gerraty
|
||||
#
|
||||
|
@ -1,4 +1,6 @@
|
||||
# $Id: srctop.mk,v 1.4 2020/08/19 17:51:53 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: srctop.mk,v 1.5 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2012, Simon J. Gerraty
|
||||
#
|
||||
|
@ -37,7 +37,9 @@
|
||||
#
|
||||
|
||||
# RCSid:
|
||||
# $Id: stage-install.sh,v 1.10 2021/11/17 07:06:31 sjg Exp $
|
||||
# $Id: stage-install.sh,v 1.11 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# @(#) Copyright (c) 2013-2020, Simon J. Gerraty
|
||||
#
|
||||
|
135
mk/subdir.mk
135
mk/subdir.mk
@ -1,14 +1,42 @@
|
||||
# $Id: subdir.mk,v 1.16 2017/02/08 22:16:59 sjg Exp $
|
||||
# skip missing directories...
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: subdir.mk,v 1.22 2024/02/19 00:06:19 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2002-2024, 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
|
||||
|
||||
# $NetBSD: bsd.subdir.mk,v 1.11 1996/04/04 02:05:06 jtc Exp $
|
||||
# @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91
|
||||
# if SUBDIR=@auto replace that with each subdir that has
|
||||
# a [Mm]akefile.
|
||||
#
|
||||
# Unless SUBDIR_MUST_EXIST is defined, missing subdirs
|
||||
# are ignored (to allow for sparse checkout).
|
||||
#
|
||||
# If you use _SUBDIRUSE for a target you may need to add it to
|
||||
# SUBDIR_TARGETS.
|
||||
|
||||
.if ${.MAKE.LEVEL} == 0 && ${.MAKE.MODE:Uno:Mmeta*} != ""
|
||||
# should be set properly in sys.mk
|
||||
_this ?= ${.PARSEFILE:S,bsd.,,}
|
||||
|
||||
.if !target(__${_this}__)
|
||||
__${_this}__: .NOTMAIN
|
||||
|
||||
.if defined(SUBDIR)
|
||||
|
||||
.if ${.MAKE.LEVEL} == 0 && ${MK_DIRDEPS_BUILD:Uno} == "yes"
|
||||
.include <meta.subdir.mk>
|
||||
# keep everyone happy
|
||||
_SUBDIRUSE:
|
||||
.elif !commands(_SUBDIRUSE) && !defined(NO_SUBDIR) && !defined(NOSUBDIR)
|
||||
.-include <local.subdir.mk>
|
||||
.-include <${.CURDIR}/Makefile.inc>
|
||||
.if !target(.MAIN)
|
||||
.MAIN: all
|
||||
@ -16,49 +44,28 @@ _SUBDIRUSE:
|
||||
|
||||
ECHO_DIR ?= echo
|
||||
.ifdef SUBDIR_MUST_EXIST
|
||||
MISSING_DIR=echo "Missing ===> ${.CURDIR}/$${entry}"; exit 1
|
||||
MISSING_DIR=echo "Missing ===> ${.CURDIR}/$$_dir"; exit 1
|
||||
.else
|
||||
MISSING_DIR=echo "Skipping ===> ${.CURDIR}/$${entry}"; continue
|
||||
MISSING_DIR=echo "Skipping ===> ${.CURDIR}/$$_dir"; exit 0
|
||||
.endif
|
||||
|
||||
_SUBDIRUSE: .USE
|
||||
.if defined(SUBDIR)
|
||||
# the actual implementation
|
||||
# our target should be of the form ${_target}-${_dir}
|
||||
_SUBDIR_USE: .USE
|
||||
@Exists() { test -f $$1; }; \
|
||||
for entry in ${SUBDIR}; do \
|
||||
(set -e; \
|
||||
if Exists ${.CURDIR}/$${entry}.${MACHINE}/[mM]akefile; then \
|
||||
_newdir_="$${entry}.${MACHINE}"; \
|
||||
elif Exists ${.CURDIR}/$${entry}/[mM]akefile; then \
|
||||
_newdir_="$${entry}"; \
|
||||
else \
|
||||
${MISSING_DIR}; \
|
||||
fi; \
|
||||
if test X"${_THISDIR_}" = X""; then \
|
||||
_nextdir_="$${_newdir_}"; \
|
||||
else \
|
||||
_nextdir_="$${_THISDIR_}/$${_newdir_}"; \
|
||||
fi; \
|
||||
${ECHO_DIR} "===> $${_nextdir_}"; \
|
||||
cd ${.CURDIR}/$${_newdir_}; \
|
||||
${.MAKE} _THISDIR_="$${_nextdir_}" \
|
||||
${.TARGET:S/realinstall/install/:S/.depend/depend/}) || exit 1; \
|
||||
done
|
||||
|
||||
${SUBDIR}::
|
||||
@set -e; _r=${.CURDIR}/; \
|
||||
if test -z "${.TARGET:M/*}"; then \
|
||||
if test -d ${.CURDIR}/${.TARGET}.${MACHINE}; then \
|
||||
_newdir_=${.TARGET}.${MACHINE}; \
|
||||
else \
|
||||
_newdir_=${.TARGET}; \
|
||||
fi; \
|
||||
else \
|
||||
_r= _newdir_=${.TARGET}; \
|
||||
_dir=${.TARGET:C/^.*-//} \
|
||||
_target=${.TARGET:C/-.*//:S/real//:S/.depend/depend/}; \
|
||||
if ! Exists ${.CURDIR}/$$_dir/[mM]akefile; then \
|
||||
${MISSING_DIR}; \
|
||||
fi; \
|
||||
${ECHO_DIR} "===> $${_newdir_}"; \
|
||||
cd $${_r}$${_newdir_}; \
|
||||
${.MAKE} _THISDIR_="$${_newdir_}" all
|
||||
.endif
|
||||
if test X"${_THISDIR_}" = X""; then \
|
||||
_nextdir_="$$_dir"; \
|
||||
else \
|
||||
_nextdir_="$${_THISDIR_}/$$_dir"; \
|
||||
fi; \
|
||||
${ECHO_DIR} "===> $${_nextdir_} ($$_target)"; \
|
||||
(cd ${.CURDIR}/$$_dir && \
|
||||
${.MAKE} _THISDIR_="$${_nextdir_}" $$_target)
|
||||
|
||||
.if !target(install)
|
||||
.if !target(beforeinstall)
|
||||
@ -73,26 +80,54 @@ afterinstall: realinstall
|
||||
realinstall: beforeinstall _SUBDIRUSE
|
||||
.endif
|
||||
|
||||
.if defined(SRCS)
|
||||
etags: ${SRCS}
|
||||
-cd ${.CURDIR}; etags `echo ${.ALLSRC:N*.h} | sed 's;${.CURDIR}/;;'`
|
||||
.endif
|
||||
# the interface from others
|
||||
# this may require additions to SUBDIR_TAREGTS
|
||||
_SUBDIRUSE: .USE subdir-${.TARGET}
|
||||
|
||||
SUBDIR_TARGETS += \
|
||||
all \
|
||||
clean \
|
||||
cleandir \
|
||||
includes \
|
||||
install \
|
||||
depend \
|
||||
lint \
|
||||
obj \
|
||||
realinstall \
|
||||
tags \
|
||||
etags
|
||||
|
||||
.for t in ${SUBDIR_TARGETS:O:u}
|
||||
$t: _SUBDIRUSE
|
||||
.if ${SUBDIR} == "@auto"
|
||||
SUBDIR = ${echo ${.CURDIR}/*/[Mm]akefile:L:sh:H:T:O:N\*}
|
||||
.endif
|
||||
|
||||
__subdirs =
|
||||
.for d in ${SUBDIR}
|
||||
.if $d != ".WAIT" && exists(${.CURDIR}/$d.${MACHINE})
|
||||
__subdirs += $d.${MACHINE}
|
||||
.else
|
||||
__subdirs += $d
|
||||
.endif
|
||||
.endfor
|
||||
|
||||
.for t in ${SUBDIR_TARGETS:O:u}
|
||||
__subdir_$t =
|
||||
.for d in ${__subdirs}
|
||||
.if $d == ".WAIT"
|
||||
__subdir_$t += $d
|
||||
.elif !commands($t-$d)
|
||||
$t-$d: .PHONY .MAKE _SUBDIR_USE
|
||||
__subdir_$t += $t-$d
|
||||
.endif
|
||||
.endfor
|
||||
subdir-$t: .PHONY ${__subdir_$t}
|
||||
$t: subdir-$t
|
||||
.endfor
|
||||
|
||||
.else
|
||||
_SUBDIRUSE:
|
||||
.endif # SUBDIR
|
||||
|
||||
.include <own.mk>
|
||||
.if make(destroy*)
|
||||
.include <obj.mk>
|
||||
@ -100,3 +135,5 @@ $t: _SUBDIRUSE
|
||||
.endif
|
||||
# make sure this exists
|
||||
all:
|
||||
|
||||
.endif
|
||||
|
195
mk/suffixes.mk
Normal file
195
mk/suffixes.mk
Normal file
@ -0,0 +1,195 @@
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: suffixes.mk,v 1.3 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2024, 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
|
||||
#
|
||||
|
||||
# some reasonable defaults
|
||||
.SUFFIXES: .out .a .ln .o ${PICO} ${PCM} .s .S .c ${CXX_SUFFIXES} \
|
||||
${CCM_SUFFIXES} .F .f .r .y .l .cl .p .h \
|
||||
.sh .m4 .cpp-out
|
||||
|
||||
#
|
||||
AFLAGS ?=
|
||||
ARFLAGS ?= r
|
||||
.if ${MACHINE_ARCH} == "sparc64"
|
||||
AFLAGS+= -Wa,-Av9a
|
||||
.endif
|
||||
AS ?= as
|
||||
CC ?= cc
|
||||
CFLAGS ?= ${DBG}
|
||||
CXX ?= c++
|
||||
CXXFLAGS ?= ${CFLAGS}
|
||||
CXXFLAGS ?= ${CFLAGS}
|
||||
DBG ?= -O2
|
||||
FC ?= f77
|
||||
FFLAGS ?= -O
|
||||
INSTALL ?= install
|
||||
LD ?= ld
|
||||
LEX ?= lex
|
||||
LFLAGS ?=
|
||||
NM ?= nm
|
||||
OBJC ?= ${CC}
|
||||
OBJCFLAGS ?= ${CFLAGS}
|
||||
PC ?= pc
|
||||
PFLAGS ?=
|
||||
RFLAGS ?=
|
||||
SIZE ?= size
|
||||
YACC ?= yacc
|
||||
YFLAGS ?=
|
||||
|
||||
COMPILE.s ?= ${CC} ${AFLAGS} -c
|
||||
LINK.s ?= ${CC} ${AFLAGS} ${LDFLAGS}
|
||||
COMPILE.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
|
||||
LINK.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
|
||||
COMPILE.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
|
||||
LINK.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
|
||||
COMPILE.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
|
||||
COMPILE.pcm ?= ${COMPILE.cc:N-c} --precompile -c
|
||||
LINK.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
|
||||
COMPILE.m ?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
|
||||
LINK.m ?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
|
||||
COMPILE.f ?= ${FC} ${FFLAGS} -c
|
||||
LINK.f ?= ${FC} ${FFLAGS} ${LDFLAGS}
|
||||
COMPILE.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
|
||||
LINK.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
|
||||
COMPILE.r ?= ${FC} ${FFLAGS} ${RFLAGS} -c
|
||||
LINK.r ?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
|
||||
LEX.l ?= ${LEX} ${LFLAGS}
|
||||
COMPILE.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
|
||||
LINK.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
|
||||
YACC.y ?= ${YACC} ${YFLAGS}
|
||||
LEX.l ?= ${LEX} ${LFLAGS}
|
||||
|
||||
# C
|
||||
.c:
|
||||
${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
|
||||
.c.o:
|
||||
${COMPILE.c} ${.IMPSRC}
|
||||
.c.a:
|
||||
${COMPILE.c} ${.IMPSRC}
|
||||
${AR} ${ARFLAGS} $@ $*.o
|
||||
rm -f $*.o
|
||||
.c.ln:
|
||||
${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
|
||||
|
||||
# C++
|
||||
${CXX_SUFFIXES}:
|
||||
${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
|
||||
${CXX_SUFFIXES:%=%.o}:
|
||||
${COMPILE.cc} ${.IMPSRC}
|
||||
${CXX_SUFFIXES:%=%.a}:
|
||||
${COMPILE.cc} ${.IMPSRC}
|
||||
${AR} ${ARFLAGS} $@ $*.o
|
||||
rm -f $*.o
|
||||
|
||||
# C++ precompiled modules
|
||||
${CCM_SUFFIXES:%=%${PCM}}:
|
||||
@${COMPILE.pcm} ${.IMPSRC}
|
||||
|
||||
# Fortran/Ratfor
|
||||
.f:
|
||||
${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
|
||||
.f.o:
|
||||
${COMPILE.f} ${.IMPSRC}
|
||||
.f.a:
|
||||
${COMPILE.f} ${.IMPSRC}
|
||||
${AR} ${ARFLAGS} $@ $*.o
|
||||
rm -f $*.o
|
||||
|
||||
.F:
|
||||
${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
|
||||
.F.o:
|
||||
${COMPILE.F} ${.IMPSRC}
|
||||
.F.a:
|
||||
${COMPILE.F} ${.IMPSRC}
|
||||
${AR} ${ARFLAGS} $@ $*.o
|
||||
rm -f $*.o
|
||||
|
||||
.r:
|
||||
${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
|
||||
.r.o:
|
||||
${COMPILE.r} ${.IMPSRC}
|
||||
.r.a:
|
||||
${COMPILE.r} ${.IMPSRC}
|
||||
${AR} ${ARFLAGS} $@ $*.o
|
||||
rm -f $*.o
|
||||
|
||||
# Pascal
|
||||
.p:
|
||||
${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
|
||||
.p.o:
|
||||
${COMPILE.p} ${.IMPSRC}
|
||||
.p.a:
|
||||
${COMPILE.p} ${.IMPSRC}
|
||||
${AR} ${ARFLAGS} $@ $*.o
|
||||
rm -f $*.o
|
||||
|
||||
# Assembly
|
||||
.s:
|
||||
${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
|
||||
.s.o:
|
||||
${COMPILE.s} ${.IMPSRC}
|
||||
.s.a:
|
||||
${COMPILE.s} ${.IMPSRC}
|
||||
${AR} ${ARFLAGS} $@ $*.o
|
||||
rm -f $*.o
|
||||
.S:
|
||||
${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
|
||||
.S.o:
|
||||
${COMPILE.S} ${.IMPSRC}
|
||||
.S.a:
|
||||
${COMPILE.S} ${.IMPSRC}
|
||||
${AR} ${ARFLAGS} $@ $*.o
|
||||
rm -f $*.o
|
||||
|
||||
# Lex
|
||||
.l:
|
||||
${LEX.l} ${.IMPSRC}
|
||||
${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll
|
||||
rm -f lex.yy.c
|
||||
.l.c:
|
||||
${LEX.l} ${.IMPSRC}
|
||||
mv lex.yy.c ${.TARGET}
|
||||
.l.o:
|
||||
${LEX.l} ${.IMPSRC}
|
||||
${COMPILE.c} -o ${.TARGET} lex.yy.c
|
||||
rm -f lex.yy.c
|
||||
|
||||
# Yacc
|
||||
.y:
|
||||
${YACC.y} ${.IMPSRC}
|
||||
${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS}
|
||||
rm -f y.tab.c
|
||||
.y.c:
|
||||
${YACC.y} ${.IMPSRC}
|
||||
mv y.tab.c ${.TARGET}
|
||||
.y.o:
|
||||
${YACC.y} ${.IMPSRC}
|
||||
${COMPILE.c} -o ${.TARGET} y.tab.c
|
||||
rm -f y.tab.c
|
||||
|
||||
# Shell
|
||||
.sh:
|
||||
rm -f ${.TARGET}
|
||||
cp ${.IMPSRC} ${.TARGET}
|
||||
chmod a+x ${.TARGET}
|
||||
|
||||
|
||||
# this often helps with debugging
|
||||
.c.cpp-out:
|
||||
@${COMPILE.c:N-c} -E ${.IMPSRC} | grep -v '^[ ]*$$'
|
||||
|
||||
${CXX_SUFFIXES:%=%.cpp-out}:
|
||||
@${COMPILE.cc:N-c} -E ${.IMPSRC} | grep -v '^[ ]*$$'
|
@ -1,4 +1,6 @@
|
||||
# $Id: sys.clean-env.mk,v 1.25 2022/09/09 17:44:29 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: sys.clean-env.mk,v 1.26 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2009, Simon J. Gerraty
|
||||
#
|
||||
|
@ -1,4 +1,6 @@
|
||||
# $Id: sys.debug.mk,v 1.2 2020/08/19 17:51:53 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: sys.debug.mk,v 1.3 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2009, Simon J. Gerraty
|
||||
#
|
||||
|
@ -1,4 +1,6 @@
|
||||
# $Id: sys.dependfile.mk,v 1.10 2023/05/10 19:23:26 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: sys.dependfile.mk,v 1.11 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2012-2023, Simon J. Gerraty
|
||||
#
|
||||
|
@ -1,4 +1,6 @@
|
||||
# $Id: sys.dirdeps.mk,v 1.12 2023/05/14 16:16:03 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: sys.dirdeps.mk,v 1.14 2024/02/25 19:12:13 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2012-2023, Simon J. Gerraty
|
||||
#
|
||||
@ -31,9 +33,10 @@ _PARSEDIR ?= ${.PARSEDIR:tA}
|
||||
|
||||
.if ${.MAKE.LEVEL} == 0
|
||||
# make sure dirdeps target exists and do it first
|
||||
# init.mk will set .MAIN to 'dirdeps' if appropriate
|
||||
# as will dirdeps-targets.mk for top-level builds.
|
||||
# This allows a Makefile to have more control.
|
||||
dirdeps:
|
||||
# first .MAIN is what counts
|
||||
.MAIN: dirdeps
|
||||
.NOPATH: dirdeps
|
||||
all: dirdeps .WAIT
|
||||
.endif
|
||||
|
19
mk/sys.mk
19
mk/sys.mk
@ -1,4 +1,6 @@
|
||||
# $Id: sys.mk,v 1.57 2023/07/14 16:30:37 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: sys.mk,v 1.60 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2003-2023, Simon J. Gerraty
|
||||
#
|
||||
@ -46,6 +48,11 @@ _TARGETS := ${.TARGETS}
|
||||
# Popular suffixes for C++
|
||||
CXX_SUFFIXES += .cc .cpp .cxx .C
|
||||
CXX_SUFFIXES := ${CXX_SUFFIXES:O:u}
|
||||
# and C++ Modules
|
||||
CCM_SUFFIXES += .ccm
|
||||
CCM_SUFFIXES := ${CCM_SUFFIXES:O:u}
|
||||
# precompiled modules
|
||||
PCM ?= .pcm
|
||||
|
||||
SYS_MK ?= ${.PARSEDIR:tA}/${.PARSEFILE}
|
||||
SYS_MK := ${SYS_MK}
|
||||
@ -152,14 +159,8 @@ Mkdirs= Mkdirs() { \
|
||||
mkdir $$d || exit $$?; \
|
||||
done; }
|
||||
|
||||
# this often helps with debugging
|
||||
.SUFFIXES: .cpp-out
|
||||
|
||||
.c.cpp-out:
|
||||
@${COMPILE.c:N-c} -E ${.IMPSRC} | grep -v '^[ ]*$$'
|
||||
|
||||
${CXX_SUFFIXES:%=%.cpp-out}:
|
||||
@${COMPILE.cc:N-c} -E ${.IMPSRC} | grep -v '^[ ]*$$'
|
||||
# pick up generic suffix rules
|
||||
.include <suffixes.mk>
|
||||
|
||||
# late customizations
|
||||
.-include <local.sys.mk>
|
||||
|
@ -1,4 +1,6 @@
|
||||
# $Id: sys.vars.mk,v 1.15 2023/05/16 16:41:52 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: sys.vars.mk,v 1.16 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2003-2023, Simon J. Gerraty
|
||||
#
|
||||
|
@ -1,9 +1,7 @@
|
||||
# $Id: Generic.mk,v 1.19 2022/03/25 23:43:06 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: Generic.mk,v 1.21 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
|
||||
# some reasonable defaults
|
||||
.SUFFIXES: .out .a .ln .o .s .S .c ${CXX_SUFFIXES} .F .f .r .y .l .cl .p .h
|
||||
.SUFFIXES: .sh .m4
|
||||
|
||||
.LIBS: .a
|
||||
|
||||
@ -27,178 +25,4 @@ MACHINE_ARCH = ${MACHINE_ARCH.${MACHINE}}
|
||||
TSORT += -q
|
||||
.endif
|
||||
|
||||
ARFLAGS ?= r
|
||||
|
||||
AS ?= as
|
||||
AFLAGS ?=
|
||||
.if ${MACHINE_ARCH} == "sparc64"
|
||||
AFLAGS+= -Wa,-Av9a
|
||||
.endif
|
||||
COMPILE.s ?= ${CC} ${AFLAGS} -c
|
||||
LINK.s ?= ${CC} ${AFLAGS} ${LDFLAGS}
|
||||
COMPILE.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
|
||||
LINK.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
|
||||
|
||||
CC ?= cc
|
||||
DBG ?= -O2
|
||||
CFLAGS ?= ${DBG}
|
||||
COMPILE.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
|
||||
LINK.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
|
||||
|
||||
CXX ?= c++
|
||||
CXXFLAGS ?= ${CFLAGS}
|
||||
COMPILE.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
|
||||
LINK.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
|
||||
|
||||
OBJC ?= ${CC}
|
||||
OBJCFLAGS ?= ${CFLAGS}
|
||||
COMPILE.m ?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
|
||||
LINK.m ?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
|
||||
|
||||
CPP ?= cpp
|
||||
CPPFLAGS ?=
|
||||
|
||||
FC ?= f77
|
||||
FFLAGS ?= -O
|
||||
RFLAGS ?=
|
||||
COMPILE.f ?= ${FC} ${FFLAGS} -c
|
||||
LINK.f ?= ${FC} ${FFLAGS} ${LDFLAGS}
|
||||
COMPILE.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
|
||||
LINK.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
|
||||
COMPILE.r ?= ${FC} ${FFLAGS} ${RFLAGS} -c
|
||||
LINK.r ?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
|
||||
|
||||
INSTALL ?= install
|
||||
|
||||
LEX ?= lex
|
||||
LFLAGS ?=
|
||||
LEX.l ?= ${LEX} ${LFLAGS}
|
||||
|
||||
LD ?= ld
|
||||
LDFLAGS ?=
|
||||
|
||||
LINT ?= lint
|
||||
LINTFLAGS ?= -chapbxzF
|
||||
|
||||
NM ?= nm
|
||||
|
||||
PC ?= pc
|
||||
PFLAGS ?=
|
||||
COMPILE.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
|
||||
LINK.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
|
||||
|
||||
SIZE ?= size
|
||||
|
||||
YACC ?= yacc
|
||||
YFLAGS ?=
|
||||
YACC.y ?= ${YACC} ${YFLAGS}
|
||||
|
||||
# C
|
||||
.c:
|
||||
${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
|
||||
.c.o:
|
||||
${COMPILE.c} ${.IMPSRC}
|
||||
.c.a:
|
||||
${COMPILE.c} ${.IMPSRC}
|
||||
${AR} ${ARFLAGS} $@ $*.o
|
||||
rm -f $*.o
|
||||
.c.ln:
|
||||
${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
|
||||
|
||||
# C++
|
||||
${CXX_SUFFIXES}:
|
||||
${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
|
||||
${CXX_SUFFIXES:%=%.o}:
|
||||
${COMPILE.cc} ${.IMPSRC}
|
||||
${CXX_SUFFIXES:%=%.a}:
|
||||
${COMPILE.cc} ${.IMPSRC}
|
||||
${AR} ${ARFLAGS} $@ $*.o
|
||||
rm -f $*.o
|
||||
|
||||
# Fortran/Ratfor
|
||||
.f:
|
||||
${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
|
||||
.f.o:
|
||||
${COMPILE.f} ${.IMPSRC}
|
||||
.f.a:
|
||||
${COMPILE.f} ${.IMPSRC}
|
||||
${AR} ${ARFLAGS} $@ $*.o
|
||||
rm -f $*.o
|
||||
|
||||
.F:
|
||||
${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
|
||||
.F.o:
|
||||
${COMPILE.F} ${.IMPSRC}
|
||||
.F.a:
|
||||
${COMPILE.F} ${.IMPSRC}
|
||||
${AR} ${ARFLAGS} $@ $*.o
|
||||
rm -f $*.o
|
||||
|
||||
.r:
|
||||
${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
|
||||
.r.o:
|
||||
${COMPILE.r} ${.IMPSRC}
|
||||
.r.a:
|
||||
${COMPILE.r} ${.IMPSRC}
|
||||
${AR} ${ARFLAGS} $@ $*.o
|
||||
rm -f $*.o
|
||||
|
||||
# Pascal
|
||||
.p:
|
||||
${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
|
||||
.p.o:
|
||||
${COMPILE.p} ${.IMPSRC}
|
||||
.p.a:
|
||||
${COMPILE.p} ${.IMPSRC}
|
||||
${AR} ${ARFLAGS} $@ $*.o
|
||||
rm -f $*.o
|
||||
|
||||
# Assembly
|
||||
.s:
|
||||
${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
|
||||
.s.o:
|
||||
${COMPILE.s} ${.IMPSRC}
|
||||
.s.a:
|
||||
${COMPILE.s} ${.IMPSRC}
|
||||
${AR} ${ARFLAGS} $@ $*.o
|
||||
rm -f $*.o
|
||||
.S:
|
||||
${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
|
||||
.S.o:
|
||||
${COMPILE.S} ${.IMPSRC}
|
||||
.S.a:
|
||||
${COMPILE.S} ${.IMPSRC}
|
||||
${AR} ${ARFLAGS} $@ $*.o
|
||||
rm -f $*.o
|
||||
|
||||
# Lex
|
||||
.l:
|
||||
${LEX.l} ${.IMPSRC}
|
||||
${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll
|
||||
rm -f lex.yy.c
|
||||
.l.c:
|
||||
${LEX.l} ${.IMPSRC}
|
||||
mv lex.yy.c ${.TARGET}
|
||||
.l.o:
|
||||
${LEX.l} ${.IMPSRC}
|
||||
${COMPILE.c} -o ${.TARGET} lex.yy.c
|
||||
rm -f lex.yy.c
|
||||
|
||||
# Yacc
|
||||
.y:
|
||||
${YACC.y} ${.IMPSRC}
|
||||
${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS}
|
||||
rm -f y.tab.c
|
||||
.y.c:
|
||||
${YACC.y} ${.IMPSRC}
|
||||
mv y.tab.c ${.TARGET}
|
||||
.y.o:
|
||||
${YACC.y} ${.IMPSRC}
|
||||
${COMPILE.c} -o ${.TARGET} y.tab.c
|
||||
rm -f y.tab.c
|
||||
|
||||
# Shell
|
||||
.sh:
|
||||
rm -f ${.TARGET}
|
||||
cp ${.IMPSRC} ${.TARGET}
|
||||
chmod a+x ${.TARGET}
|
||||
|
@ -36,8 +36,10 @@
|
||||
|
||||
|
||||
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# RCSid:
|
||||
# $Id: target-flags.mk,v 1.10 2020/08/19 17:51:53 sjg Exp $
|
||||
# $Id: target-flags.mk,v 1.11 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 1998-2002, Simon J. Gerraty
|
||||
#
|
||||
|
@ -1,5 +1,7 @@
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# RCSid:
|
||||
# $Id: warnings.mk,v 1.17 2023/02/16 17:55:52 sjg Exp $
|
||||
# $Id: warnings.mk,v 1.18 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2002-2023, Simon J. Gerraty
|
||||
#
|
||||
|
@ -1,4 +1,6 @@
|
||||
# $Id: whats.mk,v 1.11 2023/01/29 17:29:13 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: whats.mk,v 1.12 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2014-2020, Simon J. Gerraty
|
||||
#
|
||||
|
@ -1,4 +1,6 @@
|
||||
# $Id: yacc.mk,v 1.8 2022/06/22 04:51:06 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: yacc.mk,v 1.9 2024/02/17 17:26:57 sjg Exp $
|
||||
|
||||
#
|
||||
# @(#) Copyright (c) 1999-2011, Simon J. Gerraty
|
||||
|
22
parse.c
22
parse.c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: parse.c,v 1.716 2024/01/07 11:39:04 rillig Exp $ */
|
||||
/* $NetBSD: parse.c,v 1.717 2024/02/07 06:43:02 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -121,7 +121,7 @@
|
||||
#include "pathnames.h"
|
||||
|
||||
/* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */
|
||||
MAKE_RCSID("$NetBSD: parse.c,v 1.716 2024/01/07 11:39:04 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: parse.c,v 1.717 2024/02/07 06:43:02 rillig Exp $");
|
||||
|
||||
/* Detects a multiple-inclusion guard in a makefile. */
|
||||
typedef enum {
|
||||
@ -183,9 +183,7 @@ typedef enum ParseSpecial {
|
||||
SP_PARALLEL, /* .PARALLEL; not mentioned in the manual page */
|
||||
SP_PATH, /* .PATH or .PATH.suffix */
|
||||
SP_PHONY, /* .PHONY */
|
||||
#ifdef POSIX
|
||||
SP_POSIX, /* .POSIX; not mentioned in the manual page */
|
||||
#endif
|
||||
SP_PRECIOUS, /* .PRECIOUS */
|
||||
SP_READONLY, /* .READONLY */
|
||||
SP_SHELL, /* .SHELL */
|
||||
@ -305,9 +303,7 @@ static const struct {
|
||||
{ ".PARALLEL", SP_PARALLEL, OP_NONE },
|
||||
{ ".PATH", SP_PATH, OP_NONE },
|
||||
{ ".PHONY", SP_PHONY, OP_PHONY },
|
||||
#ifdef POSIX
|
||||
{ ".POSIX", SP_POSIX, OP_NONE },
|
||||
#endif
|
||||
{ ".PRECIOUS", SP_PRECIOUS, OP_PRECIOUS },
|
||||
{ ".READONLY", SP_READONLY, OP_NONE },
|
||||
{ ".RECURSIVE", SP_ATTRIBUTE, OP_MAKE },
|
||||
@ -1321,7 +1317,6 @@ HandleDependencySourcesEmpty(ParseSpecial special, SearchPathList *paths)
|
||||
case SP_SYSPATH:
|
||||
ClearPaths(special, paths);
|
||||
break;
|
||||
#ifdef POSIX
|
||||
case SP_POSIX:
|
||||
if (posix_state == PS_NOW_OR_NEVER) {
|
||||
/*
|
||||
@ -1333,7 +1328,6 @@ HandleDependencySourcesEmpty(ParseSpecial special, SearchPathList *paths)
|
||||
IncludeFile("posix.mk", true, false, true);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -1715,7 +1709,6 @@ AdjustVarassignOp(const char *name, const char *nameEnd, const char *op,
|
||||
|
||||
} else {
|
||||
type = VAR_NORMAL;
|
||||
#ifdef SUNSHCMD
|
||||
while (op > name && ch_isspace(op[-1]))
|
||||
op--;
|
||||
|
||||
@ -1723,7 +1716,6 @@ AdjustVarassignOp(const char *name, const char *nameEnd, const char *op,
|
||||
op -= 3;
|
||||
type = VAR_SHELL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
va.varname = bmake_strsedup(name, nameEnd < op ? nameEnd : op);
|
||||
@ -1785,12 +1777,10 @@ Parse_IsVar(const char *p, VarAssign *out_var)
|
||||
|
||||
if (ch == '\0')
|
||||
return false;
|
||||
#ifdef SUNSHCMD
|
||||
if (ch == ':' && p[0] == 's' && p[1] == 'h') {
|
||||
p += 2;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
if (ch == '=')
|
||||
eq = p - 1;
|
||||
else if (*p == '=' &&
|
||||
@ -2217,7 +2207,6 @@ IsInclude(const char *dir, bool sysv)
|
||||
}
|
||||
|
||||
|
||||
#ifdef SYSVINCLUDE
|
||||
/* Check if the line is a SYSV include directive. */
|
||||
static bool
|
||||
IsSysVInclude(const char *line)
|
||||
@ -2273,9 +2262,7 @@ ParseTraditionalInclude(char *line)
|
||||
|
||||
free(all_files);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef GMAKEEXPORT
|
||||
/* Parse "export <variable>=<value>", and actually export it. */
|
||||
static void
|
||||
ParseGmakeExport(char *line)
|
||||
@ -2306,7 +2293,6 @@ ParseGmakeExport(char *line)
|
||||
setenv(variable, value, 1);
|
||||
free(value);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* When the end of the current file or .for loop is reached, continue reading
|
||||
@ -2923,20 +2909,16 @@ ParseLine(char *line)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef SYSVINCLUDE
|
||||
if (IsSysVInclude(line)) {
|
||||
ParseTraditionalInclude(line);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef GMAKEEXPORT
|
||||
if (strncmp(line, "export", 6) == 0 && ch_isspace(line[6]) &&
|
||||
strchr(line, ':') == NULL) {
|
||||
ParseGmakeExport(line);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (Parse_VarAssign(line, true, SCOPE_GLOBAL))
|
||||
return;
|
||||
|
8
suff.c
8
suff.c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: suff.c,v 1.377 2024/01/05 23:22:06 rillig Exp $ */
|
||||
/* $NetBSD: suff.c,v 1.378 2024/02/07 06:43:02 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -115,7 +115,7 @@
|
||||
#include "dir.h"
|
||||
|
||||
/* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */
|
||||
MAKE_RCSID("$NetBSD: suff.c,v 1.377 2024/01/05 23:22:06 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: suff.c,v 1.378 2024/02/07 06:43:02 rillig Exp $");
|
||||
|
||||
typedef List SuffixList;
|
||||
typedef ListNode SuffixListNode;
|
||||
@ -856,15 +856,11 @@ Suff_ExtendPaths(void)
|
||||
for (ln = sufflist.first; ln != NULL; ln = ln->next) {
|
||||
Suffix *suff = ln->datum;
|
||||
if (!Lst_IsEmpty(&suff->searchPath->dirs)) {
|
||||
#ifdef INCLUDES
|
||||
if (suff->include)
|
||||
SearchPath_AddAll(includesPath,
|
||||
suff->searchPath);
|
||||
#endif
|
||||
#ifdef LIBRARIES
|
||||
if (suff->library)
|
||||
SearchPath_AddAll(libsPath, suff->searchPath);
|
||||
#endif
|
||||
SearchPath_AddAll(suff->searchPath, &dirSearchPath);
|
||||
} else {
|
||||
SearchPath_Free(suff->searchPath);
|
||||
|
5
targ.c
5
targ.c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: targ.c,v 1.179 2022/12/06 00:12:44 rillig Exp $ */
|
||||
/* $NetBSD: targ.c,v 1.180 2024/03/10 02:53:37 sjg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -107,7 +107,7 @@
|
||||
#include "dir.h"
|
||||
|
||||
/* "@(#)targ.c 8.2 (Berkeley) 3/19/94" */
|
||||
MAKE_RCSID("$NetBSD: targ.c,v 1.179 2022/12/06 00:12:44 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: targ.c,v 1.180 2024/03/10 02:53:37 sjg Exp $");
|
||||
|
||||
/*
|
||||
* All target nodes that appeared on the left-hand side of one of the
|
||||
@ -201,6 +201,7 @@ GNode_New(const char *name)
|
||||
gn->suffix = NULL;
|
||||
gn->fname = NULL;
|
||||
gn->lineno = 0;
|
||||
gn->exit_status = 0;
|
||||
|
||||
#ifdef CLEANUP
|
||||
Lst_Append(&allNodes, gn);
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $Id: Makefile,v 1.210 2024/01/08 18:28:08 sjg Exp $
|
||||
# $Id: Makefile,v 1.211 2024/03/10 17:46:44 sjg Exp $
|
||||
#
|
||||
# $NetBSD: Makefile,v 1.342 2024/01/07 02:07:44 sjg Exp $
|
||||
#
|
||||
@ -474,6 +474,15 @@ BROKEN_TESTS+= sh-flags
|
||||
BROKEN_TESTS+= varmod-localtime
|
||||
.endif
|
||||
|
||||
.if ${.MAKE.OS:NCYGWIN*} == ""
|
||||
BROKEN_TESTS+= \
|
||||
export \
|
||||
opt-chdir \
|
||||
opt-keep-going-indirect \
|
||||
|
||||
.endif
|
||||
|
||||
|
||||
.if ${.MAKE.OS:NDarwin} == ""
|
||||
BROKEN_TESTS+= shell-ksh
|
||||
.endif
|
||||
|
@ -60,12 +60,12 @@ dir/subdir/inference-rule-chain.ir-to: * = <dir/subdir/inference-rule-chain>
|
||||
: Making var-scope-local.c out of nothing.
|
||||
: Making var-scope-local.o from var-scope-local.c.
|
||||
: Making basename "var-scope-local.o" in "." from "var-scope-local.c" in ".".
|
||||
: Making var-scope-local-assign.o with VAR="local".
|
||||
: Making var-scope-local-append.o with VAR="local to var-scope-local-append.o".
|
||||
: Making var-scope-local-append-global.o with VAR="global+local".
|
||||
: Making var-scope-local-default.o with VAR="global".
|
||||
: Making var-scope-local-subst.o with VAR="global+local".
|
||||
: Making var-scope-local-shell.o with VAR="output".
|
||||
: var-scope-local-use.o uses .USE VAR="global"
|
||||
Making var-scope-local-assign.o with make 'local' and env 'local'.
|
||||
Making var-scope-local-append.o with make 'local to var-scope-local-append.o' and env 'local to var-scope-local-append.o'.
|
||||
Making var-scope-local-append-global.o with make 'global+local' and env 'global+local'.
|
||||
Making var-scope-local-default.o with make 'global' and env 'global'.
|
||||
Making var-scope-local-subst.o with make 'global+local' and env 'global+local'.
|
||||
Making var-scope-local-shell.o with make 'output' and env 'output'.
|
||||
Making .USE var-scope-local-use.o with make 'global' and env 'global'.
|
||||
: all overwritten
|
||||
exit status 0
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: var-scope-local.mk,v 1.9 2023/12/20 09:03:09 rillig Exp $
|
||||
# $NetBSD: var-scope-local.mk,v 1.11 2024/03/05 23:07:58 rillig Exp $
|
||||
#
|
||||
# Tests for target-local variables, such as ${.TARGET} or $@. These variables
|
||||
# are relatively short-lived as they are created just before making the
|
||||
@ -199,13 +199,14 @@ var-scope-local-append-global.o \
|
||||
var-scope-local-default.o \
|
||||
var-scope-local-subst.o \
|
||||
var-scope-local-shell.o:
|
||||
: Making ${.TARGET} with VAR="${VAR}".
|
||||
@echo "Making ${.TARGET} with make '"${VAR:Q}"' and env '$$VAR'."
|
||||
|
||||
# Target-local variables are enabled by default. Force them to be enabled
|
||||
# just in case a test above has disabled them.
|
||||
.MAKE.TARGET_LOCAL_VARIABLES= yes
|
||||
|
||||
VAR= global
|
||||
.export VAR
|
||||
|
||||
# If the sources of a dependency line look like a variable assignment, make
|
||||
# treats them as such. There is only a single variable assignment per
|
||||
@ -213,7 +214,7 @@ VAR= global
|
||||
# irrelevant.
|
||||
#
|
||||
# expect-reset
|
||||
# expect: : Making var-scope-local-assign.o with VAR="local".
|
||||
# expect: Making var-scope-local-assign.o with make 'local' and env 'local'.
|
||||
var-scope-local-assign.o: VAR= local
|
||||
|
||||
# Assignments using '+=' do *not* look up the global value, instead they only
|
||||
@ -223,7 +224,7 @@ var-scope-local-append.o: VAR+= local
|
||||
# behaves as expected. Note that the expression '${.TARGET}' is not resolved
|
||||
# when parsing the dependency line, its evaluation is deferred until the
|
||||
# target is actually made.
|
||||
# expect: : Making var-scope-local-append.o with VAR="local to var-scope-local-append.o".
|
||||
# expect: Making var-scope-local-append.o with make 'local to var-scope-local-append.o' and env 'local to var-scope-local-append.o'.
|
||||
var-scope-local-append.o: VAR += to ${.TARGET}
|
||||
# To access the value of a global variable, use an expression. This
|
||||
# expression is expanded before parsing the whole dependency line. Since the
|
||||
@ -233,7 +234,7 @@ var-scope-local-append.o: VAR += to ${.TARGET}
|
||||
# not influence the parsing of the variable assignment. The effective
|
||||
# variable assignment, after expanding the whole line first, is thus
|
||||
# 'VAR= global+local'.
|
||||
# expect: : Making var-scope-local-append-global.o with VAR="global+local".
|
||||
# expect: Making var-scope-local-append-global.o with make 'global+local' and env 'global+local'.
|
||||
var-scope-local-append-global.o: VAR= ${VAR}+local
|
||||
|
||||
var-scope-local-default.o: VAR ?= first
|
||||
@ -241,7 +242,7 @@ var-scope-local-default.o: VAR ?= second
|
||||
# XXX: '?=' does look at the global variable. That's a long-standing
|
||||
# inconsistency between the assignment operators '+=' and '?='. See
|
||||
# Var_AppendExpand and VarAssign_Eval.
|
||||
# expect: : Making var-scope-local-default.o with VAR="global".
|
||||
# expect: Making var-scope-local-default.o with make 'global' and env 'global'.
|
||||
|
||||
# Using the variable assignment operator ':=' provides another way of
|
||||
# accessing a global variable and extending it with local modifications. The
|
||||
@ -249,7 +250,7 @@ var-scope-local-default.o: VAR ?= second
|
||||
# dependency line as a whole. After that, the parser sees the variable
|
||||
# assignment as 'VAR := ${VAR}+local' and searches for the variable 'VAR' in
|
||||
# the usual scopes, picking up the variable from the global scope.
|
||||
# expect: : Making var-scope-local-subst.o with VAR="global+local".
|
||||
# expect: Making var-scope-local-subst.o with make 'global+local' and env 'global+local'.
|
||||
var-scope-local-subst.o: VAR := $${VAR}+local
|
||||
|
||||
# The variable assignment operator '!=' assigns the output of the shell
|
||||
@ -261,9 +262,9 @@ var-scope-local-shell.o: VAR != echo output
|
||||
# While VAR=use will be set for a .USE node, it will never be seen since only
|
||||
# the ultimate target's context is searched; the variable assignments from the
|
||||
# .USE target are not copied to the ultimate target's.
|
||||
# expect: : var-scope-local-use.o uses .USE VAR="global"
|
||||
# expect: Making .USE var-scope-local-use.o with make 'global' and env 'global'.
|
||||
a_use: .USE VAR=use
|
||||
: ${.TARGET} uses .USE VAR="${VAR}"
|
||||
@echo "Making .USE ${.TARGET} with make '"${VAR:Q}"' and env '$$VAR'."
|
||||
|
||||
all: var-scope-local-use.o
|
||||
var-scope-local-use.o: a_use
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: varmod-indirect.mk,v 1.14 2023/11/19 22:32:44 rillig Exp $
|
||||
# $NetBSD: varmod-indirect.mk,v 1.18 2024/02/04 10:03:10 rillig Exp $
|
||||
#
|
||||
# Tests for indirect variable modifiers, such as in ${VAR:${M_modifiers}}.
|
||||
# These can be used for very basic purposes like converting a string to either
|
||||
@ -255,4 +255,28 @@ _:= before ${UNDEF:${:UZ}} after
|
||||
. error
|
||||
.endif
|
||||
|
||||
all:
|
||||
|
||||
# In parse-only mode, the indirect modifiers must not be evaluated.
|
||||
#
|
||||
# Before var.c 1.1098 from 2024-02-04, the expression for an indirect modifier
|
||||
# was partially evaluated (only the variable value, without applying any
|
||||
# modifiers) and then interpreted as modifiers to the main expression.
|
||||
#
|
||||
# The expression ${:UZ} starts with the value "", and in parse-only mode, the
|
||||
# modifier ':UZ' does not modify the expression value. This results in an
|
||||
# empty string for the indirect modifiers, generating no warning.
|
||||
.if 0 && ${VAR:${:UZ}}
|
||||
.endif
|
||||
# The expression ${M_invalid} starts with the value "Z", which is an unknown
|
||||
# modifier. Trying to apply this unknown modifier generated a warning.
|
||||
M_invalid= Z
|
||||
.if 0 && ${VAR:${M_invalid}}
|
||||
.endif
|
||||
# The ':S' modifier does not change the expression value in parse-only mode,
|
||||
# keeping the "Z", which is then skipped in parse-only mode.
|
||||
.if 0 && ${VAR:${M_invalid:S,^,N*,:ts:}}
|
||||
.endif
|
||||
# The ':@' modifier does not change the expression value in parse-only mode,
|
||||
# keeping the "Z", which is then skipped in parse-only mode.
|
||||
.if 0 && ${VAR:${M_invalid:@m@N*$m@:ts:}}
|
||||
.endif
|
||||
|
@ -1,8 +1,8 @@
|
||||
make: "varmod.mk" line 98: To escape a dollar, use \$, not $$, at "$$:L} != """
|
||||
make: "varmod.mk" line 98: Invalid variable name ':', at "$:L} != """
|
||||
make: "varmod.mk" line 104: Dollar followed by nothing
|
||||
make: "varmod.mk" line 114: Missing delimiter ':' after modifier "P"
|
||||
make: "varmod.mk" line 116: Missing argument for ".error"
|
||||
make: "varmod.mk" line 101: To escape a dollar, use \$, not $$, at "$$:L} != """
|
||||
make: "varmod.mk" line 101: Invalid variable name ':', at "$:L} != """
|
||||
make: "varmod.mk" line 107: Dollar followed by nothing
|
||||
make: "varmod.mk" line 117: Missing delimiter ':' after modifier "P"
|
||||
make: "varmod.mk" line 119: Missing argument for ".error"
|
||||
make: Fatal errors encountered -- cannot continue
|
||||
make: stopped in unit-tests
|
||||
exit status 1
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: varmod.mk,v 1.9 2023/11/19 21:47:52 rillig Exp $
|
||||
# $NetBSD: varmod.mk,v 1.10 2024/02/03 00:20:23 sjg Exp $
|
||||
#
|
||||
# Tests for variable modifiers, such as :Q, :S,from,to or :Ufallback.
|
||||
#
|
||||
@ -56,6 +56,9 @@
|
||||
# | `u` | strict | | yes |
|
||||
# | `from=to` | greedy | SysV, fallback | N/A |
|
||||
|
||||
# These tests assume
|
||||
.MAKE.SAVE_DOLLARS = yes
|
||||
|
||||
DOLLAR1= $$
|
||||
DOLLAR2= ${:U\$}
|
||||
|
||||
|
75
var.c
75
var.c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: var.c,v 1.1094 2024/01/07 11:39:04 rillig Exp $ */
|
||||
/* $NetBSD: var.c,v 1.1101 2024/03/01 17:53:30 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -125,16 +125,17 @@
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#ifndef NO_REGEX
|
||||
#include <regex.h>
|
||||
#endif
|
||||
|
||||
#include "make.h"
|
||||
|
||||
#include <errno.h>
|
||||
#ifdef HAVE_REGEX_H
|
||||
#include <regex.h>
|
||||
#endif
|
||||
#ifdef HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#elif defined(HAVE_STDINT_H)
|
||||
#endif
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#ifdef HAVE_LIMITS_H
|
||||
@ -147,7 +148,7 @@
|
||||
#include "metachar.h"
|
||||
|
||||
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
|
||||
MAKE_RCSID("$NetBSD: var.c,v 1.1094 2024/01/07 11:39:04 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: var.c,v 1.1101 2024/03/01 17:53:30 rillig Exp $");
|
||||
|
||||
/*
|
||||
* Variables are defined using one of the VAR=value assignments. Their
|
||||
@ -600,7 +601,7 @@ MayExport(const char *name)
|
||||
}
|
||||
|
||||
static bool
|
||||
ExportVarEnv(Var *v)
|
||||
ExportVarEnv(Var *v, GNode *scope)
|
||||
{
|
||||
const char *name = v->name.str;
|
||||
char *val = v->val.data;
|
||||
@ -620,7 +621,13 @@ ExportVarEnv(Var *v)
|
||||
|
||||
/* XXX: name is injected without escaping it */
|
||||
expr = str_concat3("${", name, "}");
|
||||
val = Var_Subst(expr, SCOPE_GLOBAL, VARE_WANTRES);
|
||||
val = Var_Subst(expr, scope, VARE_WANTRES);
|
||||
if (scope != SCOPE_GLOBAL) {
|
||||
/* we will need to re-export the global version */
|
||||
v = VarFind(name, SCOPE_GLOBAL, false);
|
||||
if (v != NULL)
|
||||
v->exported = false;
|
||||
}
|
||||
/* TODO: handle errors */
|
||||
setenv(name, val, 1);
|
||||
free(val);
|
||||
@ -667,19 +674,21 @@ ExportVarLiteral(Var *v)
|
||||
* Internal variables are not exported.
|
||||
*/
|
||||
static bool
|
||||
ExportVar(const char *name, VarExportMode mode)
|
||||
ExportVar(const char *name, GNode *scope, VarExportMode mode)
|
||||
{
|
||||
Var *v;
|
||||
|
||||
if (!MayExport(name))
|
||||
return false;
|
||||
|
||||
v = VarFind(name, SCOPE_GLOBAL, false);
|
||||
v = VarFind(name, scope, false);
|
||||
if (v == NULL && scope != SCOPE_GLOBAL)
|
||||
v = VarFind(name, SCOPE_GLOBAL, false);
|
||||
if (v == NULL)
|
||||
return false;
|
||||
|
||||
if (mode == VEM_ENV)
|
||||
return ExportVarEnv(v);
|
||||
return ExportVarEnv(v, scope);
|
||||
else if (mode == VEM_PLAIN)
|
||||
return ExportVarPlain(v);
|
||||
else
|
||||
@ -691,7 +700,7 @@ ExportVar(const char *name, VarExportMode mode)
|
||||
* re-exported.
|
||||
*/
|
||||
void
|
||||
Var_ReexportVars(void)
|
||||
Var_ReexportVars(GNode *scope)
|
||||
{
|
||||
char *xvarnames;
|
||||
|
||||
@ -715,7 +724,7 @@ Var_ReexportVars(void)
|
||||
HashIter_Init(&hi, &SCOPE_GLOBAL->vars);
|
||||
while (HashIter_Next(&hi) != NULL) {
|
||||
Var *var = hi.entry->value;
|
||||
ExportVar(var->name.str, VEM_ENV);
|
||||
ExportVar(var->name.str, scope, VEM_ENV);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -728,7 +737,7 @@ Var_ReexportVars(void)
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < varnames.len; i++)
|
||||
ExportVar(varnames.words[i], VEM_ENV);
|
||||
ExportVar(varnames.words[i], scope, VEM_ENV);
|
||||
Words_Free(varnames);
|
||||
}
|
||||
free(xvarnames);
|
||||
@ -746,7 +755,7 @@ ExportVars(const char *varnames, bool isExport, VarExportMode mode)
|
||||
|
||||
for (i = 0; i < words.len; i++) {
|
||||
const char *varname = words.words[i];
|
||||
if (!ExportVar(varname, mode))
|
||||
if (!ExportVar(varname, SCOPE_GLOBAL, mode))
|
||||
continue;
|
||||
|
||||
if (var_exportedVars == VAR_EXPORTED_NONE)
|
||||
@ -971,7 +980,7 @@ Var_SetWithFlags(GNode *scope, const char *name, const char *val,
|
||||
DEBUG4(VAR, "%s: %s = %s%s\n",
|
||||
scope->name, name, val, ValueDescription(val));
|
||||
if (v->exported)
|
||||
ExportVar(name, VEM_PLAIN);
|
||||
ExportVar(name, scope, VEM_PLAIN);
|
||||
}
|
||||
|
||||
if (scope == SCOPE_CMDLINE) {
|
||||
@ -1352,7 +1361,6 @@ ModifyWord_Root(Substring word, SepBuf *buf, void *dummy MAKE_ATTR_UNUSED)
|
||||
SepBuf_AddRange(buf, word.start, end);
|
||||
}
|
||||
|
||||
#ifdef SYSVVARSUB
|
||||
struct ModifyWord_SysVSubstArgs {
|
||||
GNode *scope;
|
||||
Substring lhsPrefix;
|
||||
@ -1392,7 +1400,6 @@ ModifyWord_SysVSubst(Substring word, SepBuf *buf, void *data)
|
||||
|
||||
FStr_Done(&rhs);
|
||||
}
|
||||
#endif
|
||||
|
||||
static const char *
|
||||
Substring_Find(Substring haystack, Substring needle)
|
||||
@ -1470,7 +1477,7 @@ ModifyWord_Subst(Substring word, SepBuf *buf, void *data)
|
||||
SepBuf_AddSubstring(buf, word);
|
||||
}
|
||||
|
||||
#ifndef NO_REGEX
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* Print the error caused by a regcomp or regexec call. */
|
||||
static void
|
||||
RegexError(int reerr, const regex_t *pat, const char *str)
|
||||
@ -1580,7 +1587,6 @@ ModifyWord_SubstRegex(Substring word, SepBuf *buf, void *data)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
struct ModifyWord_LoopArgs {
|
||||
GNode *scope;
|
||||
const char *var; /* name of the temporary variable */
|
||||
@ -2282,6 +2288,9 @@ ModifyWords(ModChain *ch,
|
||||
size_t i;
|
||||
Substring word;
|
||||
|
||||
if (!ModChain_ShouldEval(ch))
|
||||
return;
|
||||
|
||||
if (oneBigWord) {
|
||||
SepBuf_Init(&result, ch->sep);
|
||||
/* XXX: performance: Substring_InitStr calls strlen */
|
||||
@ -2814,8 +2823,7 @@ ApplyModifier_Mtime(const char **pp, ModChain *ch)
|
||||
goto invalid_argument;
|
||||
*pp = p;
|
||||
}
|
||||
if (ModChain_ShouldEval(ch))
|
||||
ModifyWords(ch, ModifyWord_Mtime, &args, ch->oneBigWord);
|
||||
ModifyWords(ch, ModifyWord_Mtime, &args, ch->oneBigWord);
|
||||
return args.rc;
|
||||
|
||||
invalid_argument:
|
||||
@ -2894,7 +2902,7 @@ ApplyModifier_Subst(const char **pp, ModChain *ch)
|
||||
return AMR_OK;
|
||||
}
|
||||
|
||||
#ifndef NO_REGEX
|
||||
#ifdef HAVE_REGEX_H
|
||||
|
||||
/* :C,from,to, */
|
||||
static ApplyModifierResult
|
||||
@ -3560,8 +3568,7 @@ ApplyModifier_WordFunc(const char **pp, ModChain *ch,
|
||||
return AMR_UNKNOWN;
|
||||
(*pp)++;
|
||||
|
||||
if (ModChain_ShouldEval(ch))
|
||||
ModifyWords(ch, modifyWord, NULL, ch->oneBigWord);
|
||||
ModifyWords(ch, modifyWord, NULL, ch->oneBigWord);
|
||||
|
||||
return AMR_OK;
|
||||
}
|
||||
@ -3600,7 +3607,6 @@ ApplyModifier_Unique(const char **pp, ModChain *ch)
|
||||
return AMR_OK;
|
||||
}
|
||||
|
||||
#ifdef SYSVVARSUB
|
||||
/* Test whether the modifier has the form '<lhs>=<rhs>'. */
|
||||
static bool
|
||||
IsSysVModifier(const char *p, char startc, char endc)
|
||||
@ -3672,9 +3678,7 @@ ApplyModifier_SysV(const char **pp, ModChain *ch)
|
||||
FStr_Done(&rhs);
|
||||
return AMR_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SUNSHCMD
|
||||
/* :sh */
|
||||
static ApplyModifierResult
|
||||
ApplyModifier_SunShell(const char **pp, ModChain *ch)
|
||||
@ -3697,7 +3701,6 @@ ApplyModifier_SunShell(const char **pp, ModChain *ch)
|
||||
|
||||
return AMR_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* In cases where the evaluation mode and the definedness are the "standard"
|
||||
@ -3779,7 +3782,7 @@ ApplyModifier(const char **pp, ModChain *ch)
|
||||
return ApplyModifier_Words(pp, ch);
|
||||
case '_':
|
||||
return ApplyModifier_Remember(pp, ch);
|
||||
#ifndef NO_REGEX
|
||||
#ifdef HAVE_REGEX_H
|
||||
case 'C':
|
||||
return ApplyModifier_Regex(pp, ch);
|
||||
#endif
|
||||
@ -3815,10 +3818,8 @@ ApplyModifier(const char **pp, ModChain *ch)
|
||||
return ApplyModifier_Range(pp, ch);
|
||||
case 'S':
|
||||
return ApplyModifier_Subst(pp, ch);
|
||||
#ifdef SUNSHCMD
|
||||
case 's':
|
||||
return ApplyModifier_SunShell(pp, ch);
|
||||
#endif
|
||||
case 'T':
|
||||
return ApplyModifier_WordFunc(pp, ch, ModifyWord_Tail);
|
||||
case 't':
|
||||
@ -3870,7 +3871,7 @@ ApplyModifiersIndirect(ModChain *ch, const char **pp)
|
||||
DEBUG3(VAR, "Indirect modifier \"%s\" from \"%.*s\"\n",
|
||||
mods.str, (int)(p - *pp), *pp);
|
||||
|
||||
if (mods.str[0] != '\0') {
|
||||
if (ModChain_ShouldEval(ch) && mods.str[0] != '\0') {
|
||||
const char *modsp = mods.str;
|
||||
ApplyModifiers(expr, &modsp, '\0', '\0');
|
||||
if (Expr_Str(expr) == var_Error || *modsp != '\0') {
|
||||
@ -3907,12 +3908,10 @@ ApplySingleModifier(const char **pp, ModChain *ch)
|
||||
|
||||
res = ApplyModifier(&p, ch);
|
||||
|
||||
#ifdef SYSVVARSUB
|
||||
if (res == AMR_UNKNOWN) {
|
||||
assert(p == mod);
|
||||
res = ApplyModifier_SysV(&p, ch);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (res == AMR_UNKNOWN) {
|
||||
/*
|
||||
@ -4155,12 +4154,12 @@ IsShortVarnameValid(char varname, const char *start)
|
||||
if (!opts.strict)
|
||||
return false; /* XXX: Missing error message */
|
||||
|
||||
if (varname == '$')
|
||||
if (varname == '$' && save_dollars)
|
||||
Parse_Error(PARSE_FATAL,
|
||||
"To escape a dollar, use \\$, not $$, at \"%s\"", start);
|
||||
else if (varname == '\0')
|
||||
Parse_Error(PARSE_FATAL, "Dollar followed by nothing");
|
||||
else
|
||||
else if (save_dollars)
|
||||
Parse_Error(PARSE_FATAL,
|
||||
"Invalid variable name '%c', at \"%s\"", varname, start);
|
||||
|
||||
@ -4287,7 +4286,7 @@ ParseVarnameLong(
|
||||
bool dynamic = false;
|
||||
|
||||
const char *p = *pp;
|
||||
const char *const start = p;
|
||||
const char *start = p;
|
||||
char endc = startc == '(' ? ')' : '}';
|
||||
|
||||
p += 2; /* skip "${" or "$(" or "y(" */
|
||||
|
Loading…
Reference in New Issue
Block a user