2c3632d14f
Lots of code refactoring, simplification and cleanup. Lots of new unit-tests providing much higher code coverage. All courtesy of rillig at netbsd. Other significant changes: o new read-only variable .SHELL which provides the path of the shell used to run scripts (as defined by the .SHELL target). o variable parsing detects more errors. o new debug option -dl: LINT mode, does the equivalent of := for all variable assignments so that file and line number are reported for variable parse errors.
161 lines
3.1 KiB
Makefile
161 lines
3.1 KiB
Makefile
# This is a generated file, do NOT edit!
|
|
# See contrib/bmake/bsd.after-import.mk
|
|
#
|
|
# $FreeBSD$
|
|
|
|
SRCTOP?= ${.CURDIR:H:H}
|
|
|
|
# look here first for config.h
|
|
CFLAGS+= -I${.CURDIR}
|
|
|
|
# for after-import
|
|
CLEANDIRS+= FreeBSD
|
|
CLEANFILES+= bootstrap
|
|
|
|
# $Id: Makefile,v 1.112 2020/08/28 16:26:17 sjg Exp $
|
|
|
|
PROG?= ${.CURDIR:T}
|
|
|
|
SRCS= \
|
|
arch.c \
|
|
buf.c \
|
|
compat.c \
|
|
cond.c \
|
|
dir.c \
|
|
enum.c \
|
|
for.c \
|
|
hash.c \
|
|
job.c \
|
|
lst.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
|
|
|
|
.sinclude "Makefile.inc"
|
|
|
|
# this file gets generated by configure
|
|
.sinclude "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: ${srcdir}/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}
|
|
|
|
.if make(obj) || make(clean)
|
|
SUBDIR+= unit-tests
|
|
.endif
|
|
|
|
|
|
MAN= ${PROG}.1
|
|
MAN1= ${MAN}
|
|
|
|
.if (${PROG} != "make")
|
|
CLEANFILES+= my.history
|
|
.if make(${MAN}) || !exists(${srcdir}/${MAN})
|
|
my.history:
|
|
@(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 <bsd.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
|
|
|
|
|
|
# A simple unit-test driver to help catch regressions
|
|
TEST_MAKE ?= ${.OBJDIR}/${PROG:T}
|
|
accept test:
|
|
cd ${.CURDIR}/unit-tests && \
|
|
MAKEFLAGS= ${TEST_MAKE} -r -m / ${.TARGET} ${TESTS:DTESTS=${TESTS:Q}}
|
|
|
|
|
|
# override some simple things
|
|
BINDIR= /usr/bin
|
|
MANDIR= /usr/share/man/man
|
|
|
|
# make sure we get this
|
|
CFLAGS+= ${COPTS.${.IMPSRC:T}}
|
|
|
|
after-import: ${SRCTOP}/contrib/bmake/bsd.after-import.mk
|
|
cd ${.CURDIR} && ${.MAKE} -f ${SRCTOP}/contrib/bmake/bsd.after-import.mk
|
|
|