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