Makefile revision 1.63
1#	$NetBSD: Makefile,v 1.63 2021/03/20 19:33:25 rillig Exp $
2
3.include <bsd.own.mk>
4
5PROG=		lint1
6SRCS=		cgram.y ckgetopt.c decl.c emit.c emit1.c err.c \
7		func.c init.c inittyp.c lex.c \
8		main1.c mem.c mem1.c oper.c print.c scan.l tree.c tyname.c
9
10MAN=		lint.7
11YHEADER=
12#DBG=-g
13#CPPFLAGS+=-DYYDEBUG=1
14#YFLAGS+=-v
15#LFLAGS+=-d
16
17CWARNFLAGS.clang+=	-Wno-error=implicit-int-float-conversion
18LINTFLAGS+=		-T
19
20CPPFLAGS+=	-I${.CURDIR} -I. -DPASS=\"${PROG}.h\"
21CPPFLAGS+=	${DEBUG:D-DDEBUG}
22
23BINDIR=		/usr/libexec
24
25CLEANFILES+=	${MAN}
26CLEANFILES+=	*.gcno *.gcda *.gcov
27
28.if ${USETOOLS} == "yes"
29LINT1=		${TOOLDIR}/libexec/${MACHINE_GNU_PLATFORM}-lint1
30.endif
31LINT1?=		./${PROG}
32
33${MAN}:		makeman ${LINT1:C/^\.\///} Makefile
34	${_MKTARGET_CREATE}
35	${HOST_SH} ${.ALLSRC:M*makeman} ${LINT1} -m >${.TARGET}
36
37LDADD+=		-lm
38.ifndef HOSTPROG
39DPADD+=		${LIBM}
40
41LDADD+=		-ll
42DPADD+=		${LIBL}
43.endif
44
45oper.o: ops.def
46
47.include "Makefile.err-msgs-h"
48${SRCS:Nerr.c}: err-msgs.h
49
50add-test: .PHONY
51	@set -eu; \
52	test=${NAME:Q}; \
53	[ "$$test" ] || { \
54		echo "usage: ${MAKE} add-test NAME=<name>"; \
55		exit; \
56	}; \
57	\
58	cd '../../../tests/usr.bin/xlint/lint1'; \
59	if [ -f "$$test.c" ]; then \
60		echo "error: test $$test already exists in $$PWD."; \
61		exit 1; \
62	fi; \
63	\
64	echo "=> Adding test $$test"; \
65	printf '%s\n' \
66		'/*	$$''NetBSD$$	*/' \
67		"# 3 \"$$test.c\"" \
68		'' \
69		'/*' \
70		' * TODO: Explain the purpose of the test.' \
71		'*/' \
72		'' \
73		'/* lint1-extra-flags: -p */' \
74		'' \
75		'// TODO: Add some code that passes.' \
76		'// TODO: Add some code that fails.' \
77	> "$$test.c"; \
78	> "$$test.exp"; \
79	cvs add "$$test.c" "$$test.exp"; \
80	printf '%s\n' \
81		'/^FILES+=/i' \
82		"FILES+=		$$test.c" \
83		"FILES+=		$$test.exp" \
84		'.' 'w' 'q' \
85	| ed Makefile; \
86	${MAKE} sync-mi; \
87	printf '%s\n' '/^test_case /i' "test_case $$test" '.' 'w' 'q' \
88	| ed t_integration.sh
89
90.include <bsd.prog.mk>
91