svn commit: r246223 - in head: contrib/bmake contrib/bmake/mk contrib/bmake/unit-tests usr.bin/bmake usr.bin/bmake/unit-tests
Simon J. Gerraty
sjg at FreeBSD.org
Fri Feb 1 22:55:29 UTC 2013
Author: sjg
Date: Fri Feb 1 22:55:27 2013
New Revision: 246223
URL: http://svnweb.freebsd.org/changeset/base/246223
Log:
Merge bmake-20130123
Approved by: marcel (mentor)
Added:
head/contrib/bmake/Makefile
- copied unchanged from r246222, vendor/NetBSD/bmake/dist/Makefile
head/contrib/bmake/Makefile.config.in
- copied unchanged from r246222, vendor/NetBSD/bmake/dist/Makefile.config.in
head/contrib/bmake/makefile.in
- copied unchanged from r246222, vendor/NetBSD/bmake/dist/makefile.in
head/contrib/bmake/mk/
- copied from r246222, vendor/NetBSD/bmake/dist/mk/
Deleted:
head/contrib/bmake/Makefile.in
Modified:
head/contrib/bmake/ChangeLog
head/contrib/bmake/FILES
head/contrib/bmake/bmake.1
head/contrib/bmake/bmake.cat1
head/contrib/bmake/boot-strap
head/contrib/bmake/bsd.after-import.mk
head/contrib/bmake/compat.c
head/contrib/bmake/configure
head/contrib/bmake/configure.in
head/contrib/bmake/job.c
head/contrib/bmake/main.c
head/contrib/bmake/make-bootstrap.sh.in
head/contrib/bmake/make.1
head/contrib/bmake/meta.c
head/contrib/bmake/realpath.c
head/contrib/bmake/unit-tests/Makefile.in
head/contrib/bmake/var.c
head/usr.bin/bmake/Makefile
head/usr.bin/bmake/config.h
head/usr.bin/bmake/unit-tests/Makefile
Directory Properties:
head/contrib/bmake/ (props changed)
Modified: head/contrib/bmake/ChangeLog
==============================================================================
--- head/contrib/bmake/ChangeLog Fri Feb 1 20:17:11 2013 (r246222)
+++ head/contrib/bmake/ChangeLog Fri Feb 1 22:55:27 2013 (r246223)
@@ -1,3 +1,35 @@
+2013-01-27 Simon J. Gerraty <sjg at bad.crufty.net>
+
+ * Merge with NetBSD make, pick up
+ o make.1: more info on how shell commands are handled.
+ o job.c,main.c: detect write errors to job pipes.
+
+2013-01-25 Simon J. Gerraty <sjg at bad.crufty.net>
+
+ * Makefile (MAKE_VERSION): 20130123
+ Merge with NetBSD make, pick up
+ o meta.c: if script uses .OODATE and meta_oodate() decides
+ rebuild is needed, .OODATE will be empty - set it to .ALLSRC.
+ o var.c: in debug output indicate which variabale modifiers
+ apply to.
+ o remove Check_Cwd logic the makefiles have been fixed.
+
+2012-12-12 Simon J. Gerraty <sjg at bad.crufty.net>
+
+ * makefile.in: add a simple makefile for folk who insist on
+ ./configure; make; make install
+ it just runs boot-strap
+ * include mk/* to accommodate the above
+ * boot-strap: re-work to accommodate the above
+ mksrc defaults to $Mydir/mk
+ allow op={configure,build,install,clean,all}
+ add options to facilitate install
+ * Makefile.config.in: just the bits set by configure
+ * Makefile: bump version to 20121212
+ abandon Makefile.in (NetBSD Makefile)
+ leverage mk/* instead
+ * configure.in: ensure srcdir is absolute
+
2012-11-11 Simon J. Gerraty <sjg at bad.crufty.net>
* Makefile.in (MAKE_VERSION): 20121111
Modified: head/contrib/bmake/FILES
==============================================================================
--- head/contrib/bmake/FILES Fri Feb 1 20:17:11 2013 (r246222)
+++ head/contrib/bmake/FILES Fri Feb 1 22:55:27 2013 (r246223)
@@ -4,7 +4,9 @@ bmake.cat1
boot-strap
bsd.after-import.mk
os.sh
-Makefile.in
+makefile.in
+Makefile
+Makefile.config.in
PSD.doc/Makefile
PSD.doc/tutorial.ms
README
@@ -120,3 +122,63 @@ 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
Copied: head/contrib/bmake/Makefile (from r246222, vendor/NetBSD/bmake/dist/Makefile)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/contrib/bmake/Makefile Fri Feb 1 22:55:27 2013 (r246223, copy of r246222, vendor/NetBSD/bmake/dist/Makefile)
@@ -0,0 +1,221 @@
+# $Id: Makefile,v 1.5 2013/01/28 19:31:58 sjg Exp $
+
+# Base version on src date
+MAKE_VERSION= 20130123
+
+PROG= bmake
+
+SRCS= \
+ arch.c \
+ buf.c \
+ compat.c \
+ cond.c \
+ dir.c \
+ for.c \
+ hash.c \
+ job.c \
+ main.c \
+ make.c \
+ make_malloc.c \
+ meta.c \
+ parse.c \
+ str.c \
+ strlist.c \
+ suff.c \
+ targ.c \
+ trace.c \
+ util.c \
+ var.c
+
+# from lst.lib/
+SRCS+= \
+ lstAppend.c \
+ lstAtEnd.c \
+ lstAtFront.c \
+ lstClose.c \
+ lstConcat.c \
+ lstDatum.c \
+ lstDeQueue.c \
+ lstDestroy.c \
+ lstDupl.c \
+ lstEnQueue.c \
+ lstFind.c \
+ lstFindFrom.c \
+ lstFirst.c \
+ lstForEach.c \
+ lstForEachFrom.c \
+ lstInit.c \
+ lstInsert.c \
+ lstIsAtEnd.c \
+ lstIsEmpty.c \
+ lstLast.c \
+ lstMember.c \
+ lstNext.c \
+ lstOpen.c \
+ lstPrev.c \
+ lstRemove.c \
+ lstReplace.c \
+ lstSucc.c
+
+# this file gets generated by configure
+.-include "Makefile.config"
+
+.if !empty(LIBOBJS)
+SRCS+= ${LIBOBJS:T:.o=.c}
+.endif
+
+# just in case
+prefix?= /usr
+srcdir?= ${.CURDIR}
+
+DEFAULT_SYS_PATH?= .../share/mk:${prefix}/share/mk
+
+CPPFLAGS+= -DUSE_META
+CFLAGS+= ${CPPFLAGS}
+CFLAGS+= -D_PATH_DEFSYSPATH=\"${DEFAULT_SYS_PATH}\"
+CFLAGS+= -I. -I${srcdir} ${XDEFS} -DMAKE_NATIVE
+CFLAGS+= ${COPTS.${.ALLSRC:M*.c:T:u}}
+COPTS.main.c+= "-DMAKE_VERSION=\"${MAKE_VERSION}\""
+
+# meta mode can be useful even without filemon
+FILEMON_H ?= /usr/include/dev/filemon/filemon.h
+.if exists(${FILEMON_H}) && ${FILEMON_H:T} == "filemon.h"
+COPTS.meta.c += -DHAVE_FILEMON_H -I${FILEMON_H:H}
+.endif
+
+.PATH: ${srcdir}
+.PATH: ${srcdir}/lst.lib
+
+.if make(obj) || make(clean)
+SUBDIR+= unit-tests
+.endif
+
+# start-delete1 for bsd.after-import.mk
+# we skip a lot of this when building as part of FreeBSD etc.
+
+# list of OS's which are derrived from BSD4.4
+BSD44_LIST= NetBSD FreeBSD OpenBSD DragonFly
+# we are...
+OS!= uname -s
+# are we 4.4BSD ?
+isBSD44:=${BSD44_LIST:M${OS}}
+
+.if ${isBSD44} == ""
+MANTARGET= cat
+INSTALL?=${srcdir}/install-sh
+.if (${MACHINE} == "sun386")
+# even I don't have one of these anymore :-)
+CFLAGS+= -DPORTAR
+.elif (${MACHINE} != "sunos")
+SRCS+= sigcompat.c
+CFLAGS+= -DSIGNAL_FLAGS=SA_RESTART
+.endif
+.else
+MANTARGET?= man
+.endif
+
+# turn this on by default - ignored if we are root
+WITH_INSTALL_AS_USER=
+
+# supress with -DWITHOUT_*
+OPTIONS_DEFAULT_YES+= \
+ AUTOCONF_MK \
+ INSTALL_MK \
+ PROG_LINK
+
+OPTIONS_DEFAULT_NO+= \
+ PROG_VERSION
+
+# process options now
+.include <own.mk>
+
+.if ${MK_PROG_VERSION} == "yes"
+PROG_NAME= ${PROG}-${MAKE_VERSION}
+.if ${MK_PROG_LINK} == "yes"
+SYMLINKS+= ${PROG}-${MAKE_VERSION} ${BINDIR}/${PROG}
+.endif
+.endif
+
+EXTRACT_MAN=no
+# end-delete1
+
+MAN= ${PROG}.1
+MAN1= ${MAN}
+
+.if (${PROG} != "make")
+CLEANFILES+= my.history
+.if make(${MAN}) || !exists(${srcdir}/${MAN})
+my.history: ${MAKEFILE}
+ @(echo ".Nm"; \
+ echo "is derived from NetBSD"; \
+ echo ".Xr make 1 ."; \
+ echo "It uses autoconf to facilitate portability to other platforms."; \
+ echo ".Pp") > $@
+
+.NOPATH: ${MAN}
+${MAN}: make.1 my.history
+ @echo making $@
+ @sed -e 's/^.Nx/NetBSD/' -e '/^.Nm/s/make/${PROG}/' \
+ -e '/^.Sh HISTORY/rmy.history' \
+ -e '/^.Sh HISTORY/,$$s,^.Nm,make,' ${srcdir}/make.1 > $@
+
+all beforeinstall: ${MAN}
+_mfromdir=.
+.endif
+.endif
+
+MANTARGET?= cat
+MANDEST?= ${MANDIR}/${MANTARGET}1
+
+.if ${MANTARGET} == "cat"
+_mfromdir=${srcdir}
+.endif
+
+.include <prog.mk>
+
+CPPFLAGS+= -DMAKE_NATIVE -DHAVE_CONFIG_H
+COPTS.var.c += -Wno-cast-qual
+COPTS.job.c += -Wno-format-nonliteral
+COPTS.parse.c += -Wno-format-nonliteral
+COPTS.var.c += -Wno-format-nonliteral
+
+# Force these
+SHAREDIR= ${prefix}/share
+BINDIR= ${prefix}/bin
+MANDIR= ${SHAREDIR}/man
+
+.if !exists(.depend)
+${OBJS}: config.h
+.endif
+.if ${MK_AUTOCONF_MK} == "yes"
+.include <autoconf.mk>
+.endif
+
+# make sure that MAKE_VERSION gets updated.
+main.o: ${SRCS} ${MAKEFILE}
+
+# start-delete2 for bsd.after-import.mk
+SHARE_MK?=${SHAREDIR}/mk
+MKSRC=${srcdir}/mk
+INSTALL?=${srcdir}/install-sh
+
+.if ${MK_INSTALL_MK} == "yes"
+install: install-mk
+.endif
+
+beforeinstall:
+ test -d ${DESTDIR}${BINDIR} || ${INSTALL} -m 775 -d ${DESTDIR}${BINDIR}
+ test -d ${DESTDIR}${MANDEST} || ${INSTALL} -m 775 -d ${DESTDIR}${MANDEST}
+
+install-mk:
+.if exists(${MKSRC}/install-mk)
+ test -d ${DESTDIR}${SHARE_MK} || ${INSTALL} -m 775 -d ${DESTDIR}${SHARE_MK}
+ sh ${MKSRC}/install-mk -v -m 644 ${DESTDIR}${SHARE_MK}
+.else
+ @echo need to unpack mk.tar.gz under ${srcdir} or set MKSRC; false
+.endif
+# end-delete2
+
+# A simple unit-test driver to help catch regressions
+accept test:
+ cd ${.CURDIR}/unit-tests && MAKEFLAGS= ${.MAKE} -r -m / TEST_MAKE=${TEST_MAKE:U${.OBJDIR}/${PROG:T}} ${.TARGET}
Copied: head/contrib/bmake/Makefile.config.in (from r246222, vendor/NetBSD/bmake/dist/Makefile.config.in)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/contrib/bmake/Makefile.config.in Fri Feb 1 22:55:27 2013 (r246223, copy of r246222, vendor/NetBSD/bmake/dist/Makefile.config.in)
@@ -0,0 +1,16 @@
+# things set by configure
+
+prefix= @prefix@
+srcdir= @srcdir@
+CC?= @CC@
+MACHINE= @machine@
+MACHINE_ARCH= @machine_arch@
+DEFAULT_SYS_PATH= @default_sys_path@
+
+CPPFLAGS+= @CPPFLAGS@
+CFLAGS+= ${CPPFLAGS} @DEFS@
+LDFLAGS= @LDFLAGS@
+LIBOBJS= @LIBOBJS@
+LDADD= @LIBS@
+USE_META= @use_meta@
+FILEMON_H= @filemon_h@
Modified: head/contrib/bmake/bmake.1
==============================================================================
--- head/contrib/bmake/bmake.1 Fri Feb 1 20:17:11 2013 (r246222)
+++ head/contrib/bmake/bmake.1 Fri Feb 1 22:55:27 2013 (r246223)
@@ -1,4 +1,4 @@
-.\" $NetBSD: make.1,v 1.209 2012/10/08 15:09:48 christos Exp $
+.\" $NetBSD: make.1,v 1.210 2013/01/27 18:52:01 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 October 8, 2012
+.Dd January 23, 2013
.Dt MAKE 1
.Os
.Sh NAME
@@ -468,6 +468,50 @@ except that the effect can be limited to
A
.Ql Ic \-
causes any non-zero exit status of the command line to be ignored.
+.Pp
+When
+.Nm
+is run in jobs mode with
+.Fl j Ar max_jobs ,
+the entire script for the target is fed to a
+single instance of the shell.
+.Pp
+In compatibility (non-jobs) mode, each command is run in a separate process.
+If the command contains any shell meta characters
+.Pq Ql #=|^(){};&<>*?[]:$`\e\en
+it will be passed to the shell, otherwise
+.Nm
+will attempt direct execution.
+.Pp
+Since
+.Nm
+will
+.Xr chdir 2
+to
+.Ql Va .OBJDIR
+before executing any targets, each child process
+starts with that as its current working directory.
+.Pp
+Makefiles should be written so that the mode of
+.Nm
+operation does not change their behavior.
+For example, any command which needs to use
+.Dq cd
+or
+.Dq chdir ,
+without side-effect should be put in parenthesis:
+.Bd -literal -offset indent
+
+avoid-chdir-side-effects:
+ @echo Building $@ in `pwd`
+ @(cd ${.CURDIR} && ${.MAKE} $@)
+ @echo Back in `pwd`
+
+ensure-one-shell-regardless-of-mode:
+ @echo Building $@ in `pwd`; \\
+ (cd ${.CURDIR} && ${.MAKE} $@); \\
+ echo Back in `pwd`
+.Ed
.Sh VARIABLE ASSIGNMENTS
Variables in make are much like variables in the shell, and, by tradition,
consist of all upper-case letters.
@@ -2027,28 +2071,6 @@ NetBSD 5.0
so that they still appear to be variable expansions.
In particular this stops them being treated as syntax, and removes some
obscure problems using them in .if statements.
-.Pp
-Unlike other
-.Nm
-programs, this implementation by default executes all commands for a given
-target using a single shell invocation.
-This is done for both efficiency and to simplify error handling in remote
-command invocations.
-Typically this is transparent to the user, unless the target commands change
-the current working directory using
-.Dq cd
-or
-.Dq chdir .
-To be compatible with Makefiles that do this, one can use
-.Fl B
-to disable this behavior.
-.Pp
-In compatibility mode, each command is run in a separate process.
-If the command contains any shell meta characters
-.Pq Ql #=|^(){};&<>*?[]:$`\e\en
-it will be passed to the shell, otherwise
-.Nm
-will attempt direct execution.
.Sh SEE ALSO
.Xr mkdep 1
.Sh HISTORY
Modified: head/contrib/bmake/bmake.cat1
==============================================================================
--- head/contrib/bmake/bmake.cat1 Fri Feb 1 20:17:11 2013 (r246222)
+++ head/contrib/bmake/bmake.cat1 Fri Feb 1 22:55:27 2013 (r246223)
@@ -284,6 +284,32 @@ SSHHEELLLL CCOOMMMMAANNDDSS
line of a script. A `--' causes any non-zero exit status of the command
line to be ignored.
+ When bbmmaakkee is run in jobs mode with --jj _m_a_x___j_o_b_s, the entire script for
+ the target is fed to a single instance of the shell.
+
+ In compatibility (non-jobs) mode, each command is run in a separate
+ process. If the command contains any shell meta characters
+ (`#=|^(){};&<>*?[]:$`\\n') it will be passed to the shell, otherwise
+ bbmmaakkee will attempt direct execution.
+
+ Since bbmmaakkee will chdir(2) to `_._O_B_J_D_I_R' before executing any targets, each
+ child process starts with that as its current working directory.
+
+ Makefiles should be written so that the mode of bbmmaakkee operation does not
+ change their behavior. For example, any command which needs to use
+ ``cd'' or ``chdir'', without side-effect should be put in parenthesis:
+
+
+ avoid-chdir-side-effects:
+ @echo Building $@ in `pwd`
+ @(cd ${.CURDIR} && ${.MAKE} $@)
+ @echo Back in `pwd`
+
+ ensure-one-shell-regardless-of-mode:
+ @echo Building $@ in `pwd`; \
+ (cd ${.CURDIR} && ${.MAKE} $@); \
+ echo Back in `pwd`
+
VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS
Variables in make are much like variables in the shell, and, by tradi-
tion, consist of all upper-case letters.
@@ -1293,19 +1319,6 @@ CCOOMMPPAATTIIBBIILLIITTYY
stops them being treated as syntax, and removes some obscure problems
using them in .if statements.
- Unlike other bbmmaakkee programs, this implementation by default executes all
- commands for a given target using a single shell invocation. This is
- done for both efficiency and to simplify error handling in remote command
- invocations. Typically this is transparent to the user, unless the tar-
- get commands change the current working directory using ``cd'' or
- ``chdir''. To be compatible with Makefiles that do this, one can use --BB
- to disable this behavior.
-
- In compatibility mode, each command is run in a separate process. If the
- command contains any shell meta characters (`#=|^(){};&<>*?[]:$`\\n') it
- will be passed to the shell, otherwise bbmmaakkee will attempt direct execu-
- tion.
-
SSEEEE AALLSSOO
mkdep(1)
@@ -1327,4 +1340,4 @@ BBUUGGSS
There is no way of escaping a space character in a filename.
-NetBSD 5.1 October 8, 2012 NetBSD 5.1
+NetBSD 5.1 January 23, 2013 NetBSD 5.1
Modified: head/contrib/bmake/boot-strap
==============================================================================
--- head/contrib/bmake/boot-strap Fri Feb 1 20:17:11 2013 (r246222)
+++ head/contrib/bmake/boot-strap Fri Feb 1 22:55:27 2013 (r246223)
@@ -3,23 +3,52 @@
# boot-strap
#
# SYNOPSIS:
-# boot-strap [--"configure_arg" ... ][-s "srcdir"][-m "mksrc"]\\
-# ["prefix" ["bmakesrc" ["mksrc"]]]
+# boot-strap ["options"]
+# boot-strap --prefix=/opt --install
+# boot-strap --prefix=$HOME --install-host-target -DWITH_PROG_VERSION
+# boot-strap ["options"] op=build
+# boot-strap ["options"] op=install
#
# DESCRIPTION:
# This script is used to configure/build bmake it builds for
-# each OS in a subdir to keep the src clean.
-# On successful completion it echos commands to put the new
-# bmake binary into the /configs tree (if it exists)
-# (http://www.crufty.net/FreeWare/configs.html), $prefix/bin
-# and a suitable ~/*bin directory.
+# each host-target in a different subdir to keep the src clean.
+# There is no requirement for an existing make(1).
#
+# On successful completion if no '--install' flag is given,
+# it echos a command to do installation.
+#
+# The variable "op" defaults to 'all', and is affected by
+# '--install' flag as above.
+# Other values include:
+#
+# configure
+# Just run 'configure'
+#
+# build
+# If 'configure' has not been done, do it, then
+# run the build script, and finally 'test'.
+#
+# install
+# If 'build' has not been done, do it, 'test' then
+# install.
+#
+# clean
+# attempt to clean up
+#
+# test
+# run the unit-tests. Done automatically after 'build'
+# and before 'install'.
+#
+# The above are leveraged by a trivial makefile for the benefit
+# of those that have './configure; make; make install' baked
+# into them.
+#
# Options:
#
# -c "rc"
# Pick up settings from "rc".
# We look for '.bmake-boot-strap.rc' before processing
-# options.
+# options (unless SKIP_RC is set in environment).
#
# --share "share_dir"
# Where to put man pages and mk files.
@@ -28,9 +57,28 @@
#
# --mksrc "mksrc"
# Indicate where the mk files can be found.
-# Default is ./mk or ../mk, set to 'none' to force
-# building without "mksrc" but in that case a sys.mk
-# needs to exist in the default syspath ($share_dir/mk)
+# Default is $Mydir/mk
+#
+# --install
+# If build and test work, run bmake install.
+# BINDIR=$prefix/bin
+# SHAREDIR=$prefix/share
+#
+# --install-host-target
+# As for '--install' but BINDIR=$prefix/$HOST_TARGET/bin
+# This is useful when $prefix/ is shared by multiple
+# machines.
+#
+# Flags relevant when installing:
+#
+# -DWITHOUT_INSTALL_MK
+# Skip installing mk files.
+# By default they will be installed to $prefix/share/mk
+#
+# -DWITH_PROG_VERSION
+# Install 'bmake' as 'bmake-$MAKE_VERSION'
+# A symlink will be made as 'bmake' unless
+# -DWITHOUT_PROG_LINK is set.
#
# Possibly useful configure_args:
#
@@ -63,7 +111,7 @@
# Simon J. Gerraty <sjg at crufty.net>
# RCSid:
-# $Id: boot-strap,v 1.39 2012/03/26 17:08:22 sjg Exp $
+# $Id: boot-strap,v 1.42 2013/01/25 20:20:33 sjg Exp $
#
# @(#) Copyright (c) 2001 Simon J. Gerraty
#
@@ -85,11 +133,10 @@ case "$Mydir" in
*) Mydir=`cd "$Mydir" && 'pwd'`;;
esac
-
Usage() {
[ "$1" ] && echo "ERROR: $@" >&2
echo "Usage:" >&2
- echo "$0 [--<configure_arg> ...][-s <srcdir>][-m <mksrc>][<prefix> [[<srcdir>] [<mksrc>]]]" >&2
+ echo "$0 [--<configure_arg> ...][<prefix>][--install]" >&2
exit 1
}
@@ -110,28 +157,55 @@ source_rc() {
done
}
+cmd_args="$@"
+
+# --install[-host-target] will set this
+INSTALL_PREFIX=
+# other things we pass to install step
+INSTALL_ARGS=
CONFIGURE_ARGS=
MAKESYSPATH=
# pick a useful default prefix (for me at least ;-)
for prefix in /opt/$HOST_TARGET "$HOME/$HOST_TARGET" /usr/pkg /usr/local ""
do
- [ -d "${prefix:-.}" ] && break
+ [ -d "${prefix:-.}" ] || continue
+ case "$prefix" in
+ */$HOST_TARGET)
+ p=`dirname $prefix`
+ if [ -d $p/share ]; then
+ INSTALL_BIN=$HOST_TARGET/bin
+ prefix=$p
+ fi
+ ;;
+ esac
+ echo "NOTE: default prefix=$prefix ${INSTALL_BIN:+INSTALL_BIN=$INSTALL_BIN}"
+ break
done
-srcdir=
-mksrc=
+srcdir=$Mydir
+mksrc=$Mydir/mk
objdir=
quiet=:
-source_rc .bmake-boot-strap.rc . "$Mydir/.." "$HOME"
+${SKIP_RC:+:} source_rc .bmake-boot-strap.rc . "$Mydir/.." "$HOME"
get_optarg() {
expr "x$1" : "x[^=]*=\\(.*\\)"
}
+here=`'pwd'`
+if [ $here = $Mydir ]; then
+ # avoid polution
+ OBJROOT=../
+fi
+
+op=all
+BMAKE=
+
while :
do
case "$1" in
--) shift; break;;
+ --help) sed -n -e "1d;/RCSid/,\$d" -e '/^#\.[a-z]/d' -e '/^#/s,^# *,,p' $0; exit 0;;
--prefix) prefix="$2"; shift;;
--prefix=*) prefix=`get_optarg "$1"`;;
--src=*) srcdir=`get_optarg "$1"`;;
@@ -144,6 +218,13 @@ do
--with-default-sys-path)
CONFIGURE_ARGS="$1 $2"
MAKESYSPATH="$2"; shift;;
+ --install) INSTALL_PREFIX=${INSTALL_PREFIX:-$prefix};;
+ --install-host-target)
+ INSTALL_PREFIX=${INSTALL_PREFIX:-$prefix}
+ INSTALL_BIN=$HOST_TARGET/bin;;
+ --install-destdir=*) INSTALL_DESTDIR=`get_optarg "$1"`;;
+ --install-prefix=*) INSTALL_PREFIX=`get_optarg "$1"`;;
+ -DWITH*) INSTALL_ARGS="$INSTALL_ARGS $1";;
-s|--src) srcdir="$2"; shift;;
-m|--mksrc) mksrc="$2"; shift;;
-o|--objdir) objdir="$2"; shift;;
@@ -261,7 +342,7 @@ none|-) # we don't want it
esac
# Ok, get to work...
-objdir="${objdir:-$OS}"
+objdir="${objdir:-$OBJROOT$HOST_TARGET}"
[ -d "$objdir" ] || mkdir -p "$objdir"
[ -d "$objdir" ] || mkdir "$objdir"
cd "$objdir" || exit 1
@@ -301,88 +382,80 @@ if [ "$mksrc" ]; then
export CFLAGS_MF CFLAGS_MD
fi
-$srcdir/configure $CONFIGURE_ARGS || exit 1
-chmod 755 make-bootstrap.sh || exit 1
-./make-bootstrap.sh || exit 1
-if [ -z "$MAKESYSPATH" ]; then
- add_path "${share_dir:-...}/mk" MAKESYSPATH
- case "$HOST_TARGET" in
- netbsd*) add_path /usr/share/mk MAKESYSPATH;;
- esac
-fi
-if [ -s "${mksrc:-/dev/null}/install-mk" ]; then
- sh "${mksrc}/install-mk" "$objdir/mk"
- case "$MAKESYSPATH" in
- .../mk*) ;;
- *) MAKESYSPATH=".../mk:${MAKESYSPATH}";;
- esac
-fi
+# this makes it easy to run the bmake we just built
+# the :tA dance is needed because 'pwd' and even /bin/pwd
+# may not give the same result as realpath().
+Bmake() {
+ (
+ cd $Mydir &&
+ MAKESYSPATH=$mksrc SRCTOP=$Mydir OBJTOP=$objdir \
+ MAKEOBJDIR='${.CURDIR:S,${SRCTOP:tA},${OBJTOP:tA},}' \
+ ${BMAKE:-$objdir/bmake} -f $Mydir/Makefile "$@"
+ )
+}
+
# make sure test below uses the same diff that configure did
TOOL_DIFF=`type diff | sed 's,[()],,g;s,^[^/][^/]*,,;q'`
-export MAKESYSPATH TOOL_DIFF
-if [ "$mksrc" ]; then
- $objdir/bmake test || exit 1
-else
- # assume nothing
- $objdir/bmake -r -m / test || exit 1
-fi
-# If -q given, we don't want all the install instructions
-$quiet exit 0
+export TOOL_DIFF
-make_version=`./bmake -r -m / -f ./Makefile -V MAKE_VERSION | ( read one two; echo $one )`
-bmake_version=bmake-$make_version
+op_configure() {
+ $srcdir/configure $CONFIGURE_ARGS || exit 1
+}
-if [ -s /usr/share/tmac/andoc.tmac ]; then
- # this should be ok
- man_subdir=man1
- man_src=$srcdir/bmake.1
-else
- # guess not
- man_subdir=cat1
- man_src=$srcdir/bmake.cat1
-fi
+op_build() {
+ [ -s make-bootstrap.sh ] || op_configure
+ chmod 755 make-bootstrap.sh || exit 1
+ ./make-bootstrap.sh || exit 1
+ case "$op" in
+ build) op_test;;
+ esac
+}
-install_prefix() {
- (
- bin_dir=
- share_dir=
- man_dir=
- mk_dir=
- while :
- do
- case "$1" in
- *=*) eval "$1"; shift;;
- *) break;;
- esac
- done
- bin_dir=${bin_dir:-$1/bin}
- share_dir=${share_dir:-`ShareDir "$1"`}
- man_dir=${man_dir:-$share_dir/man}
- mk_dir=${mk_dir:-$share_dir/mk}
- echo
- echo Commands to install into $1/
- echo
- echo mkdir -p $bin_dir
- echo cp $objdir/bmake $bin_dir/$bmake_version
- echo rm -f $bin_dir/bmake
- echo ln -s $bmake_version $bin_dir/bmake
- echo mkdir -p $man_dir/$man_subdir
- echo cp $man_src $man_dir/$man_subdir/bmake.1
- if [ "$mksrc" ]; then
- ev=`env | grep '_MK='`
- echo $ev sh $mksrc/install-mk $mk_dir
+op_test() {
+ [ -x bmake ] || op_build
+ Bmake test || exit 1
+}
+
+op_clean() {
+ if [ -x bmake ]; then
+ ln bmake bmake$$
+ BMAKE=$objdir/bmake$$ Bmake clean
+ rm -f bmake$$
+ elif [ $objdir != $srcdir ]; then
+ rm -rf *
fi
- )
}
-case "$prefix/" in
-"$HOME"/*) ;;
-*) CONFIGS=${CONFIGS:-/configs}
- [ -d $CONFIGS ] &&
- install_prefix mksrc= "$CONFIGS/$OS/$OSMAJOR.X/$MACHINE_ARCH$prefix"
- # I like to keep a copy here...
- install_prefix share_dir="$HOME/share" "$HOME/$HOST_TARGET"
- ;;
-esac
+op_install() {
+ op_test
+ case "$INSTALL_PREFIX,$INSTALL_BIN,$prefix" in
+ ,$HOST_TARGET/bin,*/$HOST_TARGET)
+ INSTALL_PREFIX=`dirname $prefix`
+ ;;
+ esac
+ INSTALL_PREFIX=${INSTALL_PREFIX:-$prefix}
+ Bmake install prefix=$INSTALL_PREFIX BINDIR=$INSTALL_PREFIX/${INSTALL_BIN:-bin} ${INSTALL_DESTDIR:+DESTDIR=$INSTALL_DESTDIR} $INSTALL_ARGS || exit 1
+}
+
+op_all() {
+ rm -f make-bootstrap.sh bmake *.o
+ if [ -n "$INSTALL_PREFIX" ]; then
+ op_install
+ else
+ op_test
+ MAKE_VERSION=`sed -n '/^MAKE_VERSION/ { s,.*= *,,;p; }' $srcdir/Makefile`
+ echo You can install by running:
+ echo
+ echo $0 $cmd_args op=install
+ echo
+ echo "Use --install-prefix=/something to install somewhere other than $prefix"
+ echo "Use --install-destdir=/somewhere to set DESTDIR during install"
+ echo "Use --install-host-target to use INSTALL_BIN=$HOST_TARGET/bin"
+ echo "Use -DWITH_PROG_VERSION to install as bmake-$MAKE_VERSION"
+ echo "Use -DWITHOUT_PROG_LINK to supress bmake -> bmake-$MAKE_VERSION symlink"
+ echo "Use -DWITHOUT_INSTALL_MK to skip installing files to $prefix/share/mk"
+ fi
+}
-install_prefix "$prefix"
+op_$op
+exit 0
Modified: head/contrib/bmake/bsd.after-import.mk
==============================================================================
--- head/contrib/bmake/bsd.after-import.mk Fri Feb 1 20:17:11 2013 (r246222)
+++ head/contrib/bmake/bsd.after-import.mk Fri Feb 1 22:55:27 2013 (r246223)
@@ -1,4 +1,4 @@
-# $Id: bsd.after-import.mk,v 1.9 2012/09/20 00:30:15 sjg Exp $
+# $Id: bsd.after-import.mk,v 1.11 2012/12/29 19:32:25 sjg Exp $
# This makefile is for use when integrating bmake into a BSD build
# system. Use this makefile after importing bmake.
@@ -48,36 +48,36 @@ DEFAULT_SYS_PATH= .../share/mk:/usr/shar
BOOTSTRAP_ARGS = \
--with-default-sys-path='${DEFAULT_SYS_PATH}' \
--prefix /usr \
- --share /usr/share \
- --mksrc none
+ --share /usr/share
+
# run boot-strap with minimal influence
bootstrap: ${BMAKE_SRC}/boot-strap ${MAKEFILE}
- HOME=/ ${BMAKE_SRC}/boot-strap ${BOOTSTRAP_ARGS} ${BOOTSTRAP_XTRAS}
+ HOME=/ ${BMAKE_SRC}/boot-strap -o ${HOST_OS} ${BOOTSTRAP_ARGS} ${BOOTSTRAP_XTRAS}
touch ${.TARGET}
# Makefiles need a little more tweaking than say config.h
MAKEFILE_SED = sed -e '/^MACHINE/d' \
-e '/^PROG/ { s,=,?=,;s,bmake,$${.CURDIR:T},; }' \
-e 's,^.-include,.sinclude,' \
+ -e '/^\..*include *</ { s,<,<bsd.,;/autoconf/d; }' \
-e 's,${SRCTOP},$${SRCTOP},g'
# These are the simple files we want to capture
-configured_files= config.h unit-tests/Makefile
+configured_files= config.h Makefile.config unit-tests/Makefile
after-import: bootstrap ${MAKEFILE}
-.for f in ${configured_files:N*Makefile}
+.for f in ${configured_files:M*.[ch]}
@echo Capturing $f
@mkdir -p ${${.CURDIR}/$f:L:H}
- @cmp -s ${.CURDIR}/$f ${HOST_OS}/$f || \
- cp ${HOST_OS}/$f ${.CURDIR}/$f
+ @(echo '/* $$${HOST_OS}$$ */'; cat ${HOST_OS}/$f) > ${.CURDIR}/$f
.endfor
-.for f in ${configured_files:M*Makefile}
+.for f in ${configured_files:M*Makefile*}
@echo Capturing $f
@mkdir -p ${${.CURDIR}/$f:L:H}
@(echo '# This is a generated file, do NOT edit!'; \
echo '# See ${_this:S,${SRCTOP}/,,}'; \
- echo '#'; echo '# $$${OS}$$'; echo; \
+ echo '#'; echo '# $$${HOST_OS}$$'; echo; \
echo 'SRCTOP?= $${.CURDIR:${${.CURDIR}/$f:L:H:S,${SRCTOP}/,,:C,[^/]+,H,g:S,/,:,g}}'; echo; \
${MAKEFILE_SED} ${HOST_OS}/$f ) > ${.CURDIR}/$f
.endfor
@@ -87,18 +87,22 @@ _makefile: bootstrap ${MAKEFILE}
@echo Generating ${.CURDIR}/Makefile
@(echo '# This is a generated file, do NOT edit!'; \
echo '# See ${_this:S,${SRCTOP}/,,}'; \
- echo '#'; echo '# $$${OS}$$'; \
+ echo '#'; echo '# $$${HOST_OS}$$'; \
echo; echo '.sinclude "Makefile.inc"'; \
echo; echo 'SRCTOP?= $${.CURDIR:${.CURDIR:S,${SRCTOP}/,,:C,[^/]+,H,g:S,/,:,g}}'; \
echo; echo '# look here first for config.h'; \
echo 'CFLAGS+= -I$${.CURDIR}'; echo; \
- ${MAKEFILE_SED} ${HOST_OS}/Makefile; \
+ echo '# for after-import'; \
+ echo 'CLEANDIRS+= ${HOST_OS}'; \
+ echo 'CLEANFILES+= bootstrap'; echo; \
+ ${MAKEFILE_SED} \
+ ${1 2:L:@n at -e '/start-delete$n/,/end-delete$n/d'@} \
+ ${BMAKE_SRC}/Makefile; \
echo; echo '# override some simple things'; \
echo 'BINDIR= /usr/bin'; \
echo 'MANDIR= ${MANDIR:U/usr/share/man}'; \
echo; echo '# make sure we get this'; \
echo 'CFLAGS+= $${COPTS.$${.IMPSRC:T}}'; \
- echo 'CLEANFILES+= bootstrap'; \
echo; echo 'after-import: ${_this:S,${SRCTOP},\${SRCTOP},}'; \
echo ' cd $${.CURDIR} && $${.MAKE} -f ${_this:S,${SRCTOP},\${SRCTOP},}'; \
echo ) > ${.TARGET}
Modified: head/contrib/bmake/compat.c
==============================================================================
--- head/contrib/bmake/compat.c Fri Feb 1 20:17:11 2013 (r246222)
+++ head/contrib/bmake/compat.c Fri Feb 1 22:55:27 2013 (r246223)
@@ -1,4 +1,4 @@
-/* $NetBSD: compat.c,v 1.90 2012/10/07 19:17:31 sjg Exp $ */
+/* $NetBSD: compat.c,v 1.91 2013/01/25 02:01:10 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: compat.c,v 1.90 2012/10/07 19:17:31 sjg Exp $";
+static char rcsid[] = "$NetBSD: compat.c,v 1.91 2013/01/25 02:01:10 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: compat.c,v 1.90 2012/10/07 19:17:31 sjg Exp $");
+__RCSID("$NetBSD: compat.c,v 1.91 2013/01/25 02:01:10 sjg Exp $");
#endif
#endif /* not lint */
#endif
@@ -377,7 +377,6 @@ again:
Fatal("Could not fork");
}
if (cpid == 0) {
- Check_Cwd(av);
Var_ExportVars();
#ifdef USE_META
if (useMeta) {
Modified: head/contrib/bmake/configure
==============================================================================
Binary file (source and/or target). No diff available.
Modified: head/contrib/bmake/configure.in
==============================================================================
--- head/contrib/bmake/configure.in Fri Feb 1 20:17:11 2013 (r246222)
+++ head/contrib/bmake/configure.in Fri Feb 1 22:55:27 2013 (r246223)
@@ -1,12 +1,18 @@
dnl
dnl RCSid:
-dnl $Id: configure.in,v 1.45 2012/06/20 22:43:41 sjg Exp $
+dnl $Id: configure.in,v 1.46 2012/12/28 21:28:18 sjg Exp $
dnl
dnl Process this file with autoconf to produce a configure script
dnl
-AC_INIT([bmake], [20120620], [sjg at NetBSD.org])
+AC_INIT([bmake], [20121212], [sjg at NetBSD.org])
AC_CONFIG_HEADER(config.h)
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-all
mailing list