xref: /openbsd/usr.bin/make/Makefile (revision c9fc29cf)
1#	$OpenBSD: Makefile,v 1.65 2023/09/04 11:35:11 espie Exp $
2
3PROG=	make
4CFLAGS+= -I${.OBJDIR} -I${.CURDIR}
5HOSTCFLAGS+= -I${.OBJDIR} -I${.CURDIR}
6CDIAGFLAGS=-Wall -W -Wno-char-subscripts -Wstrict-prototypes -pedantic \
7	-Wmissing-prototypes -Wdeclaration-after-statement -std=c99
8
9CDEFS+=-DMAKE_BSIZE=256 -DDEFMAXJOBS=4
10#CDEFS+=-DHAS_STATS
11
12DPADD += ${LIBUTIL}
13LDADD += -lutil
14CFLAGS+=${CDEFS}
15HOSTCFLAGS+=${CDEFS}
16
17SRCS=	arch.c buf.c cmd_exec.c compat.c cond.c dir.c direxpand.c dump.c \
18	engine.c enginechoice.c error.c expandchildren.c \
19	for.c init.c job.c lowparse.c main.c make.c memory.c parse.c \
20	parsevar.c str.c stats.c suff.c targ.c targequiv.c timestamp.c \
21	var.c varmodifiers.c varname.c
22
23.include "${.CURDIR}/lst.lib/Makefile.inc"
24
25CLEANFILES+=generate generate.o regress.o check
26
27CLEANFILES+= varhashconsts.h condhashconsts.h nodehashconsts.h
28
29# may need tweaking if you add variable synonyms or change the hash function
30MAGICVARSLOTS=82
31MAGICCONDSLOTS=65
32
33varhashconsts.h: generate
34	${.OBJDIR}/generate 1 ${MAGICVARSLOTS} >$@.tmp && mv $@.tmp $@
35
36condhashconsts.h: generate
37	${.OBJDIR}/generate 2 ${MAGICCONDSLOTS} >$@.tmp && mv $@.tmp $@
38
39nodehashconsts.h: generate
40	${.OBJDIR}/generate 3 0 >$@.tmp && mv $@.tmp $@
41
42generate: generate.c stats.c memory.c ${DPADD}
43	${HOSTCC} ${HOSTCFLAGS} ${LDSTATIC} -o ${.TARGET} ${.ALLSRC} ${LDFLAGS} ${LDADD}
44
45CHECKOBJS = regress.o str.o memory.o buf.o
46
47check: ${CHECKOBJS} ${DPADD}
48	${CC} -o ${.TARGET} ${CFLAGS} ${CHECKOBJS} ${LDADD}
49
50regress: check
51	${.OBJDIR}/check
52
53var.o: varhashconsts.h
54cond.o: condhashconsts.h
55targ.o parse.o: nodehashconsts.h
56
57.PHONY:		regress
58
59.include <bsd.prog.mk>
60