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