Home | History | Annotate | Line # | Download | only in lint1
Makefile revision 1.61
      1 #	$NetBSD: Makefile,v 1.61 2021/02/19 23:25:26 rillig Exp $
      2 
      3 .include <bsd.own.mk>
      4 
      5 PROG=		lint1
      6 SRCS=		cgram.y ckgetopt.c decl.c emit.c emit1.c err.c \
      7 		func.c init.c inittyp.c lex.c \
      8 		main1.c mem.c mem1.c oper.c print.c scan.l tree.c tyname.c
      9 
     10 MAN=		lint.7
     11 YHEADER=
     12 #DBG=-g
     13 #CPPFLAGS+=-DYYDEBUG=1
     14 #YFLAGS+=-v
     15 #LFLAGS+=-d
     16 
     17 CWARNFLAGS.clang+=	-Wno-error=implicit-int-float-conversion
     18 
     19 CPPFLAGS+=	-I${.CURDIR} -I. -DPASS=\"${PROG}.h\"
     20 
     21 BINDIR=		/usr/libexec
     22 
     23 CLEANFILES+=	${MAN}
     24 CLEANFILES+=	*.gcno *.gcda *.gcov
     25 
     26 .if ${USETOOLS} == "yes"
     27 LINT1=		${TOOLDIR}/libexec/${MACHINE_GNU_PLATFORM}-lint1
     28 .endif
     29 LINT1?=		./${PROG}
     30 
     31 ${MAN}:		makeman ${LINT1:C/^\.\///} Makefile
     32 	${_MKTARGET_CREATE}
     33 	${HOST_SH} ${.ALLSRC:M*makeman} ${LINT1} -m >${.TARGET}
     34 
     35 LDADD+=		-lm
     36 .ifndef HOSTPROG
     37 DPADD+=		${LIBM}
     38 
     39 LDADD+=		-ll
     40 DPADD+=		${LIBL}
     41 .endif
     42 
     43 oper.o: ops.def
     44 
     45 .include "Makefile.err-msgs-h"
     46 ${SRCS:Nerr.c}: err-msgs.h
     47 
     48 add-test: .PHONY
     49 	@set -eu; \
     50 	test=${NAME:Q}; \
     51 	[ "$$test" ] || { \
     52 		echo "usage: ${MAKE} add-test NAME=<name>"; \
     53 		exit; \
     54 	}; \
     55 	\
     56 	cd '../../../tests/usr.bin/xlint/lint1'; \
     57 	if [ -f "$$test.c" ]; then \
     58 		echo "error: test $$test already exists in $$PWD."; \
     59 		exit 1; \
     60 	fi; \
     61 	\
     62 	echo "=> Adding test $$test"; \
     63 	printf '%s\n' \
     64 		'/*	$$''NetBSD$$	*/' \
     65 		"# 3 \"$$test.c\"" \
     66 		'' \
     67 		'/*' \
     68 		' * TODO: Explain the purpose of the test.' \
     69 		'*/' \
     70 		'' \
     71 		'/* lint1-extra-flags: -p */' \
     72 		'' \
     73 		'// TODO: Add some code that passes.' \
     74 		'// TODO: Add some code that fails.' \
     75 	> "$$test.c"; \
     76 	> "$$test.exp"; \
     77 	cvs add "$$test.c" "$$test.exp"; \
     78 	printf '%s\n' \
     79 		'/^FILES+=/i' \
     80 		"FILES+=		$$test.c" \
     81 		"FILES+=		$$test.exp" \
     82 		'.' 'w' 'q' \
     83 	| ed Makefile; \
     84 	${MAKE} sync-mi; \
     85 	printf '%s\n' '/^test_case /i' "test_case $$test" '.' 'w' 'q' \
     86 	| ed t_integration.sh
     87 
     88 .include <bsd.prog.mk>
     89