Makefile revision 1.68
1#	$NetBSD: Makefile,v 1.68 2021/04/17 11:01:34 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+=	-DIS_LINT1
22CPPFLAGS+=	-I${.CURDIR}
23CPPFLAGS+=	${DEBUG:D-DDEBUG}
24
25BINDIR=		/usr/libexec
26
27CLEANFILES+=	${MAN}
28CLEANFILES+=	*.gcno *.gcda *.gcov
29
30.if ${USETOOLS} == "yes"
31LINT1=		${TOOLDIR}/libexec/${MACHINE_GNU_PLATFORM}-lint1
32.endif
33LINT1?=		./${PROG}
34
35${MAN}:		makeman ${LINT1:C/^\.\///} Makefile
36	${_MKTARGET_CREATE}
37	${HOST_SH} ${.ALLSRC:M*makeman} ${LINT1} -m >${.TARGET}
38
39LDADD+=		-lm
40.ifndef HOSTPROG
41DPADD+=		${LIBM}
42
43LDADD+=		-ll
44DPADD+=		${LIBL}
45.endif
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