Home | History | Annotate | Line # | Download | only in lint1
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 
      5 PROG=		lint1
      6 SRCS=		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 
     11 MAN=		lint.7
     12 YHEADER=
     13 #DBG=		-g
     14 #CPPFLAGS+=	-DYYDEBUG=1
     15 #YFLAGS+=	-v
     16 #LFLAGS+=	-d
     17 
     18 CWARNFLAGS.clang+=	-Wno-error=implicit-int-float-conversion
     19 LINTFLAGS+=		-T
     20 LOBJS.${PROG}+=		${SRCS:M*.y:.y=.ln}
     21 #LOBJS.${PROG}+=	${SRCS:M*.l:.l=.ln}
     22 LINTFLAGS.scan.c=	-X 107,330,331,333
     23 
     24 CPPFLAGS+=	-DIS_LINT1
     25 CPPFLAGS+=	-I${.CURDIR}
     26 CPPFLAGS+=	${DEBUG:D-DDEBUG}
     27 
     28 COPTS.err.c+=	${${ACTIVE_CC} == "clang":? -Wno-format-nonliteral :}
     29 
     30 BINDIR=		/usr/libexec
     31 
     32 CLEANFILES+=	${MAN}
     33 CLEANFILES+=	*.gcno *.gcda *.gcov
     34 
     35 .if ${USETOOLS} == "yes"
     36 LINT1=		${TOOLDIR}/libexec/${MACHINE_GNU_PLATFORM}-lint1
     37 .endif
     38 LINT1?=		./${PROG}
     39 
     40 ${MAN}:		makeman ${LINT1:C/^\.\///} Makefile
     41 	${_MKTARGET_CREATE}
     42 	${HOST_SH} ${.ALLSRC:M*makeman} ${LINT1} -m >${.TARGET}
     43 
     44 LDADD+=		-lm
     45 .ifndef HOSTPROG
     46 DPADD+=		${LIBM}
     47 
     48 LDADD+=		-ll
     49 DPADD+=		${LIBL}
     50 .endif
     51 
     52 .include "Makefile.err-msgs-h"
     53 ${SRCS:Nerr.c}: err-msgs.h
     54 
     55 add-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