Home | History | Annotate | Line # | Download | only in lint1
Makefile revision 1.88
      1 #	$NetBSD: Makefile,v 1.88 2021/12/21 15:27:19 roy 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 LINTFLAGS.scan.c+=	-X 107,126,330,331,332,333	# strict bool mode
     23 LINTFLAGS.scan.c+=	-X 192,214	# due to suppressed bool errors
     24 LINTFLAGS.scan.c+=	-X 307		# static variable unused
     25 
     26 CPPFLAGS+=	-DIS_LINT1
     27 CPPFLAGS+=	-I${.CURDIR} -I${.OBJDIR}
     28 CPPFLAGS+=	${DEBUG:D-DDEBUG -DYYDEBUG}
     29 
     30 COPTS.err.c+=	${${ACTIVE_CC} == "clang":? -Wno-format-nonliteral :}
     31 
     32 BINDIR=		/usr/libexec
     33 
     34 CLEANFILES+=	${MAN} ${MAN}.date
     35 
     36 .if ${USETOOLS} == "yes"
     37 LINT1=		${TOOLDIR}/libexec/${MACHINE_GNU_PLATFORM}-lint1
     38 .endif
     39 LINT1?=		./${PROG}
     40 
     41 ${MAN}.date:	err.c
     42 	sed -E \
     43 	    -e 's,.*(....)/([0-9]{2})/0?([0-9]+).*,\2 \3\, \1,' \
     44 	    -e 's,^01,January,' \
     45 	    -e 's,^02,February,' \
     46 	    -e 's,^03,March,' \
     47 	    -e 's,^04,April,' \
     48 	    -e 's,^05,May,' \
     49 	    -e 's,^06,June,' \
     50 	    -e 's,^07,July,' \
     51 	    -e 's,^08,August,' \
     52 	    -e 's,^09,September,' \
     53 	    -e 's,^10,October,' \
     54 	    -e 's,^11,November,' \
     55 	    -e 's,^12,December,' \
     56 	    -e 1q \
     57 	    ${.ALLSRC} > ${.TARGET}
     58 
     59 ${MAN}:		makeman ${LINT1:./%=%} Makefile ${MAN}.date
     60 	${_MKTARGET_CREATE}
     61 	${HOST_SH} ${.ALLSRC:M*makeman} "$$(cat ${.ALLSRC:M*.date})" ${LINT1} -m >${.TARGET}
     62 
     63 LDADD+=		-lm
     64 .ifndef HOSTPROG
     65 DPADD+=		${LIBM}
     66 
     67 LDADD+=		-ll
     68 DPADD+=		${LIBL}
     69 .endif
     70 
     71 .include "Makefile.err-msgs-h"
     72 ${SRCS:Nerr.c}: err-msgs.h
     73 
     74 add-test: .PHONY
     75 	@set -eu; \
     76 	test=${NAME:Q}; \
     77 	[ "$$test" ] || { \
     78 		echo "usage: ${MAKE} add-test NAME=<name>"; \
     79 		exit; \
     80 	}; \
     81 	\
     82 	cd '../../../tests/usr.bin/xlint/lint1'; \
     83 	if [ -f "$$test.c" ]; then \
     84 		echo "error: test $$test already exists in $$PWD."; \
     85 		exit 1; \
     86 	fi; \
     87 	\
     88 	echo "=> Adding test $$test"; \
     89 	printf '%s\n' \
     90 		'/*	$$''NetBSD$$	*/' \
     91 		"# 3 \"$$test.c\"" \
     92 		'' \
     93 		'/*' \
     94 		' * TODO: Explain the purpose of the test.' \
     95 		' */' \
     96 		'' \
     97 		'/* lint1-extra-flags: -Z */' \
     98 		'/* lint1-flags: -Z */' \
     99 		'/* lint1-only-if: schar uchar ilp32 lp64 int long */' \
    100 		'/* lint1-skip-if: ldbl-64 ldbl-96 ldbl-128 */' \
    101 		'' \
    102 		'// TODO: Add some code that passes.' \
    103 		'// TODO: Add some code that fails.' \
    104 	> "$$test.c"; \
    105 	> "$$test.exp"; \
    106 	cvs add "$$test.c" "$$test.exp"; \
    107 	printf '%s\n' \
    108 		'/^FILES+=/i' \
    109 		"FILES+=		$$test.c" \
    110 		"FILES+=		$$test.exp" \
    111 		'.' 'w' 'q' \
    112 	| ed Makefile; \
    113 	${MAKE} sync-mi
    114 
    115 .include <bsd.prog.mk>
    116