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