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