mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 17:18:32 +00:00
![Simon J. Gerraty](/assets/img/avatar_default.png)
Changes since 20181221 are mostly portability related hence the large gap in versions imported. There are however some bug fixes, and a rework of filemon handling. In NetBSD make/filemon/filemon_ktrace.c allows use of fktrace and elimination of filemon(4) which has not had the TLC it needs. FreeBSD filemon(4) is in much better shape, so bmake/filemon/filemon_dev.c allows use of that, with a bit less overhead than the ktrace model. Summary of changes from ChangeLog o str.c: empty string does not match % pattern plus unit-test changes o var.c: import handling of old sysV style modifier using '%' o str.c: refactor brk_string o meta.c: meta_oodate, CHECK_VALID_META is too aggressive for CMD a blank command is perfectly valid. o meta.c: meta_oodate, check for corrupted meta file earlier and more often. * meta.c: meta_compat_parent check for USE_FILEMON patch from Soeren Tempel o meta.c: fix compat mode, need to call meta_job_output() o job.c: extra fds for meta mode not needed if using filemon_dev o meta.c: avoid passing NULL to filemon_*() when meta_needed() returns FALSE. o filemon/filemon_{dev,ktrace}.c: allow selection of filemon implementation. filemon_dev.c uses the kernel module while filemon_ktrace.c leverages the fktrace api available in NetBSD. filemon_ktrace.c can hopefully form the basis for adding support for other tracing mechanisms such as strace on Linux. o meta.c: when target is out-of-date per normal make rules record value of .OODATE in meta file. o parse.c: don't pass NULL to realpath(3) some versions cannot handle it. o parse.c: ParseDoDependency: free paths rather than assert plus more unit-tests
242 lines
4.9 KiB
Makefile
242 lines
4.9 KiB
Makefile
# $Id: Makefile,v 1.104 2020/02/06 01:33:54 sjg Exp $
|
|
|
|
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 \
|
|
metachar.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
|
|
|
|
.-include "VERSION"
|
|
.-include "Makefile.inc"
|
|
|
|
# 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?= ${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
|
|
# should be set by now
|
|
USE_FILEMON ?= no
|
|
.if ${USE_FILEMON:tl} != "no"
|
|
.PATH: ${.CURDIR}/filemon
|
|
SRCS+= filemon_${USE_FILEMON}.c
|
|
COPTS.meta.c+= -DUSE_FILEMON -DUSE_FILEMON_${USE_FILEMON:tu}
|
|
COPTS.job.c+= ${COPTS.meta.c}
|
|
|
|
.if ${USE_FILEMON} == "dev"
|
|
FILEMON_H ?= /usr/include/dev/filemon/filemon.h
|
|
.if exists(${FILEMON_H}) && ${FILEMON_H:T} == "filemon.h"
|
|
COPTS.filemon_dev.c += -DHAVE_FILEMON_H -I${FILEMON_H:H}
|
|
.endif
|
|
.endif # USE_FILEMON == dev
|
|
|
|
.endif # USE_FILEMON
|
|
|
|
.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 MirBSD Bitrig
|
|
# 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=
|
|
|
|
# suppress 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_NAME} ${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 '/^.Dt/s/MAKE/${PROG:tu}/' \
|
|
-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= ${SHAREDIR.bmake:U${prefix}/share}
|
|
BINDIR= ${BINDIR.bmake:U${prefix}/bin}
|
|
MANDIR= ${MANDIR.bmake:U${SHAREDIR}/man}
|
|
|
|
.if !exists(.depend)
|
|
${OBJS}: config.h
|
|
.endif
|
|
|
|
# start-delete2 for bsd.after-import.mk
|
|
|
|
# make sure that MAKE_VERSION gets updated.
|
|
main.o: ${SRCS} ${.CURDIR}/VERSION
|
|
|
|
.if ${MK_AUTOCONF_MK} == "yes"
|
|
CONFIGURE_DEPS += ${.CURDIR}/VERSION
|
|
# we do not need or want the generated makefile
|
|
CONFIGURE_ARGS += --without-makefile
|
|
.include <autoconf.mk>
|
|
.endif
|
|
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}
|