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