Home | History | Annotate | Line # | Download | only in lint1
Makefile revision 1.81
      1 #	$NetBSD: Makefile,v 1.81 2021/07/31 17:09:21 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 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 CLEANFILES+=	*.gcno *.gcda *.gcov
     33 
     34 .if ${USETOOLS} == "yes"
     35 LINT1=		${TOOLDIR}/libexec/${MACHINE_GNU_PLATFORM}-lint1
     36 .endif
     37 LINT1?=		./${PROG}
     38 
     39 ${MAN}:		makeman ${LINT1:C/^\.\///} Makefile
     40 	${_MKTARGET_CREATE}
     41 	${HOST_SH} ${.ALLSRC:M*makeman} ${LINT1} -m >${.TARGET}
     42 
     43 LDADD+=		-lm
     44 .ifndef HOSTPROG
     45 DPADD+=		${LIBM}
     46 
     47 LDADD+=		-ll
     48 DPADD+=		${LIBL}
     49 .endif
     50 
     51 .include "Makefile.err-msgs-h"
     52 ${SRCS:Nerr.c}: err-msgs.h
     53 
     54 add-test: .PHONY
     55 	@set -eu; \
     56 	test=${NAME:Q}; \
     57 	[ "$$test" ] || { \
     58 		echo "usage: ${MAKE} add-test NAME=<name>"; \
     59 		exit; \
     60 	}; \
     61 	\
     62 	cd '../../../tests/usr.bin/xlint/lint1'; \
     63 	if [ -f "$$test.c" ]; then \
     64 		echo "error: test $$test already exists in $$PWD."; \
     65 		exit 1; \
     66 	fi; \
     67 	\
     68 	echo "=> Adding test $$test"; \
     69 	printf '%s\n' \
     70 		'/*	$$''NetBSD$$	*/' \
     71 		"# 3 \"$$test.c\"" \
     72 		'' \
     73 		'/*' \
     74 		' * TODO: Explain the purpose of the test.' \
     75 		' */' \
     76 		'' \
     77 		'/* lint1-extra-flags: -Z */' \
     78 		'/* lint1-flags: -Z */' \
     79 		'/* lint1-only-if: schar uchar ilp32 lp64 int long */' \
     80 		'/* lint1-skip-if: ldbl-64 ldbl-96 ldbl-128 */' \
     81 		'' \
     82 		'// TODO: Add some code that passes.' \
     83 		'// TODO: Add some code that fails.' \
     84 	> "$$test.c"; \
     85 	> "$$test.exp"; \
     86 	cvs add "$$test.c" "$$test.exp"; \
     87 	printf '%s\n' \
     88 		'/^FILES+=/i' \
     89 		"FILES+=		$$test.c" \
     90 		"FILES+=		$$test.exp" \
     91 		'.' 'w' 'q' \
     92 	| ed Makefile; \
     93 	${MAKE} sync-mi
     94 
     95 .include <bsd.prog.mk>
     96