Makefile revision 1.62
1#	$NetBSD: Makefile,v 1.62 2021/02/20 18:10:22 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
18
19CPPFLAGS+=	-I${.CURDIR} -I. -DPASS=\"${PROG}.h\"
20CPPFLAGS+=	${DEBUG:D-DDEBUG}
21
22BINDIR=		/usr/libexec
23
24CLEANFILES+=	${MAN}
25CLEANFILES+=	*.gcno *.gcda *.gcov
26
27.if ${USETOOLS} == "yes"
28LINT1=		${TOOLDIR}/libexec/${MACHINE_GNU_PLATFORM}-lint1
29.endif
30LINT1?=		./${PROG}
31
32${MAN}:		makeman ${LINT1:C/^\.\///} Makefile
33	${_MKTARGET_CREATE}
34	${HOST_SH} ${.ALLSRC:M*makeman} ${LINT1} -m >${.TARGET}
35
36LDADD+=		-lm
37.ifndef HOSTPROG
38DPADD+=		${LIBM}
39
40LDADD+=		-ll
41DPADD+=		${LIBL}
42.endif
43
44oper.o: ops.def
45
46.include "Makefile.err-msgs-h"
47${SRCS:Nerr.c}: err-msgs.h
48
49add-test: .PHONY
50	@set -eu; \
51	test=${NAME:Q}; \
52	[ "$$test" ] || { \
53		echo "usage: ${MAKE} add-test NAME=<name>"; \
54		exit; \
55	}; \
56	\
57	cd '../../../tests/usr.bin/xlint/lint1'; \
58	if [ -f "$$test.c" ]; then \
59		echo "error: test $$test already exists in $$PWD."; \
60		exit 1; \
61	fi; \
62	\
63	echo "=> Adding test $$test"; \
64	printf '%s\n' \
65		'/*	$$''NetBSD$$	*/' \
66		"# 3 \"$$test.c\"" \
67		'' \
68		'/*' \
69		' * TODO: Explain the purpose of the test.' \
70		'*/' \
71		'' \
72		'/* lint1-extra-flags: -p */' \
73		'' \
74		'// TODO: Add some code that passes.' \
75		'// TODO: Add some code that fails.' \
76	> "$$test.c"; \
77	> "$$test.exp"; \
78	cvs add "$$test.c" "$$test.exp"; \
79	printf '%s\n' \
80		'/^FILES+=/i' \
81		"FILES+=		$$test.c" \
82		"FILES+=		$$test.exp" \
83		'.' 'w' 'q' \
84	| ed Makefile; \
85	${MAKE} sync-mi; \
86	printf '%s\n' '/^test_case /i' "test_case $$test" '.' 'w' 'q' \
87	| ed t_integration.sh
88
89.include <bsd.prog.mk>
90