1 # $NetBSD: Makefile,v 1.83 2021/08/07 17:38:41 rillig Exp $ 2 3 .include <bsd.own.mk> 4 5 PROG= lint1 6 SRCS= cgram.y \ 7 ckbool.c ckctype.c ckgetopt.c debug.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 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 23 CPPFLAGS+= -DIS_LINT1 24 CPPFLAGS+= -I${.CURDIR} 25 CPPFLAGS+= ${DEBUG:D-DDEBUG -DYYDEBUG} 26 27 COPTS.err.c+= ${${ACTIVE_CC} == "clang":? -Wno-format-nonliteral :} 28 29 BINDIR= /usr/libexec 30 31 CLEANFILES+= ${MAN} 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: -Z */' \ 77 '/* lint1-flags: -Z */' \ 78 '/* lint1-only-if: schar uchar ilp32 lp64 int long */' \ 79 '/* lint1-skip-if: ldbl-64 ldbl-96 ldbl-128 */' \ 80 '' \ 81 '// TODO: Add some code that passes.' \ 82 '// TODO: Add some code that fails.' \ 83 > "$$test.c"; \ 84 > "$$test.exp"; \ 85 cvs add "$$test.c" "$$test.exp"; \ 86 printf '%s\n' \ 87 '/^FILES+=/i' \ 88 "FILES+= $$test.c" \ 89 "FILES+= $$test.exp" \ 90 '.' 'w' 'q' \ 91 | ed Makefile; \ 92 ${MAKE} sync-mi 93 94 .include <bsd.prog.mk> 95