xref: /freebsd/usr.bin/bmake/Makefile (revision 271171e0d97b88ba2a7c3bf750c9672b484c1c13)
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.120 2022/07/26 23:02:54 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.endif				# USE_FILEMON == dev
85
86.endif				# USE_FILEMON
87
88.PATH:	${srcdir}
89
90.if make(obj) || make(clean)
91SUBDIR+= unit-tests
92.endif
93
94
95MAN= ${PROG}.1
96MAN1= ${MAN}
97
98.if ${PROG} != "make"
99CLEANFILES+= my.history
100.if make(${MAN}) || !exists(${srcdir}/${MAN})
101my.history:
102	@(echo ".Nm"; \
103	echo "is derived from NetBSD"; \
104	echo ".Xr make 1 ."; \
105	echo "It uses autoconf to facilitate portability to other platforms."; \
106	echo ".Pp") > $@
107
108.NOPATH: ${MAN}
109${MAN}:	make.1 my.history
110	@echo making $@
111	@sed \
112	-e '/^.Dt/s/MAKE/${PROG:tu}/' \
113	-e 's/^.Nx/NetBSD/' \
114	-e '/^.Nm/s/make/${PROG}/' \
115	-e '/^.Sh HISTORY/rmy.history' \
116	-e '/^.Sh HISTORY/,$$s,^.Nm,make,' ${srcdir}/make.1 > $@
117
118all beforeinstall: ${MAN}
119_mfromdir=.
120.endif
121.endif
122
123MANTARGET?= cat
124MANDEST?= ${MANDIR}/${MANTARGET}1
125
126.if ${MANTARGET} == "cat"
127_mfromdir=${srcdir}
128.endif
129
130.include <bsd.prog.mk>
131
132CPPFLAGS+= -DMAKE_NATIVE -DHAVE_CONFIG_H
133COPTS.var.c += -Wno-cast-qual
134COPTS.job.c += -Wno-format-nonliteral
135COPTS.parse.c += -Wno-format-nonliteral
136COPTS.var.c += -Wno-format-nonliteral
137
138# Force these
139SHAREDIR= ${SHAREDIR.bmake:U${prefix}/share}
140BINDIR= ${BINDIR.bmake:U${prefix}/bin}
141MANDIR= ${MANDIR.bmake:U${SHAREDIR}/man}
142
143.if !exists(.depend)
144${OBJS}: config.h
145.endif
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