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