Home | History | Annotate | Line # | Download | only in lint1
Makefile revision 1.63
      1 #	$NetBSD: Makefile,v 1.63 2021/03/20 19:33:25 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 LINTFLAGS+=		-T
     19 
     20 CPPFLAGS+=	-I${.CURDIR} -I. -DPASS=\"${PROG}.h\"
     21 CPPFLAGS+=	${DEBUG:D-DDEBUG}
     22 
     23 BINDIR=		/usr/libexec
     24 
     25 CLEANFILES+=	${MAN}
     26 CLEANFILES+=	*.gcno *.gcda *.gcov
     27 
     28 .if ${USETOOLS} == "yes"
     29 LINT1=		${TOOLDIR}/libexec/${MACHINE_GNU_PLATFORM}-lint1
     30 .endif
     31 LINT1?=		./${PROG}
     32 
     33 ${MAN}:		makeman ${LINT1:C/^\.\///} Makefile
     34 	${_MKTARGET_CREATE}
     35 	${HOST_SH} ${.ALLSRC:M*makeman} ${LINT1} -m >${.TARGET}
     36 
     37 LDADD+=		-lm
     38 .ifndef HOSTPROG
     39 DPADD+=		${LIBM}
     40 
     41 LDADD+=		-ll
     42 DPADD+=		${LIBL}
     43 .endif
     44 
     45 oper.o: ops.def
     46 
     47 .include "Makefile.err-msgs-h"
     48 ${SRCS:Nerr.c}: err-msgs.h
     49 
     50 add-test: .PHONY
     51 	@set -eu; \
     52 	test=${NAME:Q}; \
     53 	[ "$$test" ] || { \
     54 		echo "usage: ${MAKE} add-test NAME=<name>"; \
     55 		exit; \
     56 	}; \
     57 	\
     58 	cd '../../../tests/usr.bin/xlint/lint1'; \
     59 	if [ -f "$$test.c" ]; then \
     60 		echo "error: test $$test already exists in $$PWD."; \
     61 		exit 1; \
     62 	fi; \
     63 	\
     64 	echo "=> Adding test $$test"; \
     65 	printf '%s\n' \
     66 		'/*	$$''NetBSD$$	*/' \
     67 		"# 3 \"$$test.c\"" \
     68 		'' \
     69 		'/*' \
     70 		' * TODO: Explain the purpose of the test.' \
     71 		'*/' \
     72 		'' \
     73 		'/* lint1-extra-flags: -p */' \
     74 		'' \
     75 		'// TODO: Add some code that passes.' \
     76 		'// TODO: Add some code that fails.' \
     77 	> "$$test.c"; \
     78 	> "$$test.exp"; \
     79 	cvs add "$$test.c" "$$test.exp"; \
     80 	printf '%s\n' \
     81 		'/^FILES+=/i' \
     82 		"FILES+=		$$test.c" \
     83 		"FILES+=		$$test.exp" \
     84 		'.' 'w' 'q' \
     85 	| ed Makefile; \
     86 	${MAKE} sync-mi; \
     87 	printf '%s\n' '/^test_case /i' "test_case $$test" '.' 'w' 'q' \
     88 	| ed t_integration.sh
     89 
     90 .include <bsd.prog.mk>
     91