1 1.70 rillig # $NetBSD: Makefile,v 1.70 2021/04/18 22:51:24 rillig Exp $ 2 1.17 thorpej 3 1.17 thorpej .include <bsd.own.mk> 4 1.1 cgd 5 1.21 tv PROG= lint1 6 1.66 rillig SRCS= cgram.y \ 7 1.66 rillig ckbool.c ckctype.c ckgetopt.c \ 8 1.66 rillig decl.c emit.c emit1.c err.c func.c init.c inittyp.c lex.c \ 9 1.57 rillig main1.c mem.c mem1.c oper.c print.c scan.l tree.c tyname.c 10 1.48 christos 11 1.21 tv MAN= lint.7 12 1.21 tv YHEADER= 13 1.69 rillig #DBG= -g 14 1.69 rillig #CPPFLAGS+= -DYYDEBUG=1 15 1.69 rillig #YFLAGS+= -v 16 1.69 rillig #LFLAGS+= -d 17 1.19 thorpej 18 1.53 joerg CWARNFLAGS.clang+= -Wno-error=implicit-int-float-conversion 19 1.63 rillig LINTFLAGS+= -T 20 1.69 rillig LOBJS.${PROG}+= ${SRCS:M*.y:.y=.ln} 21 1.69 rillig #LOBJS.${PROG}+= ${SRCS:M*.l:.l=.ln} 22 1.69 rillig LINTFLAGS.scan.c= -X 107,330,331,333 23 1.53 joerg 24 1.67 rillig CPPFLAGS+= -DIS_LINT1 25 1.67 rillig CPPFLAGS+= -I${.CURDIR} 26 1.62 rillig CPPFLAGS+= ${DEBUG:D-DDEBUG} 27 1.17 thorpej 28 1.70 rillig COPTS.err.c+= ${${ACTIVE_CC} == "clang":? -Wno-format-nonliteral :} 29 1.70 rillig 30 1.21 tv BINDIR= /usr/libexec 31 1.9 christos 32 1.21 tv CLEANFILES+= ${MAN} 33 1.61 rillig CLEANFILES+= *.gcno *.gcda *.gcov 34 1.22 tv 35 1.22 tv .if ${USETOOLS} == "yes" 36 1.22 tv LINT1= ${TOOLDIR}/libexec/${MACHINE_GNU_PLATFORM}-lint1 37 1.22 tv .endif 38 1.22 tv LINT1?= ./${PROG} 39 1.22 tv 40 1.22 tv ${MAN}: makeman ${LINT1:C/^\.\///} Makefile 41 1.34 lukem ${_MKTARGET_CREATE} 42 1.33 lukem ${HOST_SH} ${.ALLSRC:M*makeman} ${LINT1} -m >${.TARGET} 43 1.1 cgd 44 1.26 lukem LDADD+= -lm 45 1.27 dbj .ifndef HOSTPROG 46 1.26 lukem DPADD+= ${LIBM} 47 1.26 lukem 48 1.26 lukem LDADD+= -ll 49 1.26 lukem DPADD+= ${LIBL} 50 1.28 lukem .endif 51 1.24 tv 52 1.55 rillig .include "Makefile.err-msgs-h" 53 1.56 rillig ${SRCS:Nerr.c}: err-msgs.h 54 1.46 christos 55 1.58 rillig add-test: .PHONY 56 1.58 rillig @set -eu; \ 57 1.58 rillig test=${NAME:Q}; \ 58 1.58 rillig [ "$$test" ] || { \ 59 1.58 rillig echo "usage: ${MAKE} add-test NAME=<name>"; \ 60 1.58 rillig exit; \ 61 1.58 rillig }; \ 62 1.58 rillig \ 63 1.58 rillig cd '../../../tests/usr.bin/xlint/lint1'; \ 64 1.58 rillig if [ -f "$$test.c" ]; then \ 65 1.58 rillig echo "error: test $$test already exists in $$PWD."; \ 66 1.58 rillig exit 1; \ 67 1.58 rillig fi; \ 68 1.58 rillig \ 69 1.58 rillig echo "=> Adding test $$test"; \ 70 1.58 rillig printf '%s\n' \ 71 1.58 rillig '/* $$''NetBSD$$ */' \ 72 1.58 rillig "# 3 \"$$test.c\"" \ 73 1.58 rillig '' \ 74 1.58 rillig '/*' \ 75 1.58 rillig ' * TODO: Explain the purpose of the test.' \ 76 1.64 rillig ' */' \ 77 1.58 rillig '' \ 78 1.58 rillig '/* lint1-extra-flags: -p */' \ 79 1.58 rillig '' \ 80 1.58 rillig '// TODO: Add some code that passes.' \ 81 1.58 rillig '// TODO: Add some code that fails.' \ 82 1.58 rillig > "$$test.c"; \ 83 1.58 rillig > "$$test.exp"; \ 84 1.58 rillig cvs add "$$test.c" "$$test.exp"; \ 85 1.58 rillig printf '%s\n' \ 86 1.58 rillig '/^FILES+=/i' \ 87 1.58 rillig "FILES+= $$test.c" \ 88 1.58 rillig "FILES+= $$test.exp" \ 89 1.58 rillig '.' 'w' 'q' \ 90 1.58 rillig | ed Makefile; \ 91 1.58 rillig ${MAKE} sync-mi; \ 92 1.58 rillig printf '%s\n' '/^test_case /i' "test_case $$test" '.' 'w' 'q' \ 93 1.58 rillig | ed t_integration.sh 94 1.58 rillig 95 1.1 cgd .include <bsd.prog.mk> 96