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