Sync with upstream version (20130520) that includes same fixes made last week.

This commit is contained in:
Simon J. Gerraty 2013-05-20 22:51:11 +00:00
commit 52d8625616
17 changed files with 423 additions and 240 deletions

View File

@ -1,3 +1,17 @@
2013-05-20 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (MAKE_VERSION): 20130520
generate manifest from component FILES rather than have to
update FILES when mk/FILES changes.
2013-05-18 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (MAKE_VERSION): 20130518
Merge with NetBSD make, pick up
o suff.c: don't skip all processsing for .PHONY targets
else wildcard srcs do not get expanded.
o var.c: expand name of variable to delete if necessary.
2013-03-30 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (MAKE_VERSION): 20130330

View File

@ -1,29 +1,26 @@
FILES
ChangeLog
bmake.cat1
boot-strap
bsd.after-import.mk
os.sh
makefile.in
FILES
Makefile
Makefile.config.in
PSD.doc/Makefile
PSD.doc/tutorial.ms
README
aclocal.m4
arch.c
bmake.1
bmake.cat1
boot-strap
bsd.after-import.mk
buf.c
buf.h
compat.c
cond.c
make-conf.h
make_malloc.c
make_malloc.h
config.h.in
configure
aclocal.m4
configure.in
dir.c
dir.h
dirname.c
find_lib.sh
for.c
getopt.c
@ -32,16 +29,6 @@ hash.h
install-sh
job.c
job.h
meta.c
meta.h
dirname.c
realpath.c
strlcpy.c
strlist.c
strlist.h
stresep.c
trace.c
trace.h
lst.h
lst.lib/Makefile
lst.lib/lstAppend.c
@ -74,26 +61,36 @@ lst.lib/lstReplace.c
lst.lib/lstSucc.c
machine.sh
main.c
make-bootstrap.sh.in
make-conf.h
make.1
bmake.1
make.c
make.h
make-bootstrap.sh.in
make_malloc.c
make_malloc.h
makefile.in
meta.c
meta.h
missing/sys/cdefs.h
mkdeps.sh
nonints.h
os.sh
parse.c
pathnames.h
ranlib.h
realpath.c
setenv.c
sigcompat.c
sprite.h
str.c
stresep.c
strlcpy.c
strlist.c
strlist.h
suff.c
targ.c
util.c
var.c
wait.h
trace.c
trace.h
unit-tests/Makefile.in
unit-tests/comment
unit-tests/cond1
@ -123,63 +120,6 @@ unit-tests/test.exp
unit-tests/unexport
unit-tests/unexport-env
unit-tests/varcmd
mk/ChangeLog
mk/FILES
mk/README
mk/auto.obj.mk
mk/autoconf.mk
mk/autodep.mk
mk/auto.dep.mk
mk/dep.mk
mk/doc.mk
mk/dpadd.mk
mk/final.mk
mk/host-target.mk
mk/host.libnames.mk
mk/inc.mk
mk/init.mk
mk/install-mk
mk/java.mk
mk/lib.mk
mk/libnames.mk
mk/libs.mk
mk/links.mk
mk/man.mk
mk/mk-files.txt
mk/nls.mk
mk/obj.mk
mk/options.mk
mk/own.mk
mk/prlist.mk
mk/prog.mk
mk/progs.mk
mk/rst2htm.mk
mk/scripts.mk
mk/srctop.mk
mk/subdir.mk
mk/sys.mk
mk/sys.clean-env.mk
mk/sys.dependfile.mk
mk/sys/AIX.mk
mk/sys/Darwin.mk
mk/sys/Generic.mk
mk/sys/HP-UX.mk
mk/sys/IRIX.mk
mk/sys/Linux.mk
mk/sys/NetBSD.mk
mk/sys/OSF1.mk
mk/sys/OpenBSD.mk
mk/sys/SunOS.mk
mk/sys/UnixWare.mk
mk/target-flags.mk
mk/warnings.mk
mk/yacc.mk
mk/dirdeps.mk
mk/gendirdeps.mk
mk/install-new.mk
mk/meta2deps.py
mk/meta2deps.sh
mk/meta.sys.mk
mk/meta.autodep.mk
mk/meta.stage.mk
mk/meta.subdir.mk
util.c
var.c
wait.h

View File

@ -1,7 +1,7 @@
# $Id: Makefile,v 1.10 2013/03/31 05:57:19 sjg Exp $
# $Id: Makefile,v 1.12 2013/05/20 16:05:10 sjg Exp $
# Base version on src date
MAKE_VERSION= 20130330
MAKE_VERSION= 20130520
PROG= bmake

View File

@ -1,4 +1,4 @@
/* $NetBSD: meta.c,v 1.29 2013/03/31 05:49:51 sjg Exp $ */
/* $NetBSD: meta.c,v 1.30 2013/05/16 21:56:56 sjg Exp $ */
/*
* Implement 'meta' mode.
@ -543,7 +543,7 @@ boolValue(char *s)
* Initialization we need before reading makefiles.
*/
void
meta_init()
meta_init(void)
{
#ifdef USE_FILEMON
/* this allows makefiles to test if we have filemon support */

View File

@ -1,3 +1,23 @@
2013-05-10 Simon J. Gerraty <sjg@bad.crufty.net>
* install-mk (MK_VERSION): 20130505
* gendirdeps.mk, meta2deps.py, meta2deps.sh: handle $TARGET_SPEC
for when $MACHINE isn't enough for objdir distinction.
Bring meta2deps.sh closer to par with meta2deps.py.
2013-04-18 Simon J. Gerraty <sjg@bad.crufty.net>
* meta.stage.mk: set INSTALL to STAGE_INSTALL when making 'all'
also if the target 'beforeinstall' exists, make it depend on
.dirdep (incase it uses STAGE_INSTALL).
2013-04-17 Simon J. Gerraty <sjg@bad.crufty.net>
* install-mk (MK_VERSION): 20130401 ;-)
* meta.stage.mk (STAGE_INSTALL_SH): add stage-install.sh as
wrapper around install(1).
* options.mk (OPTION_PREFIX): Allow a prefix other than MK_
2013-03-30 Simon J. Gerraty <sjg@bad.crufty.net>
* meta2deps.py (MetaFile.__init__): ensure self.cwd is initialized.

View File

@ -31,6 +31,7 @@ progs.mk
rst2htm.mk
scripts.mk
srctop.mk
stage-install.sh
subdir.mk
sys.mk
sys.clean-env.mk

View File

@ -1,4 +1,4 @@
# $Id: gendirdeps.mk,v 1.21 2013/03/28 20:01:05 sjg Exp $
# $Id: gendirdeps.mk,v 1.22 2013/05/11 05:16:26 sjg Exp $
# Copyright (c) 2010-2013, Juniper Networks, Inc.
# All rights reserved.
@ -111,13 +111,24 @@ _py_d =
.if ${META2DEPS:E} == "py"
# we can afford to do this all the time.
DPDEPS ?= no
META2DEPS_CMD = ${_time} ${PYTHON} ${META2DEPS} ${_py_d} \
-R ${RELDIR} -H ${HOST_TARGET} \
${M2D_OBJROOTS:O:u:@o@-O $o@}
META2DEPS_CMD = ${_time} ${PYTHON} ${META2DEPS} ${_py_d}
.if ${DPDEPS:tl} != "no"
META2DEPS_CMD += -D ${DPDEPS}
.endif
META2DEPS_FILTER = sed 's,^src:,${SRCTOP}/,;s,^\([^/]\),${OBJTOP}/\1,' |
.elif ${META2DEPS:E} == "sh"
META2DEPS_CMD = ${_time} ${_sh_x} ${META2DEPS} OBJTOP=${_OBJTOP}
.else
META2DEPS_CMD ?= ${META2DEPS}
.endif
.if ${TARGET_OBJ_SPEC:U${MACHINE}} != ${MACHINE}
META2DEPS_CMD += -T ${TARGET_OBJ_SPEC}
.endif
META2DEPS_CMD += \
-R ${RELDIR} -H ${HOST_TARGET} \
${M2D_OBJROOTS:O:u:@o@-O $o@}
M2D_OBJROOTS += ${OBJTOP} ${_OBJROOT} ${_objroot}
.if defined(SB_OBJROOT)
@ -133,13 +144,6 @@ META2DEPS_ARGS += MACHINE=none
META2DEPS_CMD += -S ${SB_BACKING_SB}/src
M2D_OBJROOTS += ${SB_BACKING_SB}/${SB_OBJPREFIX}
.endif
META2DEPS_FILTER = sed 's,^src:,${SRCTOP}/,;s,^\([^/]\),${OBJTOP}/\1,' |
.elif ${META2DEPS:E} == "sh"
META2DEPS_CMD = ${_time} ${_sh_x} ${META2DEPS} \
OBJTOP=${_objtop} SB_OBJROOT=${_objroot}
.else
META2DEPS_CMD ?= ${META2DEPS}
.endif
# we are only interested in the dirs
# sepecifically those we read something from.

View File

@ -55,7 +55,7 @@
# Simon J. Gerraty <sjg@crufty.net>
# RCSid:
# $Id: install-mk,v 1.88 2013/03/31 22:31:59 sjg Exp $
# $Id: install-mk,v 1.90 2013/05/11 05:16:26 sjg Exp $
#
# @(#) Copyright (c) 1994 Simon J. Gerraty
#
@ -70,7 +70,7 @@
# sjg@crufty.net
#
MK_VERSION=20130330
MK_VERSION=20130505
OWNER=
GROUP=
MODE=444

View File

@ -1,4 +1,4 @@
# $Id: meta.stage.mk,v 1.24 2013/03/23 02:25:19 sjg Exp $
# $Id: meta.stage.mk,v 1.30 2013/04/19 16:32:57 sjg Exp $
#
# @(#) Copyright (c) 2011, Simon J. Gerraty
#
@ -228,4 +228,17 @@ STAGING_WAIT ?= .WAIT
all: ${STAGING_WAIT} staging
.if exists(${.PARSEDIR}/stage-install.sh) && !defined(STAGE_INSTALL)
# this will run install(1) and then followup with .dirdep files.
STAGE_INSTALL := sh ${.PARSEDIR:tA}/stage-install.sh INSTALL="${INSTALL}" OBJDIR=${.OBJDIR:tA}
.endif
# if ${INSTALL} gets run during 'all' assume it is for staging?
.if ${.TARGETS:Nall} == "" && defined(STAGE_INSTALL)
INSTALL := ${STAGE_INSTALL}
.if target(beforeinstall)
beforeinstall: .dirdep
.endif
.endif
.endif

View File

@ -35,7 +35,7 @@
"""
RCSid:
$Id: meta2deps.py,v 1.12 2013/03/31 22:31:59 sjg Exp $
$Id: meta2deps.py,v 1.13 2013/05/11 05:16:26 sjg Exp $
Copyright (c) 2011-2013, Juniper Networks, Inc.
All rights reserved.
@ -124,6 +124,12 @@ def sort_unique(list, cmp=None, key=None, reverse=False):
nl.append(e)
return nl
def add_trims(x):
return ['/' + x + '/',
'/' + x,
x + '/',
x]
class MetaFile:
"""class to parse meta files generated by bmake."""
@ -152,6 +158,9 @@ def __init__(self, name, conf={}):
set to 'none' if we are not cross-building.
More specifically if machine cannot be deduced from objdirs.
TARGET_SPEC
Sometimes MACHINE isn't enough.
HOST_TARGET
when we build for the psuedo machine 'host'
the object tree uses HOST_TARGET rather than MACHINE.
@ -177,6 +186,8 @@ def __init__(self, name, conf={}):
self.debug_out = getv(conf, 'debug_out', sys.stderr)
self.machine = getv(conf, 'MACHINE', '')
self.machine_arch = getv(conf, 'MACHINE_ARCH', '')
self.target_spec = getv(conf, 'TARGET_SPEC', '')
self.curdir = getv(conf, 'CURDIR')
self.reldir = getv(conf, 'RELDIR')
self.dpdeps = getv(conf, 'DPDEPS')
@ -196,16 +207,11 @@ def __init__(self, name, conf={}):
if not _srctop in self.srctops:
self.srctops.append(_srctop)
trim_list = ['/' + self.machine + '/',
'/' + self.machine,
self.machine + '/',
self.machine]
trim_list = add_trims(self.machine)
if self.machine == 'host':
trim_list += ['/' + self.host_target + '/',
'/' + self.host_target,
self.host_target + '/',
self.host_target]
trim_list += add_trims(self.host_target)
if self.target_spec:
trim_list += add_trims(self.target_spec)
for objroot in getv(conf, 'OBJROOTS', []):
for e in trim_list:
@ -303,6 +309,8 @@ def find_obj(self, objroot, dir, path, input):
print >> self.debug_out, "found %s: %s\n" % (ddepf, ddep)
if ddep.endswith(self.machine):
ddep = ddep[0:-(1+len(self.machine))]
elif self.target_spec and ddep.endswith(self.target_spec):
ddep = ddep[0:-(1+len(self.target_spec))]
if not ddep:
# no .dirdeps, so remember that we've seen the raw input
@ -520,6 +528,8 @@ def main(argv, klass=MetaFile, xopts='', xoptf=None):
-m "MACHINE"
-a "MACHINE_ARCH"
-H "HOST_TARGET"
-D "DPDEPS"
@ -548,6 +558,9 @@ def main(argv, klass=MetaFile, xopts='', xoptf=None):
machine = os.environ['MACHINE']
if machine:
conf['MACHINE'] = machine
machine_arch = os.environ['MACHINE_ARCH']
if machine_arch:
conf['MACHINE_ARCH'] = machine_arch
srctop = os.environ['SB_SRC']
if srctop:
conf['SRCTOPS'].append(srctop)
@ -560,9 +573,11 @@ def main(argv, klass=MetaFile, xopts='', xoptf=None):
debug = 0
output = True
opts, args = getopt.getopt(argv[1:], 'dS:C:O:R:m:D:H:q' + xopts)
opts, args = getopt.getopt(argv[1:], 'a:dS:C:O:R:m:D:H:qT:' + xopts)
for o, a in opts:
if o == '-d':
if o == '-a':
conf['MACHINE_ARCH'] = a
elif o == '-d':
debug += 1
elif o == '-q':
output = False
@ -582,6 +597,8 @@ def main(argv, klass=MetaFile, xopts='', xoptf=None):
conf['DPDEPS'] = a
elif o == '-m':
conf['MACHINE'] = a
elif o == '-T':
conf['TARGET_SPEC'] = a
elif xoptf:
xoptf(o, a, conf)

View File

@ -49,8 +49,8 @@
# The output, is a set of absolute paths with "SB" like:
#.nf
#
# $SB/obj-i386/junos/gnu/lib/csu
# $SB/obj-i386/junos/gnu/lib/libgcc
# $SB/obj-i386/bsd/gnu/lib/csu
# $SB/obj-i386/bsd/gnu/lib/libgcc
# $SB/obj-i386/bsd/include
# $SB/obj-i386/bsd/lib/csu/i386-elf
# $SB/obj-i386/bsd/lib/libc
@ -77,9 +77,9 @@
# RCSid:
# $Id: meta2deps.sh,v 1.5 2013/02/10 19:21:46 sjg Exp $
# $Id: meta2deps.sh,v 1.6 2013/05/11 05:16:26 sjg Exp $
# Copyright (c) 2010-2012, Juniper Networks, Inc.
# Copyright (c) 2010-2013, Juniper Networks, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -115,16 +115,89 @@ meta2dirs() {
sort -u
}
add_list() {
sep=' '
suffix=
while :
do
case "$1" in
"|") sep="$1"; shift;;
-s) suffix="$2"; shift 2;;
*) break;;
esac
done
name=$1
shift
eval list="\$$name"
for top in "$@"
do
case "$sep$list$sep" in
*"$sep$top$suffix$sep"*) continue;;
esac
list="${list:+$list$sep}$top$suffix"
done
eval "$name=\"$list\""
}
meta2deps() {
DPDEPS=
SRCTOPS=$SRCTOP
OBJROOTS=
while :
do
case "$1" in
*=*) eval export "$1"; shift;;
-a) MACHINE_ARCH=$2; shift 2;;
-m) MACHINE=$2; shift 2;;
-C) CURDIR=$2; shift 2;;
-H) HOST_TARGET=$2; shift 2;;
-S) add_list SRCTOPS $2; shift 2;;
-O) add_list OBJROOTS $2; shift 2;;
-R) RELDIR=$2; shift 2;;
-T) TARGET_SPEC=$2; shift 2;;
*) break;;
esac
done
_th= _o=
case "$MACHINE" in
host) _ht=$HOST_TARGET;;
esac
for o in $OBJROOTS
do
case "$MACHINE,/$o/" in
host,*$HOST_TARGET*) ;;
*$MACHINE*|*${TARGET_SPEC:-$MACHINE}*) ;;
*) add_list _o $o; continue;;
esac
for x in $_ht $TARGET_SPEC $MACHINE
do
case "$o" in
"") continue;;
*/$x/) add_list _o ${o%$x/}; o=;;
*/$x) add_list _o ${o%$x}; o=;;
*$x/) add_list _o ${o%$x/}; o=;;
*$x) add_list _o ${o%$x}; o=;;
esac
done
done
OBJROOTS="$_o"
case "$OBJTOP" in
"")
for o in $OBJROOTS
do
OBJTOP=$o${TARGET_SPEC:-$MACHINE}
break
done
;;
esac
src_re=
obj_re=
add_list '|' -s '/*' src_re $SRCTOPS
add_list '|' -s '*' obj_re $OBJROOTS
[ -z "$RELDIR" ] && unset DPDEPS
tf=/tmp/m2d$$-$USER
rm -f $tf.*
@ -166,8 +239,7 @@ meta2deps() {
esac
case "$op,$path" in
*.dirdep) continue;;
W,*srcrel) continue;;
W,*srcrel|*.dirdep) continue;;
C,*)
case "$path" in
/*) cwd=$path;;
@ -182,8 +254,7 @@ meta2deps() {
;;
*) dir=${path%/*}
case "$path" in
$SB/*|${SB_BACKING_SB:-$SB}/*) ;;
$SB_OBJROOT*) ;;
$src_re|$obj_re) ;;
/*/stage/*) ;;
/*) continue;;
*) for path in $ldir/$path $cwd/$path
@ -215,7 +286,7 @@ meta2deps() {
esac
case "$dir" in
${CURDIR:-.}|${CURDIR:-.}/*|"") continue;;
$SRCTOP/*|${SB_BACKING_SB:-$SB}/src/*)
$src_re)
# avoid repeating ourselves...
case "$DPDEPS,$seensrc," in
,*)
@ -241,7 +312,7 @@ meta2deps() {
[ -f $path ] || continue
case "$dir" in
$CWD) continue;; # ignore
$SRCTOP/*|${SB_BACKING_SB:-$SB}/src/*)
$src_re)
seenit="$seenit,$seen"
echo $dir >> $tf.srcdep
case "$DPDEPS,$reldir,$seensrc," in
@ -267,7 +338,7 @@ meta2deps() {
fi
seenit="$seenit,$seen"
case "$dir" in
$SB/*|${SB_OBJROOT:-$SB/}*|${SB_BACKING_SB:-$SB}/*)
$obj_re)
echo $dir;;
esac
done > $tf.dirdep
@ -283,7 +354,7 @@ meta2deps() {
# qualified with .<machine> as needed.
# We strip .$MACHINE though
xargs cat < $f | sort -u |
sed "s,^# ,,;s,^,$OBJTOP/,;s,\.$MACHINE\$,,"
sed "s,^# ,,;s,^,$OBJTOP/,;s,\.${TARGET_SPEC:-$MACHINE}\$,,;s,\.$MACHINE\$,,"
;;
*) sort -u $f;;
esac

View File

@ -1,4 +1,4 @@
# $Id: options.mk,v 1.6 2013/01/28 19:28:52 sjg Exp $
# $Id: options.mk,v 1.7 2013/04/17 20:32:38 sjg Exp $
#
# @(#) Copyright (c) 2012, Simon J. Gerraty
#
@ -13,7 +13,7 @@
# sjg@crufty.net
#
# Inspired by FreeBSD bsd.own.mk, but intentionally simpler.
# Inspired by FreeBSD bsd.own.mk, but intentionally simpler and more flexible.
# Options are normally listed in either OPTIONS_DEFAULT_{YES,NO}
# We convert these to ${OPTION}/{yes,no} in OPTIONS_DEFAULT_VALUES.
@ -24,35 +24,36 @@
# ${OPTION}/yes in OPTIONS_DEFAULT_VALUES.
# A makefile may set NO_* (or NO*) to indicate it cannot do something.
# User sets WITH_* and WITHOUT_* to indicate what they want.
# We set MK_* which is then all we need care about.
# We set ${OPTION_PREFIX:UMK_}* which is then all we need care about.
OPTIONS_DEFAULT_VALUES += \
${OPTIONS_DEFAULT_NO:O:u:S,$,/no,} \
${OPTIONS_DEFAULT_YES:O:u:S,$,/yes,}
OPTION_PREFIX ?= MK_
.for o in ${OPTIONS_DEFAULT_VALUES:M*/*}
.if ${o:T:tl} == "no"
.if defined(WITH_${o:H}) && !defined(NO_${o:H}) && !defined(NO${o:H})
MK_${o:H} ?= yes
${OPTION_PREFIX}${o:H} ?= yes
.else
MK_${o:H} ?= no
${OPTION_PREFIX}${o:H} ?= no
.endif
.else
.if defined(WITHOUT_${o:H}) || defined(NO_${o:H}) || defined(NO${o:H})
MK_${o:H} ?= no
${OPTION_PREFIX}${o:H} ?= no
.else
MK_${o:H} ?= yes
${OPTION_PREFIX}${o:H} ?= yes
.endif
.endif
.endfor
# OPTIONS_DEFAULT_DEPENDENT += FOO_UTILS/FOO
# if neither WITH[OUT]_FOO_UTILS is set, use value of MK_FOO
# if neither WITH[OUT]_FOO_UTILS is set, use value of ${OPTION_PREFIX}FOO
.for o in ${OPTIONS_DEFAULT_DEPENDENT:M*/*:O:u}
.if defined(WITH_${o:H}) && !defined(NO_${o:H}) && !defined(NO${o:H})
MK_${o:H} ?= yes
${OPTION_PREFIX}${o:H} ?= yes
.elif defined(WITHOUT_${o:H}) || defined(NO_${o:H}) || defined(NO${o:H})
MK_${o:H} ?= no
${OPTION_PREFIX}${o:H} ?= no
.else
MK_${o:H} ?= ${MK_${o:T}}
${OPTION_PREFIX}${o:H} ?= ${${OPTION_PREFIX}${o:T}}
.endif
.endfor

View File

@ -1,4 +1,4 @@
# $Id: progs.mk,v 1.11 2012/11/06 17:18:54 sjg Exp $
# $Id: progs.mk,v 1.12 2013/04/22 18:10:04 sjg Exp $
#
# @(#) Copyright (c) 2006, Simon J. Gerraty
#
@ -35,9 +35,11 @@ PROG ?= $t
.if defined(PROG)
# just one of many
PROG_VARS += CFLAGS CPPFLAGS CXXFLAGS DPADD DPLIBS LDADD MAN SRCS
PROG_VARS += BINDIR CFLAGS CPPFLAGS CXXFLAGS DPADD DPLIBS LDADD MAN SRCS
.for v in ${PROG_VARS:O:u}
.if defined(${v}.${PROG})
$v += ${${v}_${PROG}:U${${v}.${PROG}}}
.endif
.endfor
# for meta mode, there can be only one!
@ -63,7 +65,8 @@ UPDATE_DEPENDFILE = NO
.include <${.PARSEFILE:S,progs,prog,}>
.ifndef PROG
PROGS_TARGETS += clean
# tell progs.mk we might want to install things
PROGS_TARGETS+= cleandepend cleandir cleanobj depend install
.for p in ${PROGS}
.if defined(PROGS_CXX) && !empty(PROGS_CXX:M$p)

View File

@ -0,0 +1,98 @@
#!/bin/sh
# NAME:
# stage-install.sh - wrapper around install
#
# SYNOPSIS:
# stage-install.sh [variable="value"] "args" "dest"
#
# DESCRIPTION:
# This script is a wrapper around the normal install(1).
# Its role is to add '.dirdep' files to the destination.
# The variables we might use are:
#
# INSTALL
# Path to actual install(1), default is
# $REAL_INSTALL
#
# OBJDIR
# Path to the dir where '.dirdep' was generated,
# default is '.'
#
# _DIRDEP
# Path to actual '.dirdep' file, default is
# $OBJDIR/.dirdep
#
# The "args" and "dest" are passed as is to install(1), and if a
# '.dirdep' file exists it will be linked or copied to each
# "file".dirdep placed in "dest" or "dest".dirdep if it happed
# to be a file rather than a directory.
#
# SEE ALSO:
# meta.stage.mk
#
# RCSid:
# $Id: stage-install.sh,v 1.5 2013/04/19 16:32:24 sjg Exp $
#
# @(#) Copyright (c) 2013, 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
#
INSTALL=${REAL_INSTALL:-install}
OBJDIR=.
while :
do
case "$1" in
*=*) eval "$1"; shift;;
*) break;;
esac
done
# if .dirdep doesn't exist, just run install and be done
_DIRDEP=${_DIRDEP:-$OBJDIR/.dirdep}
[ -s $_DIRDEP ] && EXEC= || EXEC=exec
$EXEC $INSTALL "$@" || exit 1
# from meta.stage.mk
LnCp() {
rm -f $2 2> /dev/null
ln $1 $2 2> /dev/null || cp -p $1 $2
}
StageDirdep() {
t=$1
if [ -s $t.dirdep ]; then
cmp -s $_DIRDEP $t.dirdep && return
echo "ERROR: $t installed by `cat $t.dirdep` not `cat $_DIRDEP`" >&2
exit 1
fi
LnCp $_DIRDEP $t.dirdep || exit 1
}
args="$@"
while [ $# -gt 8 ]
do
shift 8
done
eval dest=\$$#
if [ -f $dest ]; then
# a file, there can be only one .dirdep needed
StageDirdep $dest
elif [ -d $dest ]; then
for f in $args
do
test -f $f || continue
StageDirdep $dest/${f##*/}
done
fi

View File

@ -1,4 +1,4 @@
/* $NetBSD: suff.c,v 1.69 2011/09/29 23:38:04 sjg Exp $ */
/* $NetBSD: suff.c,v 1.70 2013/05/18 13:13:34 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: suff.c,v 1.69 2011/09/29 23:38:04 sjg Exp $";
static char rcsid[] = "$NetBSD: suff.c,v 1.70 2013/05/18 13:13:34 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)suff.c 8.4 (Berkeley) 3/21/94";
#else
__RCSID("$NetBSD: suff.c,v 1.69 2011/09/29 23:38:04 sjg Exp $");
__RCSID("$NetBSD: suff.c,v 1.70 2013/05/18 13:13:34 sjg Exp $");
#endif
#endif /* not lint */
#endif
@ -2063,118 +2063,119 @@ SuffFindNormalDeps(GNode *gn, Lst slst)
if (!(gn->type & OP_PHONY)) {
while (ln != NULL) {
/*
* Look for next possible suffix...
*/
ln = Lst_FindFrom(sufflist, ln, &sd, SuffSuffIsSuffixP);
if (ln != NULL) {
int prefLen; /* Length of the prefix */
while (ln != NULL) {
/*
* Allocate a Src structure to which things can be transformed
* Look for next possible suffix...
*/
ln = Lst_FindFrom(sufflist, ln, &sd, SuffSuffIsSuffixP);
if (ln != NULL) {
int prefLen; /* Length of the prefix */
/*
* Allocate a Src structure to which things can be transformed
*/
targ = bmake_malloc(sizeof(Src));
targ->file = bmake_strdup(gn->name);
targ->suff = (Suff *)Lst_Datum(ln);
targ->suff->refCount++;
targ->node = gn;
targ->parent = NULL;
targ->children = 0;
#ifdef DEBUG_SRC
targ->cp = Lst_Init(FALSE);
#endif
/*
* Allocate room for the prefix, whose end is found by
* subtracting the length of the suffix from
* the end of the name.
*/
prefLen = (eoname - targ->suff->nameLen) - sopref;
targ->pref = bmake_malloc(prefLen + 1);
memcpy(targ->pref, sopref, prefLen);
targ->pref[prefLen] = '\0';
/*
* Add nodes from which the target can be made
*/
SuffAddLevel(srcs, targ);
/*
* Record the target so we can nuke it
*/
(void)Lst_AtEnd(targs, targ);
/*
* Search from this suffix's successor...
*/
ln = Lst_Succ(ln);
}
}
/*
* Handle target of unknown suffix...
*/
if (Lst_IsEmpty(targs) && suffNull != NULL) {
if (DEBUG(SUFF)) {
fprintf(debug_file, "\tNo known suffix on %s. Using .NULL suffix\n", gn->name);
}
targ = bmake_malloc(sizeof(Src));
targ->file = bmake_strdup(gn->name);
targ->suff = (Suff *)Lst_Datum(ln);
targ->suff = suffNull;
targ->suff->refCount++;
targ->node = gn;
targ->parent = NULL;
targ->children = 0;
targ->pref = bmake_strdup(sopref);
#ifdef DEBUG_SRC
targ->cp = Lst_Init(FALSE);
#endif
/*
* Allocate room for the prefix, whose end is found by subtracting
* the length of the suffix from the end of the name.
* Only use the default suffix rules if we don't have commands
* defined for this gnode; traditional make programs used to
* not define suffix rules if the gnode had children but we
* don't do this anymore.
*/
prefLen = (eoname - targ->suff->nameLen) - sopref;
targ->pref = bmake_malloc(prefLen + 1);
memcpy(targ->pref, sopref, prefLen);
targ->pref[prefLen] = '\0';
if (Lst_IsEmpty(gn->commands))
SuffAddLevel(srcs, targ);
else {
if (DEBUG(SUFF))
fprintf(debug_file, "not ");
}
/*
* Add nodes from which the target can be made
*/
SuffAddLevel(srcs, targ);
/*
* Record the target so we can nuke it
*/
(void)Lst_AtEnd(targs, targ);
/*
* Search from this suffix's successor...
*/
ln = Lst_Succ(ln);
}
}
/*
* Handle target of unknown suffix...
*/
if (Lst_IsEmpty(targs) && suffNull != NULL) {
if (DEBUG(SUFF)) {
fprintf(debug_file, "\tNo known suffix on %s. Using .NULL suffix\n", gn->name);
}
targ = bmake_malloc(sizeof(Src));
targ->file = bmake_strdup(gn->name);
targ->suff = suffNull;
targ->suff->refCount++;
targ->node = gn;
targ->parent = NULL;
targ->children = 0;
targ->pref = bmake_strdup(sopref);
#ifdef DEBUG_SRC
targ->cp = Lst_Init(FALSE);
#endif
/*
* Only use the default suffix rules if we don't have commands
* defined for this gnode; traditional make programs used to
* not define suffix rules if the gnode had children but we
* don't do this anymore.
*/
if (Lst_IsEmpty(gn->commands))
SuffAddLevel(srcs, targ);
else {
if (DEBUG(SUFF))
fprintf(debug_file, "not ");
fprintf(debug_file, "adding suffix rules\n");
(void)Lst_AtEnd(targs, targ);
}
if (DEBUG(SUFF))
fprintf(debug_file, "adding suffix rules\n");
(void)Lst_AtEnd(targs, targ);
}
/*
* Using the list of possible sources built up from the target suffix(es),
* try and find an existing file/target that matches.
*/
bottom = SuffFindThem(srcs, slst);
if (bottom == NULL) {
/*
* No known transformations -- use the first suffix found for setting
* the local variables.
* Using the list of possible sources built up from the target
* suffix(es), try and find an existing file/target that matches.
*/
if (!Lst_IsEmpty(targs)) {
targ = (Src *)Lst_Datum(Lst_First(targs));
bottom = SuffFindThem(srcs, slst);
if (bottom == NULL) {
/*
* No known transformations -- use the first suffix found
* for setting the local variables.
*/
if (!Lst_IsEmpty(targs)) {
targ = (Src *)Lst_Datum(Lst_First(targs));
} else {
targ = NULL;
}
} else {
targ = NULL;
/*
* Work up the transformation path to find the suffix of the
* target to which the transformation was made.
*/
for (targ = bottom; targ->parent != NULL; targ = targ->parent)
continue;
}
} else {
/*
* Work up the transformation path to find the suffix of the
* target to which the transformation was made.
*/
for (targ = bottom; targ->parent != NULL; targ = targ->parent)
continue;
}
}
Var_Set(TARGET, gn->path ? gn->path : gn->name, gn, 0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: var.c,v 1.173 2013/02/24 19:43:37 christos Exp $ */
/* $NetBSD: var.c,v 1.174 2013/05/18 13:12:45 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: var.c,v 1.173 2013/02/24 19:43:37 christos Exp $";
static char rcsid[] = "$NetBSD: var.c,v 1.174 2013/05/18 13:12:45 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94";
#else
__RCSID("$NetBSD: var.c,v 1.173 2013/02/24 19:43:37 christos Exp $");
__RCSID("$NetBSD: var.c,v 1.174 2013/05/18 13:12:45 sjg Exp $");
#endif
#endif /* not lint */
#endif

View File

@ -14,10 +14,10 @@ CFLAGS+= -I${.CURDIR}
CLEANDIRS+= FreeBSD
CLEANFILES+= bootstrap
# $Id: Makefile,v 1.10 2013/03/31 05:57:19 sjg Exp $
# $Id: Makefile,v 1.12 2013/05/20 16:05:10 sjg Exp $
# Base version on src date
MAKE_VERSION= 20130330
MAKE_VERSION= 20130520
PROG?= ${.CURDIR:T}