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