Import bmake-20170510

This commit is contained in:
Simon J. Gerraty 2017-05-10 22:40:27 +00:00
parent f62a02334b
commit 0b13d2e561
32 changed files with 417 additions and 113 deletions

View File

@ -1,3 +1,29 @@
2017-05-10 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (_MAKE_VERSION): 20170510
Merge with NetBSD make, pick up
o main.c: Main_SetObjdir: ensure buf2 is in scope
2017-05-08 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (_MAKE_VERSION): 20170505
see mk/ChangeLog
2017-05-05 Simon J. Gerraty <sjg@bad.crufty.net>
* parse.c: not everyone has stdint.h
2017-05-01 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (_MAKE_VERSION): 20170501
see mk/ChangeLog
2017-04-21 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (_MAKE_VERSION): 20170421
Merge with NetBSD make, pick up
o str.c: Str_Match: fix closure tests for [^] and add unit-test.
2017-04-20 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (_MAKE_VERSION): 20170420

View File

@ -1,7 +1,7 @@
# $Id: Makefile,v 1.88 2017/04/20 14:51:14 sjg Exp $
# $Id: Makefile,v 1.92 2017/05/10 22:29:04 sjg Exp $
# Base version on src date
_MAKE_VERSION= 20170420
_MAKE_VERSION= 20170510
PROG= bmake

9
main.c
View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.264 2017/04/20 03:57:27 sjg Exp $ */
/* $NetBSD: main.c,v 1.265 2017/05/10 22:26:14 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,7 +69,7 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: main.c,v 1.264 2017/04/20 03:57:27 sjg Exp $";
static char rcsid[] = "$NetBSD: main.c,v 1.265 2017/05/10 22:26:14 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\
#if 0
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
#else
__RCSID("$NetBSD: main.c,v 1.264 2017/04/20 03:57:27 sjg Exp $");
__RCSID("$NetBSD: main.c,v 1.265 2017/05/10 22:26:14 sjg Exp $");
#endif
#endif /* not lint */
#endif
@ -751,6 +751,7 @@ Main_SetObjdir(const char *fmt, ...)
struct stat sb;
char *path;
char buf[MAXPATHLEN + 1];
char buf2[MAXPATHLEN + 1];
Boolean rc = FALSE;
va_list ap;
@ -759,8 +760,6 @@ Main_SetObjdir(const char *fmt, ...)
va_end(ap);
if (path[0] != '/') {
char buf2[MAXPATHLEN + 1];
snprintf(buf2, MAXPATHLEN, "%s/%s", curdir, path);
path = buf2;
}

View File

@ -1,3 +1,37 @@
2017-05-08 Simon J. Gerraty <sjg@bad.crufty.net>
* install-mk (MK_VERSION): 20170505
* meta2deps.py: fix botched indenation.
2017-05-05 Simon J. Gerraty <sjg@bad.crufty.net>
* sys/*.mk: Remove setting of MAKE it is unnecessary and
in many cases wrong (basname rather than full path)
* scripts.mk (SCRIPTSGROUPS): make this more like files.mk and inc.mk
* init.mk: define realbuild to simplify logic in {lib,prog}.mk etc
2017-05-01 Simon J. Gerraty <sjg@bad.crufty.net>
* install-mk (MK_VERSION): 20170501
* doc.mk: fix typo in DOC_INSTALL_OWN
* inc.mk: handle INCGROUPS similar to freebsd
* files.mk: add something for files too
* add staging logic to lib.mk prog.mk etc.
2017-04-24 Simon J. Gerraty <sjg@bad.crufty.net>
* install-mk (MK_VERSION): 20170424
* dirdeps.mk: set NO_DIRDEPS when bootstrapping.
also target of bootstrap-this when sed is needed should be ${_want:T}
2017-04-18 Simon J. Gerraty <sjg@bad.crufty.net>
* install-mk (MK_VERSION): 20170418

View File

@ -9,6 +9,7 @@ cython.mk
dep.mk
doc.mk
dpadd.mk
files.mk
final.mk
host-target.mk
host.libnames.mk

View File

@ -1,4 +1,4 @@
# $Id: dirdeps.mk,v 1.87 2017/03/07 01:49:03 sjg Exp $
# $Id: dirdeps.mk,v 1.88 2017/04/24 20:34:59 sjg Exp $
# Copyright (c) 2010-2013, Juniper Networks, Inc.
# All rights reserved.
@ -137,6 +137,14 @@
# built for.
#
.if !target(bootstrap) && (make(bootstrap) || \
make(bootstrap-this) || \
make(bootstrap-recurse) || \
make(bootstrap-empty))
# disable most of below
.MAKE.LEVEL = 1
.endif
# touch this at your peril
_DIRDEP_USE_LEVEL?= 0
.if ${.MAKE.LEVEL} == ${_DIRDEP_USE_LEVEL}
@ -757,7 +765,7 @@ bootstrap-this: .NOTMAIN
@echo Bootstrapping ${RELDIR}/${_want:T} from ${_src:T}; \
echo You need to build ${RELDIR} to correctly populate it.
.if ${_src:T} != ${.MAKE.DEPENDFILE_PREFIX:T}
(cd ${.CURDIR} && sed ${.MAKE.DEPENDFILE_BOOTSTRAP_SED} ${_src} > ${_want})
(cd ${.CURDIR} && sed ${.MAKE.DEPENDFILE_BOOTSTRAP_SED} ${_src} > ${_want:T})
.else
cp ${.CURDIR}/${_src:T} ${_want}
.endif

View File

@ -1,4 +1,4 @@
# $Id: doc.mk,v 1.5 2015/09/08 06:15:31 sjg Exp $
# $Id: doc.mk,v 1.6 2017/05/01 21:24:10 sjg Exp $
.if !target(__${.PARSEFILE}__)
__${.PARSEFILE}__:
@ -59,7 +59,7 @@ spell: ${SRCS}
.include <own.mk>
.if !empty(DOCOWN)
DOC_INSTALL_OWN?= -o ${DOCOWN} -g ${DOGGRP}
DOC_INSTALL_OWN?= -o ${DOCOWN} -g ${DOCGRP}
.endif
.endif

83
mk/files.mk Normal file
View File

@ -0,0 +1,83 @@
# $Id: files.mk,v 1.6 2017/05/07 02:21:02 sjg Exp $
#
# @(#) Copyright (c) 2017, Simon J. Gerraty
#
# This file is provided in the hope that it will
# be of use. There is absolutely NO WARRANTY.
# Permission to copy, redistribute or otherwise
# use this file is hereby granted provided that
# the above copyright notice and this notice are
# left intact.
#
# Please send copies of changes and bug-fixes to:
# sjg@crufty.net
#
.include <init.mk>
FILES_INSTALL_OWN ?= -o ${SHAREOWN} -g ${SHAREGRP}
FILESMODE ?= ${SHAREMODE}
FILES_COPY ?= -C
FILESGROUPS ?= FILES
FILESGROUPS := ${FILESGROUPS:O:u}
.if !target(buildfiles)
.for group in ${FILESGROUPS}
buildfiles: ${${group}}
.endfor
.endif
buildfiles:
realbuild: buildfiles
# there is no default FILESDIR so
# ignore group if ${group}DIR is not defined
.for group in ${FILESGROUPS}
.if !empty(${group}) && defined(${group}DIR)
.if ${group} != "FILES"
${group}_INSTALL_OWN ?= ${FILES_INSTALL_OWN}
.endif
# incase we are staging
STAGE_DIR.${group} ?= ${STAGE_OBJTOP}${${group}DIR}
.for file in ${${group}:O:u}
${group}_INSTALL_OWN.${file:T} ?= ${${group}_INSTALL_OWN}
${group}DIR.${file:T} ?= ${${group}DIR}
file_mkdir_list += ${${group}DIR.${file:T}}
.if defined(${group}NAME.${file:T})
STAGE_AS_SETS += ${group}
STAGE_AS_${file} = ${${group}NAME.${file:T}}
stage_as.${group}: ${file}
installfiles: installfiles.${group}.${file:T}
installfiles.${group}.${file:T}: ${file} file_mkdirs
${INSTALL} ${FILES_COPY} ${${group}_INSTALL_OWN.${file:T}} \
-m ${FILESMODE} ${.ALLSRC:Nfile_mkdirs} ${DESTDIR}${${group}DIR}/${${group}NAME.${file:T}}
.else
STAGE_SETS += ${group}
stage_files.${group}: ${file}
installfiles.${group}: ${file}
installfiles: installfiles.${group}
.endif
.endfor # file
installfiles.${group}: file_mkdirs
${INSTALL} ${FILES_COPY} ${${group}_INSTALL_OWN} -m ${FILESMODE} \
${.ALLSRC:Nfile_mkdirs:O:u} ${DESTDIR}${${group}DIR}
.endif # !empty
.endfor # group
file_mkdirs:
@for d in ${file_mkdir_list:O:u}; do \
test -d ${DESTDIR}$$d || \
${INSTALL} -d ${FILES_INSTALL_OWN} -m 775 ${DESTDIR}$$d; \
done
beforeinstall:
installfiles:
realinstall: installfiles
.ORDER: beforeinstall installfiles

View File

@ -1,4 +1,4 @@
# $Id: final.mk,v 1.6 2016/04/05 15:58:37 sjg Exp $
# $Id: final.mk,v 1.8 2017/05/07 20:30:08 sjg Exp $
.if !target(__${.PARSEFILE}__)
__${.PARSEFILE}__:
@ -6,9 +6,17 @@ __${.PARSEFILE}__:
# provide a hook for folk who want to do scary stuff
.-include <${.CURDIR:H}/Makefile-final.inc>
.if !empty(STAGE)
.if ${MK_STAGING} == "yes"
.include <meta.stage.mk>
.elif !empty(STAGE)
.-include <stage.mk>
.endif
.-include <local.final.mk>
.if empty(_SKIP_BUILD)
install: realinstall
.endif
realinstall:
.endif

View File

@ -1,4 +1,4 @@
# $Id: inc.mk,v 1.3 2011/03/11 05:23:05 sjg Exp $
# $Id: inc.mk,v 1.7 2017/05/06 17:29:45 sjg Exp $
#
# @(#) Copyright (c) 2008, Simon J. Gerraty
#
@ -15,8 +15,6 @@
.include <init.mk>
includes: ${INCS}
.if !empty(LIBOWN)
INC_INSTALL_OWN ?= -o ${LIBOWN} -g ${LIBGRP}
.endif
@ -24,12 +22,68 @@ INCMODE ?= 444
INC_COPY ?= -C
INCSDIR ?= ${INCDIR}
realinstall: incinstall
STAGE_INCSDIR?= ${STAGE_OBJTOP}${INCSDIR}
# accommodate folk used to freebsd
INCGROUPS ?= ${INCSGROUPS:UINCS}
INCGROUPS := ${INCGROUPS:O:u}
.if !target(buildincludes)
.for group in ${INCGROUPS}
buildincludes: ${${group}}
.endfor
.endif
buildincludes:
includes: buildincludes
.if !target(incinstall)
incinstall:
.if !empty(INCS)
[ -d ${DESTDIR}${INCSDIR} ] || \
${INSTALL} -d ${INC_INSTALL_OWN} -m 775 ${DESTDIR}${INCSDIR}
${INSTALL} ${INC_COPY} ${INC_INSTALL_OWN} -m ${INCMODE} ${INCS} ${DESTDIR}${INCSDIR}
.for group in ${INCGROUPS}
.if !empty(${group})
.if ${group} != "INC"
${group}_INSTALL_OWN ?= ${INC_INSTALL_OWN}
${group}DIR ?= ${INCDIR}
.endif
# incase we are staging
STAGE_DIR.${group} ?= ${STAGE_OBJTOP}${${group}DIR}
.for header in ${${group}:O:u}
${group}_INSTALL_OWN.${header:T} ?= ${${group}_INSTALL_OWN}
${group}DIR.${header:T} ?= ${${group}DIR}
inc_mkdir_list += ${${group}DIR.${header:T}}
.if defined(${group}NAME.${header:T})
STAGE_AS_SETS += ${group}
STAGE_AS_${header} = ${${group}NAME.${header:T}}
stage_as.${group}: ${header}
incinstall: incinstall.${group}.${header:T}
incinstall.${group}.${header:T}: ${header} inc_mkdirs
${INSTALL} ${INC_COPY} ${${group}_INSTALL_OWN.${header:T}} -m ${INCMODE} ${.ALLSRC:Ninc_mkdirs} ${DESTDIR}${${group}DIR}/${${group}NAME.${header:T}}
.else
STAGE_SETS += ${group}
stage_files.${group}: ${header}
incinstall.${group}: ${header}
incinstall: incinstall.${group}
.endif
.endfor # header
incinstall.${group}: inc_mkdirs
${INSTALL} ${INC_COPY} ${${group}_INSTALL_OWN} -m ${INCMODE} \
${.ALLSRC:Ninc_mkdirs:O:u} ${DESTDIR}${${group}DIR}
.endif # !empty
.endfor # group
inc_mkdirs:
@for d in ${inc_mkdir_list:O:u}; do \
test -d ${DESTDIR}$$d || \
${INSTALL} -d ${INC_INSTALL_OWN} -m 775 ${DESTDIR}$$d; \
done
.endif # !target(incinstall)
beforeinstall:
realinstall: incinstall
.ORDER: beforeinstall incinstall

View File

@ -1,4 +1,4 @@
# $Id: init.mk,v 1.12 2016/04/05 15:58:37 sjg Exp $
# $Id: init.mk,v 1.15 2017/05/07 20:27:54 sjg Exp $
#
# @(#) Copyright (c) 2002, Simon J. Gerraty
#
@ -50,8 +50,20 @@ PROFFLAGS?= -DGPROF -DPROF
_SKIP_BUILD = not building at level 0
.endif
.if !empty(_SKIP_BUILD)
.if !defined(.PARSEDIR)
# no-op is the best we can do if not bmake.
.WAIT:
.endif
# define this once for consistency
.if empty(_SKIP_BUILD)
# beforebuild is a hook for things that must be done early
all: beforebuild .WAIT realbuild
.else
all: .PHONY
.warning ${_SKIP_BUILD}
.endif
beforebuild:
realbuild:
.endif

View File

@ -55,7 +55,7 @@
# Simon J. Gerraty <sjg@crufty.net>
# RCSid:
# $Id: install-mk,v 1.141 2017/04/18 23:53:18 sjg Exp $
# $Id: install-mk,v 1.145 2017/05/09 04:05:32 sjg Exp $
#
# @(#) Copyright (c) 1994 Simon J. Gerraty
#
@ -70,7 +70,7 @@
# sjg@crufty.net
#
MK_VERSION=20170418
MK_VERSION=20170505
OWNER=
GROUP=
MODE=444
@ -176,7 +176,7 @@ $SKIP_MKFILES Do chmod $BINMODE $mk_scripts
[ "$OWNER" ] && $SKIP_MKFILES Do chown $OWNER $mk_files $sys_mk_files
# if this is a BSD system the bsd.*.mk should exist and be used.
if [ -z "$SKIP_BSD_MK" ]; then
for f in dep doc init lib links man nls obj own prog subdir
for f in dep doc files inc init lib links man nls obj own prog subdir
do
b=bsd.$f.mk
[ -s $b ] || Do ln -s $f.mk $b

View File

@ -1,4 +1,4 @@
# $Id: lib.mk,v 1.55 2016/09/23 23:04:51 sjg Exp $
# $Id: lib.mk,v 1.61 2017/05/06 17:30:09 sjg Exp $
.if !target(__${.PARSEFILE}__)
__${.PARSEFILE}__:
@ -37,7 +37,7 @@ PICO?= .pico
CFLAGS+= ${COPTS}
# Derrived from NetBSD-1.6
# Originally derrived from NetBSD-1.6
# Set PICFLAGS to cc flags for producing position-independent code,
# if not already set. Includes -DPIC, if required.
@ -375,15 +375,14 @@ _LIBS+=llib-l${LIB}.ln
.include <dpadd.mk>
.endif
.if empty(LIB)
_LIBS=
.endif
.if !defined(_SKIP_BUILD)
all: prebuild .WAIT ${_LIBS}
# a hook for things that must be done early
prebuild:
.if !defined(.PARSEDIR)
# no-op is the best we can do if not bmake.
.WAIT:
.endif
realbuild: ${_LIBS}
.endif
all: _SUBDIRUSE
.for s in ${SRCS:N*.h:M*/*}
@ -509,7 +508,7 @@ LIB_INSTALL_OWN ?= -o ${LIBOWN} -g ${LIBGRP}
.include <links.mk>
.if !target(realinstall)
.if !target(realinstall) && !empty(LIB)
realinstall: libinstall
.endif
.if !target(libinstall)
@ -552,13 +551,19 @@ libinstall:
.endif
.endif
.if ${MK_MAN} != "no"
install: maninstall _SUBDIRUSE
maninstall: afterinstall
.endif
afterinstall: realinstall
libinstall: beforeinstall
realinstall: beforeinstall
.endif
.if defined(FILES) || defined(FILESGROUPS)
.include <files.mk>
.endif
.if ${MK_MAN} != "no"
.include <man.mk>
.endif
@ -591,5 +596,10 @@ realinstall: beforeinstall
.endfor
@touch ${.TARGET}
.if !empty(LIB)
STAGE_LIBDIR?= ${STAGE_OBJTOP}${LIBDIR}
stage_libs: ${_LIBS}
.endif
.include <final.mk>
.endif

View File

@ -37,7 +37,7 @@
"""
RCSid:
$Id: meta2deps.py,v 1.25 2017/04/03 21:04:09 sjg Exp $
$Id: meta2deps.py,v 1.26 2017/05/09 04:04:16 sjg Exp $
Copyright (c) 2011-2013, Juniper Networks, Inc.
All rights reserved.
@ -142,7 +142,7 @@ def sort_unique(list, cmp=None, key=None, reverse=False):
for e in list:
if e == le:
continue
le = e
le = e
nl.append(e)
return nl
@ -534,7 +534,7 @@ def parse_path(self, path, cwd, op=None, w=[]):
# to the src dir, we may need to add dependencies for each
rdir = dir
dir = abspath(dir, cwd, self.last_dir, self.debug, self.debug_out)
rdir = os.path.realpath(dir)
rdir = os.path.realpath(dir)
if rdir == dir:
rdir = None
# now put path back together

View File

@ -1,4 +1,4 @@
# $Id: own.mk,v 1.32 2016/05/18 20:54:29 sjg Exp $
# $Id: own.mk,v 1.35 2017/05/03 18:09:44 sjg Exp $
.if !target(__${.PARSEFILE}__)
__${.PARSEFILE}__:
@ -117,6 +117,7 @@ OPTIONS_DEFAULT_DEPENDENT+= \
PICINSTALL/LINKLIB \
PICLIB/PIC \
PROFILE/LINKLIB \
STAGING_PROG/STAGING \
.include <options.mk>
@ -128,7 +129,7 @@ _uid!= id -u
USERGRP!= id -g
.export USERGRP
.endif
.for x in BIN CONF DOC INFO KMOD LIB MAN NLS SHARE
.for x in BIN CONF DOC INC INFO FILES KMOD LIB MAN NLS SHARE
$xOWN= ${USER}
$xGRP= ${USERGRP}
$x_INSTALL_OWN=
@ -145,6 +146,9 @@ BINMODE?= 555
NONBINMODE?= 444
DIRMODE?= 755
INCLUDEDIR?= ${prefix}/include
INCDIR?= ${INCLUDEDIR}
# Define MANZ to have the man pages compressed (gzip)
#MANZ= 1
@ -184,6 +188,10 @@ KMODGRP?= ${BINGRP}
KMODOWN?= ${BINOWN}
KMODMODE?= ${NONBINMODE}
SHAREGRP?= ${BINGRP}
SHAREOWN?= ${BINOWN}
SHAREMODE?= ${NONBINMODE}
COPY?= -c
STRIP_FLAG?= -s
@ -244,4 +252,19 @@ MK_MAN= no
MK_NLS= no
.endif
# :U incase not using our sys.mk
.if ${MK_META_MODE:Uno} == "yes"
# should all be set by sys.mk if not default
TARGET_SPEC_VARS ?= MACHINE
.if ${TARGET_SPEC_VARS:[#]} > 1
TARGET_SPEC_VARS_REV := ${TARGET_SPEC_VARS:[-1..1]}
.else
TARGET_SPEC_VARS_REV = ${TARGET_SPEC_VARS}
.endif
.if ${MK_STAGING} == "yes"
STAGE_ROOT?= ${OBJROOT}/stage
STAGE_OBJTOP?= ${STAGE_ROOT}/${TARGET_SPEC_VARS_REV:ts/}
.endif
.endif
.endif

View File

@ -1,4 +1,4 @@
# $Id: prog.mk,v 1.28 2017/02/14 21:26:13 sjg Exp $
# $Id: prog.mk,v 1.32 2017/05/06 17:30:09 sjg Exp $
.if !target(__${.PARSEFILE}__)
__${.PARSEFILE}__:
@ -75,6 +75,8 @@ ${CXX_SUFFIXES:%=%.o}:
.if defined(PROG)
BINDIR ?= ${prefix}/bin
SRCS?= ${PROG}.c
.for s in ${SRCS:N*.h:N*.sh:M*/*}
${.o .po .lo:L:@o@${s:T:R}$o@}: $s
@ -126,8 +128,9 @@ MAN= ${PROG}.1
.endif # defined(PROG)
.if !defined(_SKIP_BUILD)
all: ${PROG}
realbuild: ${PROG}
.endif
all: _SUBDIRUSE
.if !target(clean)
@ -208,6 +211,10 @@ lint: ${LOBJS}
.NOPATH: ${OBJS}
.endif
.if defined(FILES) || defined(FILESGROUPS)
.include <files.mk>
.endif
.if ${MK_MAN} != "no"
.include <man.mk>
.endif
@ -219,6 +226,20 @@ lint: ${LOBJS}
.include <obj.mk>
.include <dep.mk>
.include <subdir.mk>
.if !empty(PROG) && ${MK_STAGING_PROG} == "yes"
STAGE_BINDIR ?= ${STAGE_OBJTOP}${BINDIR}
STAGE_DIR.prog ?= ${STAGE_BINDIR}
.if ${PROG_NAME:U${PROG}} != ${PROG}
STAGE_AS_SETS += prog
STAGE_AS_${PROG} = ${PROG_NAME}
stage_as.prog: ${PROG}
.else
STAGE_SETS += prog
stage_files.prog: ${PROG}
.endif
.endif
.include <final.mk>
.endif

View File

@ -1,52 +1,91 @@
# $Id: scripts.mk,v 1.2 2006/11/09 01:55:18 sjg Exp $
# $Id: scripts.mk,v 1.3 2017/05/06 17:29:45 sjg Exp $
#
# @(#) Copyright (c) 2006, Simon J. Gerraty
#
# This file is provided in the hope that it will
# be of use. There is absolutely NO WARRANTY.
# Permission to copy, redistribute or otherwise
# use this file is hereby granted provided that
# the above copyright notice and this notice are
# left intact.
#
# Please send copies of changes and bug-fixes to:
# sjg@crufty.net
#
.include <init.mk>
.if defined(SCRIPTS)
SCRIPTSGROUPS ?= SCRIPTS
SCRIPTSGROUPS := ${SCRIPTSGROUPS:O:u}
all: ${SCRIPTS}
.PHONY: scriptsinstall
install: scriptsinstall
.if !target(scriptsinstall)
SCRIPTSDIR?= ${BINDIR}
SCRIPTSOWN?= ${BINOWN}
SCRIPTSGRP?= ${BINGRP}
SCRIPTSMODE?= ${BINMODE}
SCRIPTS_INSTALL_OWN?= -o ${SCRIPTSOWN} -g ${SCRIPTSGRP}
SCRIPTS_COPY ?= -C
# how we get script name from src
SCRIPTSNAME_MOD?=T:R
script_targets= ${SCRIPTS:@s@${DESTDIR}${SCRIPTSDIR_$s:U${SCRIPTSDIR}}/${SCRIPTSNAME_$s:U${s:${SCRIPTSNAME_MOD}}}@}
scriptsinstall:: ${script_targets}
.PRECIOUS: ${script_targets}
.if !defined(UPDATE)
.PHONY: ${script_targets}
.endif
INSTALL_FLAGS?= ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} \
-o ${OWN_${.TARGET:T}:U${SCRIPTSOWN}} \
-g ${GRP_${.TARGET:T}:U${SCRIPTSGRP}} \
-m ${MODE_${.TARGET:T}:U${SCRIPTSMODE}}
__SCRIPTINSTALL_USE: .USE
${INSTALL} ${INSTALL_FLAGS_${.TARGET:T}:U${INSTALL_FLAGS}} \
${.ALLSRC} ${.TARGET}
.for s in ${SCRIPTS}
.if !defined(BUILD) && !make(all) && !make(${s})
${DESTDIR}${SCRIPTSDIR_$s:U${SCRIPTSDIR}}/${SCRIPTSNAME_$s:U${s:${SCRIPTSNAME_MOD}}}: .MADE
.endif
${DESTDIR}${SCRIPTSDIR_$s:U${SCRIPTSDIR}}/${SCRIPTSNAME_$s:U${s:${SCRIPTSNAME_MOD}}}: ${s} __SCRIPTINSTALL_USE
.if !target(buildfiles)
.for group in ${SCRIPTSGROUPS}
buildfiles: ${${group}}
.endfor
.endif
buildfiles:
realbuild: buildfiles
.for group in ${SCRIPTSGROUPS}
.if !empty(${group}) && defined(${group}DIR)
.if ${group} != "SCRIPTS"
${group}_INSTALL_OWN ?= ${SCRIPTS_INSTALL_OWN}
.endif
# incase we are staging
STAGE_DIR.${group} ?= ${STAGE_OBJTOP}${${group}DIR}
.for script in ${${group}:O:u}
${group}_INSTALL_OWN.${script:T} ?= ${${group}_INSTALL_OWN}
${group}DIR.${script:T} ?= ${${group}DIR_${script:T}:U${${group}DIR}}
script_mkdir_list += ${${group}DIR.${script:T}}
${group}NAME.${script} ?= ${${group}NAME_${script:T}:U${script:${SCRIPTSNAME_MOD}}}
.if ${${group}NAME.${script}:T} != ${script:T}
STAGE_AS_SETS += ${group}
STAGE_AS_${script} = ${${group}NAME.${script:T}}
stage_as.${group}: ${script}
installscripts: installscripts.${group}.${script:T}
installscripts.${group}.${script:T}: ${script} script_mkdirs
${INSTALL} ${SCRIPTS_COPY} ${${group}_INSTALL_OWN.${script:T}} \
-m ${SCRIPTSMODE} ${.ALLSRC:Nscript_mkdirs} ${DESTDIR}${${group}DIR}/${${group}NAME.${script:T}}
.else
STAGE_SETS += ${group}
stage_files.${group}: ${script}
installscripts.${group}: ${script}
installscripts: installscripts.${group}
.endif
.if !target(scriptsinstall)
scriptsinstall::
.endif
.endfor # script
installscripts.${group}: script_mkdirs
${INSTALL} ${SCRIPTS_COPY} ${${group}_INSTALL_OWN} -m ${SCRIPTSMODE} \
${.ALLSRC:Nscript_mkdirs:O:u} ${DESTDIR}${${group}DIR}
.endif # !empty
.endfor # group
script_mkdirs:
@for d in ${script_mkdir_list:O:u}; do \
test -d ${DESTDIR}$$d || \
${INSTALL} -d ${SCRIPTS_INSTALL_OWN} -m 775 ${DESTDIR}$$d; \
done
beforeinstall:
installscripts:
realinstall: installscripts
.ORDER: beforeinstall installscripts

View File

@ -67,8 +67,6 @@ LDFLAGS=
LINT= lint
LINTFLAGS= -chapbx
MAKE= bmake
PC= pc
PFLAGS=
COMPILE.p= ${PC} ${PFLAGS} ${CPPFLAGS} -c

View File

@ -84,8 +84,6 @@ LINTFLAGS?= -chapbx
LORDER?= lorder
MAKE?= bmake
NM?= nm
PC?= pc

View File

@ -1,4 +1,4 @@
# $Id: Generic.mk,v 1.12 2016/03/22 20:45:14 sjg Exp $
# $Id: Generic.mk,v 1.13 2017/05/05 18:02:16 sjg Exp $
#
# some reasonable defaults
@ -80,8 +80,6 @@ LDFLAGS?=
LINT?= lint
LINTFLAGS?= -chapbxzF
MAKE?= ${.MAKE}
NM?= nm
PC?= pc

View File

@ -1,4 +1,4 @@
# $Id: HP-UX.mk,v 1.10 2016/03/22 20:45:14 sjg Exp $
# $Id: HP-UX.mk,v 1.11 2017/05/05 18:02:16 sjg Exp $
# $NetBSD: sys.mk,v 1.19.2.1 1994/07/26 19:58:31 cgd Exp $
# @(#)sys.mk 5.11 (Berkeley) 3/13/91
@ -101,8 +101,6 @@ LDFLAGS=
LINT= lint
LINTFLAGS= -chapbx
MAKE= bmake
PC= pc
PFLAGS=
COMPILE.p= ${PC} ${PFLAGS} ${CPPFLAGS} -c

View File

@ -70,8 +70,6 @@ LINTFLAGS?= -chapbxzF
LORDER?= lorder
MAKE?= make
NM?= nm
PC?= pc

View File

@ -1,4 +1,4 @@
# $Id: Linux.mk,v 1.8 2016/03/22 20:45:14 sjg Exp $
# $Id: Linux.mk,v 1.9 2017/05/05 18:02:16 sjg Exp $
# $NetBSD: sys.mk,v 1.19.2.1 1994/07/26 19:58:31 cgd Exp $
# @(#)sys.mk 5.11 (Berkeley) 3/13/91
@ -70,8 +70,6 @@ LDFLAGS=
LINT= lint
LINTFLAGS= -chapbx
MAKE= bmake
PC= pc
PFLAGS=
COMPILE.p= ${PC} ${PFLAGS} ${CPPFLAGS} -c

View File

@ -105,8 +105,6 @@ LINTFLAGS?= -chapbxzF
LORDER?= lorder
MAKE?= make
NM?= nm
PC?= pc

View File

@ -1,4 +1,4 @@
# $Id: OSF1.mk,v 1.7 2016/03/22 20:45:15 sjg Exp $
# $Id: OSF1.mk,v 1.8 2017/05/05 18:02:16 sjg Exp $
# $NetBSD: sys.mk,v 1.19.2.1 1994/07/26 19:58:31 cgd Exp $
# @(#)sys.mk 5.11 (Berkeley) 3/13/91
@ -77,8 +77,6 @@ LDFLAGS=
LINT= lint
LINTFLAGS= -chapbx
MAKE= bmake
PC= pc
PFLAGS=
COMPILE.p= ${PC} ${PFLAGS} ${CPPFLAGS} -c

View File

@ -80,8 +80,6 @@ LINTFLAGS?= -chapbxzF
LORDER?= lorder
MAKE?= make
NM?= nm
PC?= pc

View File

@ -1,4 +1,4 @@
# $Id: SunOS.mk,v 1.7 2016/03/22 20:45:15 sjg Exp $
# $Id: SunOS.mk,v 1.8 2017/05/05 18:02:17 sjg Exp $
.if ${.PARSEFILE} == "sys.mk"
.include <host-target.mk>
@ -98,8 +98,6 @@ LDFLAGS=
LINT= lint
LINTFLAGS= -chapbx
MAKE= bmake
PC= pc
PFLAGS=
COMPILE.p= ${PC} ${PFLAGS} ${CPPFLAGS} -c

View File

@ -1,4 +1,4 @@
# $Id: UnixWare.mk,v 1.2 2016/03/22 20:45:15 sjg Exp $
# $Id: UnixWare.mk,v 1.3 2017/05/05 18:02:17 sjg Exp $
# based on "Id: SunOS.5.sys.mk,v 1.6 2003/09/30 16:42:23 sjg Exp "
# $NetBSD: sys.mk,v 1.19.2.1 1994/07/26 19:58:31 cgd Exp $
# @(#)sys.mk 5.11 (Berkeley) 3/13/91
@ -114,8 +114,6 @@ LINTFLAGS?= -pF
LORDER?= lorder
MAKE?= bmake
NM?= nm
PC?= pc # XXX: UDK probably does not have pc

View File

@ -130,7 +130,6 @@ __RCSID("$NetBSD: parse.c,v 1.225 2017/04/17 13:29:07 maya Exp $");
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdint.h>
#include "make.h"
#include "hash.h"
@ -139,6 +138,10 @@ __RCSID("$NetBSD: parse.c,v 1.225 2017/04/17 13:29:07 maya Exp $");
#include "buf.h"
#include "pathnames.h"
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#ifdef HAVE_MMAP
#include <sys/mman.h>

15
str.c
View File

@ -1,4 +1,4 @@
/* $NetBSD: str.c,v 1.37 2017/04/11 17:30:13 sjg Exp $ */
/* $NetBSD: str.c,v 1.38 2017/04/21 22:15:44 sjg Exp $ */
/*-
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: str.c,v 1.37 2017/04/11 17:30:13 sjg Exp $";
static char rcsid[] = "$NetBSD: str.c,v 1.38 2017/04/21 22:15:44 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)str.c 5.8 (Berkeley) 6/1/90";
#else
__RCSID("$NetBSD: str.c,v 1.37 2017/04/11 17:30:13 sjg Exp $");
__RCSID("$NetBSD: str.c,v 1.38 2017/04/21 22:15:44 sjg Exp $");
#endif
#endif /* not lint */
#endif
@ -382,8 +382,11 @@ Str_Match(const char *string, const char *pattern)
} else
nomatch = 0;
for (;;) {
if ((*pattern == ']') || (*pattern == 0))
return(nomatch);
if ((*pattern == ']') || (*pattern == 0)) {
if (nomatch)
break;
return(0);
}
if (*pattern == *string)
break;
if (pattern[1] == '-') {
@ -400,7 +403,7 @@ Str_Match(const char *string, const char *pattern)
}
++pattern;
}
if (nomatch)
if (nomatch && (*pattern != ']') && (*pattern != 0))
return 0;
while ((*pattern != ']') && (*pattern != 0))
++pattern;

View File

@ -16,4 +16,5 @@ LIB=e X_LIBS:M*/lib${LIB}.a:tu is "/TMP/LIBE.A"
Mscanner=OK
Upper=One Two Three Four
Lower=five six seven
nose=One Three five
exit status 0

View File

@ -31,3 +31,4 @@ LIST= One Two Three Four five six seven
check-cclass:
@echo Upper=${LIST:M[A-Z]*}
@echo Lower=${LIST:M[^A-Z]*}
@echo nose=${LIST:M[^s]*[ex]}