xref: /freebsd/usr.bin/bmake/Makefile (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
1# This is a generated file, do NOT edit!
2# See contrib/bmake/bsd.after-import.mk
3#
4
5SRCTOP?= ${.CURDIR:H:H}
6
7# look here first for config.h
8CFLAGS+= -I${.CURDIR}
9
10# for after-import
11CLEANDIRS+= FreeBSD
12CLEANFILES+= bootstrap
13
14#	$Id: Makefile,v 1.127 2024/03/19 16:03:23 sjg Exp $
15
16PROG?=	${.CURDIR:T}
17
18SRCS= \
19	arch.c \
20	buf.c \
21	compat.c \
22	cond.c \
23	dir.c \
24	for.c \
25	hash.c \
26	job.c \
27	lst.c \
28	main.c \
29	make.c \
30	make_malloc.c \
31	meta.c \
32	metachar.c \
33	parse.c \
34	str.c \
35	suff.c \
36	targ.c \
37	trace.c \
38	util.c \
39	var.c
40
41.sinclude "Makefile.inc"
42
43# this file gets generated by configure
44.sinclude "Makefile.config"
45
46.if !empty(LIBOBJS)
47SRCS+= ${LIBOBJS:T:.o=.c}
48.endif
49
50# just in case
51prefix?= /usr
52srcdir?= ${.CURDIR}
53
54DEFAULT_SYS_PATH?= ${prefix}/share/mk
55
56CPPFLAGS+= -DUSE_META
57CFLAGS+= ${CPPFLAGS}
58CFLAGS+= -D_PATH_DEFSYSPATH=\"${DEFAULT_SYS_PATH}\"
59CFLAGS+= -I. -I${srcdir} ${XDEFS} -DMAKE_NATIVE
60CFLAGS+= ${COPTS.${.ALLSRC:M*.c:T:u}}
61COPTS.main.c+= "-DMAKE_VERSION=\"${_MAKE_VERSION}\""
62
63.for x in FORCE_MAKE_OS FORCE_MACHINE FORCE_MACHINE_ARCH
64.ifdef $x
65COPTS.main.c+= "-D$x=\"${$x}\""
66.endif
67.endfor
68
69# meta mode can be useful even without filemon
70# should be set by now
71USE_FILEMON ?= no
72.if ${USE_FILEMON:tl} != "no"
73.PATH:	${srcdir}/filemon
74SRCS+=	filemon_${USE_FILEMON}.c
75COPTS.meta.c+= -DUSE_FILEMON -DUSE_FILEMON_${USE_FILEMON:tu}
76COPTS.job.c+= ${COPTS.meta.c}
77
78.if ${USE_FILEMON} == "dev"
79FILEMON_H ?= /usr/include/dev/filemon/filemon.h
80.if exists(${FILEMON_H}) && ${FILEMON_H:T} == "filemon.h"
81COPTS.filemon_dev.c += -DHAVE_FILEMON_H -I${FILEMON_H:H}
82.endif
83.elif ${USE_FILEMON} == "ktrace"
84COPTS.filemon_ktrace.c += -Wno-error=unused-parameter
85.endif
86
87.endif				# USE_FILEMON
88
89.PATH:	${srcdir}
90
91.if make(obj) || make(clean)
92SUBDIR+= unit-tests
93.endif
94
95
96MAN= ${PROG}.1
97MAN1= ${MAN}
98
99.if ${PROG} != "make"
100CLEANFILES+= my.history
101.if make(${MAN}) || !exists(${srcdir}/${MAN})
102my.history:
103	@(echo ".Nm"; \
104	echo "is derived from NetBSD"; \
105	echo ".Xr make 1 ."; \
106	echo "It uses autoconf to facilitate portability to other platforms."; \
107	echo ".Pp") > $@
108
109.NOPATH: ${MAN}
110${MAN}:	make.1 my.history
111	@echo making $@
112	@sed \
113	-e '/^.Dt/s/MAKE/${PROG:tu}/' \
114	-e 's/^.Nx/NetBSD/' \
115	-e '/^.Nm/s/make/${PROG}/' \
116	-e '/^.Sh HISTORY/rmy.history' \
117	-e '/^.Sh HISTORY/,$$s,^.Nm,make,' ${srcdir}/make.1 > $@
118
119all beforeinstall: ${MAN}
120_mfromdir=.
121.endif
122.endif
123
124MANTARGET?= cat
125MANDEST?= ${MANDIR}/${MANTARGET}1
126
127.if ${MANTARGET} == "cat"
128_mfromdir=${srcdir}
129.endif
130
131.include <bsd.prog.mk>
132
133CPPFLAGS+= -DMAKE_NATIVE -DHAVE_CONFIG_H
134COPTS.var.c += -Wno-cast-qual
135COPTS.job.c += -Wno-format-nonliteral
136COPTS.parse.c += -Wno-format-nonliteral
137COPTS.var.c += -Wno-format-nonliteral
138
139# Force these
140SHAREDIR= ${SHAREDIR.bmake:U${prefix}/share}
141BINDIR= ${BINDIR.bmake:U${prefix}/bin}
142MANDIR= ${MANDIR.bmake:U${SHAREDIR}/man}
143
144${OBJS}: config.h
145
146
147# A simple unit-test driver to help catch regressions
148TEST_MAKE ?= ${.OBJDIR}/${PROG:T}
149accept test: .NOMETA
150	cd ${.CURDIR}/unit-tests && \
151	MAKEFLAGS= ${TEST_MAKE} -r -m / ${.TARGET} ${TESTS:DTESTS=${TESTS:Q}}
152
153
154.if make(test) && ${MK_AUTO_OBJ} == "yes"
155# The test target above visits unit-tests with -r -m /
156# which prevents MK_AUTO_OBJ doing its job
157# so do it here
158.if defined(MAKEOBJDIRPREFIX) || ${MAKEOBJDIR:U:M*/*} != ""
159_utobj = ${.OBJDIR}/unit-tests
160.else
161_utobj = ${.CURDIR}/unit-tests/${MAKEOBJDIR:Uobj}
162.endif
163utobj: .NOMETA
164	@test -d ${_utobj} && exit 0; \
165	echo "[Creating ${_utobj}...]"; \
166	umask ${OBJDIR_UMASK:U002}; \
167	mkdir -p ${_utobj}
168test: utobj
169.endif
170
171# override some simple things
172BINDIR= /usr/bin
173MANDIR= /usr/share/man/man
174
175# make sure we get this
176CFLAGS+= ${COPTS.${.IMPSRC:T}}
177
178after-import: ${SRCTOP}/contrib/bmake/bsd.after-import.mk
179	cd ${.CURDIR} && ${.MAKE} -f ${SRCTOP}/contrib/bmake/bsd.after-import.mk
180
181