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