Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 6 Oct 2012 19:19:21 +0000 (UTC)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r241279 - in head: share/mk tools/build/options usr.bin usr.bin/bmake usr.bin/bmake/unit-tests
Message-ID:  <201210061919.q96JJLW0023879@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marcel
Date: Sat Oct  6 19:19:21 2012
New Revision: 241279
URL: http://svn.freebsd.org/changeset/base/241279

Log:
  Add bmake to the build and allow it to be installed as make(1) instead
  of FreeBSD's make by setting WITH_BMAKE.  The WITH_BMAKE build makes it
  easy for people to switch while working out the kinks -- think ports
  tree here.  The option will be removed in due time.
  
  Submitted by:	Simon Gerraty (sjg@juniper.net)

Added:
  head/tools/build/options/WITH_BMAKE   (contents, props changed)
  head/usr.bin/bmake/
  head/usr.bin/bmake/Makefile   (contents, props changed)
  head/usr.bin/bmake/Makefile.inc   (contents, props changed)
  head/usr.bin/bmake/config.h   (contents, props changed)
  head/usr.bin/bmake/unit-tests/
  head/usr.bin/bmake/unit-tests/Makefile   (contents, props changed)
Modified:
  head/share/mk/bsd.own.mk
  head/usr.bin/Makefile

Modified: head/share/mk/bsd.own.mk
==============================================================================
--- head/share/mk/bsd.own.mk	Sat Oct  6 19:06:23 2012	(r241278)
+++ head/share/mk/bsd.own.mk	Sat Oct  6 19:19:21 2012	(r241279)
@@ -417,6 +417,7 @@ __DEFAULT_YES_OPTIONS = \
     ZONEINFO
 
 __DEFAULT_NO_OPTIONS = \
+    BMAKE \
     BSD_GREP \
     BIND_IDN \
     BIND_LARGE_FILE \

Added: head/tools/build/options/WITH_BMAKE
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/build/options/WITH_BMAKE	Sat Oct  6 19:19:21 2012	(r241279)
@@ -0,0 +1,8 @@
+.\" $FreeBSD$
+Build and install the portable BSD make (bmake) as
+.Xr make 1
+instead of the traditional FreeBSD make.
+This build option is temporary.
+It allows developers to switch to bmake in order to work out any remaining
+kinks or issues.
+This option will be removed in due time.

Modified: head/usr.bin/Makefile
==============================================================================
--- head/usr.bin/Makefile	Sat Oct  6 19:06:23 2012	(r241278)
+++ head/usr.bin/Makefile	Sat Oct  6 19:19:21 2012	(r241279)
@@ -271,8 +271,12 @@ SUBDIR+=	msgs
 .endif
 
 .if ${MK_MAKE} != "no"
+.if ${MK_BMAKE} != "no"
+SUBDIR+=	bmake
+.else
 SUBDIR+=	make
 .endif
+.endif
 
 .if ${MK_MAN_UTILS} != "no"
 SUBDIR+=	catman

Added: head/usr.bin/bmake/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/bmake/Makefile	Sat Oct  6 19:19:21 2012	(r241279)
@@ -0,0 +1,209 @@
+# This is a generated file, do NOT edit!
+# See contrib/bmake/bsd.after-import.mk
+#
+# $FreeBSD$
+
+.sinclude "Makefile.inc"
+
+SRCTOP?= ${.CURDIR:H:H}
+
+# look here first for config.h
+CFLAGS+= -I${.CURDIR}
+
+#	$NetBSD: Makefile,v 1.56 2012/05/30 21:54:23 sjg Exp $
+#	@(#)Makefile	5.2 (Berkeley) 12/28/90
+
+#	$Id: Makefile.in,v 1.170 2012/08/31 06:46:22 sjg Exp $
+
+PROG?=	${.CURDIR:T}
+SRCS=	arch.c buf.c compat.c cond.c dir.c for.c hash.c job.c main.c \
+	make.c parse.c str.c suff.c targ.c trace.c var.c util.c 
+SRCS+=  strlist.c
+SRCS+=  make_malloc.c
+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 lstRemove.c lstReplace.c lstSucc.c
+SRCS += lstPrev.c
+
+# you can use this Makefile if you have an earlier version of bmake.
+prefix= /usr
+srcdir= ${SRCTOP}/contrib/bmake
+CC?= gcc
+
+# Base version on src date
+MAKE_VERSION= 20120831
+DEFAULT_SYS_PATH = .../share/mk:/usr/share/mk
+
+CPPFLAGS+= 
+CFLAGS+= ${CPPFLAGS}
+CFLAGS+= -D_PATH_DEFSYSPATH=\"${DEFAULT_SYS_PATH}\"
+CFLAGS+= -I. -I${srcdir} -DHAVE_CONFIG_H ${XDEFS} -DMAKE_NATIVE
+CFLAGS+= ${CFLAGS_${.TARGET:T}} 
+CFLAGS+= ${COPTS.${.ALLSRC:M*.c:T:u}}
+COPTS.main.c+= "-DMAKE_VERSION=\"${MAKE_VERSION}\""
+LDFLAGS= 
+LIBOBJS=  ${LIBOBJDIR}stresep$U.o
+LDADD= 
+
+.if !empty(LIBOBJS)
+SRCS+= ${LIBOBJS:T:.o=.c}
+.endif
+
+USE_META = yes
+.if ${USE_META} != "no"
+SRCS+=	meta.c
+CPPFLAGS+= -DUSE_META
+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
+.endif
+
+.PATH:	${srcdir}
+.PATH:	${srcdir}/lst.lib
+
+OS!= uname -s
+ARCH!= uname -p 2>/dev/null || uname -m
+
+# list of OS's which are derrived from BSD4.4
+isBSD44= NetBSD FreeBSD OpenBSD DragonFly
+
+.if ${OS} == "NetBSD"
+# Don't set these for anyone else since we don't know what the effect may be.
+# On FreeBSD WARNS=2 sets a bunch of -W flags that make does not handle.
+WFORMAT= 1
+WARNS=4
+.NOPATH: bmake.cat1
+.if make(install) && exists(${DESTDIR}/usr/share/doc)
+SUBDIR=	PSD.doc
+.endif
+.endif
+
+.if empty(isBSD44:M${OS})
+# XXX not sure if we still want this given that configure
+# lets us force or not the definition of MACHINE.
+CFLAGS_main.o+= "-DFORCE_MACHINE=\"${MACHINE}\""
+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
+.endif
+.if defined(.PARSEDIR)
+.if make(obj) || make(clean)
+SUBDIR+= unit-tests
+.endif
+.endif
+
+# many systems use gcc these days
+CC_IS_GCC=yes
+.if ${CC_IS_GCC} == "yes"
+# problem with gcc3
+CFLAGS_var.o+= -Wno-cast-qual
+.endif
+
+CFLAGS_main.o+= "-DMACHINE=\"${MACHINE}\"" "-DMACHINE_ARCH=\"${MACHINE_ARCH}\""
+
+EXTRACT_MAN=no
+
+MAN=${PROG}.1
+.if (${PROG} != "make")
+${MAN}:	make.1
+	@echo making ${PROG}.1
+	@sed -e 's/^.Nx/NetBSD/' -e '/^.Nm/s/make/${PROG}/' -e '/^.Sh HISTORY/,$$d' ${srcdir}/make.1 > $@
+	@(echo ".Sh HISTORY"; \
+	echo ".Nm"; \
+	echo "is derived from NetBSD"; \
+	echo ".Xr make 1 ."; \
+	echo It uses autoconf to facilitate portability to other platforms.) >> $@
+
+.endif
+
+.if !empty(isBSD44:M${OS})
+.if "${OS}" != "NetBSD" 
+MAN1=${MAN}
+.endif
+MANTARGET?=man
+.endif
+
+MANTARGET?= cat
+MANDEST?= ${MANDIR}/${MANTARGET}1
+
+.if ${MANTARGET} == "cat"
+_mfromdir=${srcdir}
+.endif
+
+.if exists(${srcdir}/../Makefile.inc)
+.include "${srcdir}/../Makefile.inc"
+.endif
+.sinclude <bsd.prog.mk>
+# sigh, FreeBSD at least includes bsd.subdir.mk via bsd.obj.mk
+# so the inclusion below, results in complaints about re-defined
+# targets.  For NetBSD though we need to explicitly include it.
+.if defined(.PARSEDIR)
+.if defined(SUBDIR) && !target(${SUBDIR:[1]})
+.sinclude <bsd.subdir.mk>
+.endif
+.endif
+
+CPPFLAGS+= -DMAKE_NATIVE
+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
+BINDIR= ${prefix}/bin
+MANDIR= ${prefix}/man
+
+arch.o:	config.h
+# make sure that MAKE_VERSION gets updated.
+main.o: ${SRCS} ${MAKEFILE}
+
+MK?=${prefix}/share/mk
+MKSRC?=mk
+INSTALL?=${srcdir}/install-sh
+
+beforeinstall:
+	test -d ${DESTDIR}${BINDIR} || ${INSTALL} -m 775 -d ${DESTDIR}${BINDIR}
+	test -d ${DESTDIR}${MANDEST} || ${INSTALL} -m 775 -d ${DESTDIR}${MANDEST}
+
+# latest version of *.mk includes an installer.
+# you should not need to  set USE_OS
+install-mk:
+.if exists(${MKSRC}/install-mk)
+	test -d ${DESTDIR}${MK} || ${INSTALL} -m 775 -d ${DESTDIR}${MK}
+	${MKSRC}/install-mk -v -m 644 ${DESTDIR}${MK} ${USE_OS}
+.else
+	@echo need to unpack mk.tar.gz under ${srcdir} or set MKSRC; false
+.endif
+
+.ifdef TOOLDIR
+# this is a native netbsd build, 
+# use libutil rather than the local emalloc etc.
+CPPFLAGS+= -DUSE_EMALLOC
+LDADD+=-lutil
+DPADD+=${LIBUTIL}
+.endif
+
+# 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}
+
+# override some simple things
+BINDIR= /usr/bin
+MANDIR= /usr/share/man/man
+
+# make sure we get this
+CFLAGS+= ${COPTS.${.IMPSRC:T}}
+CLEANFILES+= bootstrap
+
+after-import: ${SRCTOP}/contrib/bmake/bsd.after-import.mk
+	cd ${.CURDIR} && ${.MAKE} -f ${SRCTOP}/contrib/bmake/bsd.after-import.mk
+

Added: head/usr.bin/bmake/Makefile.inc
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/bmake/Makefile.inc	Sat Oct  6 19:19:21 2012	(r241279)
@@ -0,0 +1,14 @@
+# $FreeBSD$ 
+
+.include "bsd.own.mk"
+
+.if defined(.PARSEDIR)
+# make sure this is available to unit-tests/Makefile
+.export SRCTOP
+.endif
+
+.if defined(MK_BMAKE)
+PROG= make
+.endif
+
+WARNS=3

Added: head/usr.bin/bmake/config.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/bmake/config.h	Sat Oct  6 19:19:21 2012	(r241279)
@@ -0,0 +1,316 @@
+/* config.h.  Generated from config.h.in by configure.  */
+/* config.h.in.  Generated from configure.in by autoheader.  */
+/* $FreeBSD$ */
+
+/* Define if building universal (internal helper macro) */
+/* #undef AC_APPLE_UNIVERSAL_BUILD */
+
+/* Path of default shell */
+/* #undef DEFSHELL_CUSTOM */
+
+/* Shell spec to use by default */
+/* #undef DEFSHELL_INDEX */
+
+/* Define to 1 if you have the <ar.h> header file. */
+#define HAVE_AR_H 1
+
+/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you
+   don't. */
+#define HAVE_DECL_SYS_SIGLIST 1
+
+/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
+   */
+#define HAVE_DIRENT_H 1
+
+/* Define to 1 if you have the `dirname' function. */
+#define HAVE_DIRNAME 1
+
+/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
+/* #undef HAVE_DOPRNT */
+
+/* Define to 1 if you have the `err' function. */
+#define HAVE_ERR 1
+
+/* Define to 1 if you have the `errx' function. */
+#define HAVE_ERRX 1
+
+/* Define to 1 if you have the <err.h> header file. */
+#define HAVE_ERR_H 1
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define to 1 if you have the `fork' function. */
+#define HAVE_FORK 1
+
+/* Define to 1 if you have the `getcwd' function. */
+#define HAVE_GETCWD 1
+
+/* Define to 1 if you have the `getenv' function. */
+#define HAVE_GETENV 1
+
+/* Define to 1 if you have the `getopt' function. */
+#define HAVE_GETOPT 1
+
+/* Define to 1 if you have the `getwd' function. */
+#define HAVE_GETWD 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `killpg' function. */
+#define HAVE_KILLPG 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `mmap' function. */
+#define HAVE_MMAP 1
+
+/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
+/* #undef HAVE_NDIR_H */
+
+/* Define to 1 if you have the <paths.h> header file. */
+#define HAVE_PATHS_H 1
+
+/* Define to 1 if you have the <poll.h> header file. */
+#define HAVE_POLL_H 1
+
+/* Define to 1 if you have the `putenv' function. */
+#define HAVE_PUTENV 1
+
+/* Define to 1 if you have the <ranlib.h> header file. */
+#define HAVE_RANLIB_H 1
+
+/* Define to 1 if you have the `realpath' function. */
+#define HAVE_REALPATH 1
+
+/* Define to 1 if you have the `select' function. */
+#define HAVE_SELECT 1
+
+/* Define to 1 if you have the `setenv' function. */
+#define HAVE_SETENV 1
+
+/* Define to 1 if you have the `setpgid' function. */
+#define HAVE_SETPGID 1
+
+/* Define to 1 if you have the `setsid' function. */
+#define HAVE_SETSID 1
+
+/* Define to 1 if you have the `sigaction' function. */
+#define HAVE_SIGACTION 1
+
+/* Define to 1 if you have the `sigvec' function. */
+#define HAVE_SIGVEC 1
+
+/* Define to 1 if you have the `snprintf' function. */
+#define HAVE_SNPRINTF 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `strerror' function. */
+#define HAVE_STRERROR 1
+
+/* Define to 1 if you have the `stresep' function. */
+/* #undef HAVE_STRESEP */
+
+/* Define to 1 if you have the `strftime' function. */
+#define HAVE_STRFTIME 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strlcpy' function. */
+#define HAVE_STRLCPY 1
+
+/* Define to 1 if you have the `strsep' function. */
+#define HAVE_STRSEP 1
+
+/* Define to 1 if you have the `strtod' function. */
+#define HAVE_STRTOD 1
+
+/* Define to 1 if you have the `strtol' function. */
+#define HAVE_STRTOL 1
+
+/* Define to 1 if `struct stat' is a member of `st_rdev'. */
+#define HAVE_STRUCT_STAT_ST_RDEV 1
+
+/* Define to 1 if your `struct stat' has `st_rdev'. Deprecated, use
+   `HAVE_STRUCT_STAT_ST_RDEV' instead. */
+#define HAVE_ST_RDEV 1
+
+/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
+   */
+/* #undef HAVE_SYS_DIR_H */
+
+/* Define to 1 if you have the <sys/mman.h> header file. */
+#define HAVE_SYS_MMAN_H 1
+
+/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
+   */
+/* #undef HAVE_SYS_NDIR_H */
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#define HAVE_SYS_SELECT_H 1
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#define HAVE_SYS_SOCKET_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/uio.h> header file. */
+#define HAVE_SYS_UIO_H 1
+
+/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
+#define HAVE_SYS_WAIT_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `unsetenv' function. */
+#define HAVE_UNSETENV 1
+
+/* Define to 1 if you have the <utime.h> header file. */
+#define HAVE_UTIME_H 1
+
+/* Define to 1 if you have the `vfork' function. */
+#define HAVE_VFORK 1
+
+/* Define to 1 if you have the <vfork.h> header file. */
+/* #undef HAVE_VFORK_H */
+
+/* Define to 1 if you have the `vprintf' function. */
+#define HAVE_VPRINTF 1
+
+/* Define to 1 if you have the `vsnprintf' function. */
+#define HAVE_VSNPRINTF 1
+
+/* Define to 1 if you have the `wait3' function. */
+#define HAVE_WAIT3 1
+
+/* Define to 1 if you have the `wait4' function. */
+#define HAVE_WAIT4 1
+
+/* Define to 1 if you have the `waitpid' function. */
+#define HAVE_WAITPID 1
+
+/* Define to 1 if you have the `warn' function. */
+#define HAVE_WARN 1
+
+/* Define to 1 if you have the `warnx' function. */
+#define HAVE_WARNX 1
+
+/* Define to 1 if `fork' works. */
+#define HAVE_WORKING_FORK 1
+
+/* Define to 1 if `vfork' works. */
+#define HAVE_WORKING_VFORK 1
+
+/* define if your compiler has __attribute__ */
+/* #undef HAVE___ATTRIBUTE__ */
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "sjg@NetBSD.org"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "bmake"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "bmake 20120620"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "bmake"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "20120620"
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#define RETSIGTYPE void
+
+/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
+/* #undef STAT_MACROS_BROKEN */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#define TIME_WITH_SYS_TIME 1
+
+/* Define to 1 if your <sys/time.h> declares `struct tm'. */
+/* #undef TM_IN_SYS_TIME */
+
+/* Enable extensions on AIX 3, Interix.  */
+#ifndef _ALL_SOURCE
+# define _ALL_SOURCE 1
+#endif
+/* Enable GNU extensions on systems that have them.  */
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+#endif
+/* Enable threading extensions on Solaris.  */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# define _POSIX_PTHREAD_SEMANTICS 1
+#endif
+/* Enable extensions on HP NonStop.  */
+#ifndef _TANDEM_SOURCE
+# define _TANDEM_SOURCE 1
+#endif
+/* Enable general extensions on Solaris.  */
+#ifndef __EXTENSIONS__
+# define __EXTENSIONS__ 1
+#endif
+
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+   significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+#  define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+/* #  undef WORDS_BIGENDIAN */
+# endif
+#endif
+
+/* Define to 1 if on MINIX. */
+/* #undef _MINIX */
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+   this defined. */
+/* #undef _POSIX_1_SOURCE */
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+/* #undef _POSIX_SOURCE */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `long int' if <sys/types.h> does not define. */
+/* #undef off_t */
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef pid_t */
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
+
+/* Define as `fork' if `vfork' does not work. */
+/* #undef vfork */

Added: head/usr.bin/bmake/unit-tests/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/bmake/unit-tests/Makefile	Sat Oct  6 19:19:21 2012	(r241279)
@@ -0,0 +1,103 @@
+# This is a generated file, do NOT edit!
+# See contrib/bmake/bsd.after-import.mk
+#
+# $FreeBSD$
+
+SRCTOP?= ${.CURDIR:H:H:H}
+
+# $Id: Makefile.in,v 1.38 2012/06/19 23:38:48 sjg Exp $
+#
+# $NetBSD: Makefile,v 1.34 2012/06/19 23:25:53 sjg Exp $
+#
+# Unit tests for make(1)
+# The main targets are:
+# 
+# all:	run all the tests
+# test:	run 'all', capture output and compare to expected results
+# accept: move generated output to expected results
+#
+# Adding a test case.  
+# Each feature should get its own set of tests in its own suitably
+# named makefile which should be added to SUBFILES to hook it in.
+# 
+
+srcdir= ${SRCTOP}/contrib/bmake/unit-tests
+
+.MAIN: all
+
+UNIT_TESTS:= ${srcdir}
+
+# Simple sub-makefiles - we run them as a black box
+# keep the list sorted.
+SUBFILES= \
+	comment \
+	cond1 \
+	error \
+	export \
+	export-all \
+	doterror \
+	dotwait \
+	forloop \
+	forsubst \
+	hash \
+	misc \
+	moderrs \
+	modmatch \
+	modmisc \
+	modorder \
+	modts \
+	modword \
+	phony-end \
+	posix \
+	qequals \
+	sysv \
+	ternary \
+	unexport \
+	unexport-env \
+	varcmd
+
+all: ${SUBFILES}
+
+flags.doterror=
+
+# the tests are actually done with sub-makes.
+.PHONY: ${SUBFILES}
+.PRECIOUS: ${SUBFILES}
+${SUBFILES}:
+	-@${.MAKE} ${flags.$@:U-k} -f ${UNIT_TESTS}/$@
+
+clean:
+	rm -f *.out *.fail *.core
+
+.sinclude <bsd.obj.mk>
+
+TEST_MAKE?= ${.MAKE}
+TOOL_SED?= sed
+TOOL_TR?= tr
+TOOL_DIFF?= diff
+DIFF_FLAGS?= -u
+
+# ensure consistent results from sort(1)
+LC_ALL= C
+LANG= C
+.export LANG LC_ALL
+
+# The driver.
+# We always pretend .MAKE was called 'make' 
+# and strip ${.CURDIR}/ from the output
+# and replace anything after 'stopped in' with unit-tests
+# so the results can be compared.
+test:
+	@echo "${TEST_MAKE} -f ${MAKEFILE} > ${.TARGET}.out 2>&1"
+	@cd ${.OBJDIR} && ${TEST_MAKE} -f ${MAKEFILE} 2>&1 | \
+	${TOOL_TR} -d '\015' | \
+	${TOOL_SED} -e 's,^${TEST_MAKE:T:C/\./\\\./g}:,make:,' \
+	-e '/stopped/s, /.*, unit-tests,' \
+	-e 's,${.CURDIR:C/\./\\\./g}/,,g' \
+	-e 's,${UNIT_TESTS:C/\./\\\./g}/,,g' > ${.TARGET}.out || { \
+	tail ${.TARGET}.out; mv ${.TARGET}.out ${.TARGET}.fail; exit 1; }
+	${TOOL_DIFF} ${DIFF_FLAGS} ${UNIT_TESTS}/${.TARGET}.exp ${.TARGET}.out
+
+accept:
+	mv test.out ${srcdir}/test.exp
+



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210061919.q96JJLW0023879>