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