Home | History | Annotate | Line # | Download | only in lint1
Makefile revision 1.76
      1  1.76    rillig #	$NetBSD: Makefile,v 1.76 2021/07/04 08:49:41 rillig Exp $
      2  1.17   thorpej 
      3  1.17   thorpej .include <bsd.own.mk>
      4   1.1       cgd 
      5  1.21        tv PROG=		lint1
      6  1.66    rillig SRCS=		cgram.y \
      7  1.66    rillig 		ckbool.c ckctype.c ckgetopt.c \
      8  1.66    rillig 		decl.c emit.c emit1.c err.c func.c init.c inittyp.c lex.c \
      9  1.57    rillig 		main1.c mem.c mem1.c oper.c print.c scan.l tree.c tyname.c
     10  1.48  christos 
     11  1.21        tv MAN=		lint.7
     12  1.21        tv YHEADER=
     13  1.69    rillig #DBG=		-g
     14  1.69    rillig #CPPFLAGS+=	-DYYDEBUG=1
     15  1.69    rillig #YFLAGS+=	-v
     16  1.69    rillig #LFLAGS+=	-d
     17  1.19   thorpej 
     18  1.53     joerg CWARNFLAGS.clang+=	-Wno-error=implicit-int-float-conversion
     19  1.63    rillig LINTFLAGS+=		-T
     20  1.69    rillig LOBJS.${PROG}+=		${SRCS:M*.y:.y=.ln}
     21  1.76    rillig LOBJS.${PROG}+=		${SRCS:M*.l:.l=.ln}
     22  1.76    rillig LINTFLAGS.scan.c=	-X 107,126,330,331,332,333
     23  1.53     joerg 
     24  1.67    rillig CPPFLAGS+=	-DIS_LINT1
     25  1.67    rillig CPPFLAGS+=	-I${.CURDIR}
     26  1.62    rillig CPPFLAGS+=	${DEBUG:D-DDEBUG}
     27  1.17   thorpej 
     28  1.70    rillig COPTS.err.c+=	${${ACTIVE_CC} == "clang":? -Wno-format-nonliteral :}
     29  1.70    rillig 
     30  1.72    rillig # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101177
     31  1.74       mrg .if ${HAVE_GCC:U0} >= 9 &&	\
     32  1.71    martin 	(${MACHINE_ARCH} == "sh3el" || ${MACHINE_ARCH} == "sh3eb")
     33  1.71    martin COPTS.lex.c+=	-O0
     34  1.71    martin .endif
     35  1.71    martin 
     36  1.21        tv BINDIR=		/usr/libexec
     37   1.9  christos 
     38  1.21        tv CLEANFILES+=	${MAN}
     39  1.61    rillig CLEANFILES+=	*.gcno *.gcda *.gcov
     40  1.22        tv 
     41  1.22        tv .if ${USETOOLS} == "yes"
     42  1.22        tv LINT1=		${TOOLDIR}/libexec/${MACHINE_GNU_PLATFORM}-lint1
     43  1.22        tv .endif
     44  1.22        tv LINT1?=		./${PROG}
     45  1.22        tv 
     46  1.22        tv ${MAN}:		makeman ${LINT1:C/^\.\///} Makefile
     47  1.34     lukem 	${_MKTARGET_CREATE}
     48  1.33     lukem 	${HOST_SH} ${.ALLSRC:M*makeman} ${LINT1} -m >${.TARGET}
     49   1.1       cgd 
     50  1.26     lukem LDADD+=		-lm
     51  1.27       dbj .ifndef HOSTPROG
     52  1.26     lukem DPADD+=		${LIBM}
     53  1.26     lukem 
     54  1.26     lukem LDADD+=		-ll
     55  1.26     lukem DPADD+=		${LIBL}
     56  1.28     lukem .endif
     57  1.24        tv 
     58  1.55    rillig .include "Makefile.err-msgs-h"
     59  1.56    rillig ${SRCS:Nerr.c}: err-msgs.h
     60  1.46  christos 
     61  1.58    rillig add-test: .PHONY
     62  1.58    rillig 	@set -eu; \
     63  1.58    rillig 	test=${NAME:Q}; \
     64  1.58    rillig 	[ "$$test" ] || { \
     65  1.58    rillig 		echo "usage: ${MAKE} add-test NAME=<name>"; \
     66  1.58    rillig 		exit; \
     67  1.58    rillig 	}; \
     68  1.58    rillig 	\
     69  1.58    rillig 	cd '../../../tests/usr.bin/xlint/lint1'; \
     70  1.58    rillig 	if [ -f "$$test.c" ]; then \
     71  1.58    rillig 		echo "error: test $$test already exists in $$PWD."; \
     72  1.58    rillig 		exit 1; \
     73  1.58    rillig 	fi; \
     74  1.58    rillig 	\
     75  1.58    rillig 	echo "=> Adding test $$test"; \
     76  1.58    rillig 	printf '%s\n' \
     77  1.58    rillig 		'/*	$$''NetBSD$$	*/' \
     78  1.58    rillig 		"# 3 \"$$test.c\"" \
     79  1.58    rillig 		'' \
     80  1.58    rillig 		'/*' \
     81  1.58    rillig 		' * TODO: Explain the purpose of the test.' \
     82  1.64    rillig 		' */' \
     83  1.58    rillig 		'' \
     84  1.58    rillig 		'/* lint1-extra-flags: -p */' \
     85  1.58    rillig 		'' \
     86  1.58    rillig 		'// TODO: Add some code that passes.' \
     87  1.58    rillig 		'// TODO: Add some code that fails.' \
     88  1.58    rillig 	> "$$test.c"; \
     89  1.58    rillig 	> "$$test.exp"; \
     90  1.58    rillig 	cvs add "$$test.c" "$$test.exp"; \
     91  1.58    rillig 	printf '%s\n' \
     92  1.58    rillig 		'/^FILES+=/i' \
     93  1.58    rillig 		"FILES+=		$$test.c" \
     94  1.58    rillig 		"FILES+=		$$test.exp" \
     95  1.58    rillig 		'.' 'w' 'q' \
     96  1.58    rillig 	| ed Makefile; \
     97  1.75    rillig 	${MAKE} sync-mi
     98  1.58    rillig 
     99   1.1       cgd .include <bsd.prog.mk>
    100