Makefile revision 1.86
11.86Srillig#	$NetBSD: Makefile,v 1.86 2021/09/05 16:36:56 rillig Exp $
21.17Sthorpej
31.17Sthorpej.include <bsd.own.mk>
41.1Scgd
51.21StvPROG=		lint1
61.66SrilligSRCS=		cgram.y \
71.82Srillig		ckbool.c ckctype.c ckgetopt.c debug.c \
81.66Srillig		decl.c emit.c emit1.c err.c func.c init.c inittyp.c lex.c \
91.80Srillig		main1.c mem.c mem1.c oper.c scan.l tree.c tyname.c
101.48Schristos
111.21StvMAN=		lint.7
121.21StvYHEADER=
131.69Srillig#DBG=		-g
141.69Srillig#CPPFLAGS+=	-DYYDEBUG=1
151.69Srillig#YFLAGS+=	-v
161.69Srillig#LFLAGS+=	-d
171.19Sthorpej
181.53SjoergCWARNFLAGS.clang+=	-Wno-error=implicit-int-float-conversion
191.63SrilligLINTFLAGS+=		-T
201.69SrilligLOBJS.${PROG}+=		${SRCS:M*.y:.y=.ln}
211.76SrilligLOBJS.${PROG}+=		${SRCS:M*.l:.l=.ln}
221.84SrilligLINTFLAGS.scan.c+=	-X 107,126,330,331,332,333	# strict bool mode
231.86SrilligLINTFLAGS.scan.c+=	-X 162		# comparison of 'unsigned <= 0'
241.86SrilligLINTFLAGS.scan.c+=	-X 192,214	# due to suppressed bool errors
251.86SrilligLINTFLAGS.scan.c+=	-X 307		# static variable unused
261.53Sjoerg
271.67SrilligCPPFLAGS+=	-DIS_LINT1
281.67SrilligCPPFLAGS+=	-I${.CURDIR}
291.81SrilligCPPFLAGS+=	${DEBUG:D-DDEBUG -DYYDEBUG}
301.17Sthorpej
311.70SrilligCOPTS.err.c+=	${${ACTIVE_CC} == "clang":? -Wno-format-nonliteral :}
321.70Srillig
331.21StvBINDIR=		/usr/libexec
341.9Schristos
351.85SrilligCLEANFILES+=	${MAN} ${MAN}.date
361.22Stv
371.22Stv.if ${USETOOLS} == "yes"
381.22StvLINT1=		${TOOLDIR}/libexec/${MACHINE_GNU_PLATFORM}-lint1
391.22Stv.endif
401.22StvLINT1?=		./${PROG}
411.22Stv
421.85Srillig${MAN}.date:	err.c
431.85Srillig	sed -E \
441.85Srillig	    -e 's,.*(....)/([0-9]{2})/0?([0-9]+).*,\2 \3\, \1,' \
451.85Srillig	    -e 's,^01,January,' \
461.85Srillig	    -e 's,^02,February,' \
471.85Srillig	    -e 's,^03,March,' \
481.85Srillig	    -e 's,^04,April,' \
491.85Srillig	    -e 's,^05,May,' \
501.85Srillig	    -e 's,^06,June,' \
511.85Srillig	    -e 's,^07,July,' \
521.85Srillig	    -e 's,^08,August,' \
531.85Srillig	    -e 's,^09,September,' \
541.85Srillig	    -e 's,^10,October,' \
551.85Srillig	    -e 's,^11,November,' \
561.85Srillig	    -e 's,^12,December,' \
571.85Srillig	    -e 1q \
581.85Srillig	    ${.ALLSRC} > ${.TARGET}
591.85Srillig
601.85Srillig${MAN}:		makeman ${LINT1:./%=%} Makefile ${MAN}.date
611.34Slukem	${_MKTARGET_CREATE}
621.85Srillig	${HOST_SH} ${.ALLSRC:M*makeman} "$$(cat ${.ALLSRC:M*.date})" ${LINT1} -m >${.TARGET}
631.1Scgd
641.26SlukemLDADD+=		-lm
651.27Sdbj.ifndef HOSTPROG
661.26SlukemDPADD+=		${LIBM}
671.26Slukem
681.26SlukemLDADD+=		-ll
691.26SlukemDPADD+=		${LIBL}
701.28Slukem.endif
711.24Stv
721.55Srillig.include "Makefile.err-msgs-h"
731.56Srillig${SRCS:Nerr.c}: err-msgs.h
741.46Schristos
751.58Srilligadd-test: .PHONY
761.58Srillig	@set -eu; \
771.58Srillig	test=${NAME:Q}; \
781.58Srillig	[ "$$test" ] || { \
791.58Srillig		echo "usage: ${MAKE} add-test NAME=<name>"; \
801.58Srillig		exit; \
811.58Srillig	}; \
821.58Srillig	\
831.58Srillig	cd '../../../tests/usr.bin/xlint/lint1'; \
841.58Srillig	if [ -f "$$test.c" ]; then \
851.58Srillig		echo "error: test $$test already exists in $$PWD."; \
861.58Srillig		exit 1; \
871.58Srillig	fi; \
881.58Srillig	\
891.58Srillig	echo "=> Adding test $$test"; \
901.58Srillig	printf '%s\n' \
911.58Srillig		'/*	$$''NetBSD$$	*/' \
921.58Srillig		"# 3 \"$$test.c\"" \
931.58Srillig		'' \
941.58Srillig		'/*' \
951.58Srillig		' * TODO: Explain the purpose of the test.' \
961.64Srillig		' */' \
971.58Srillig		'' \
981.79Srillig		'/* lint1-extra-flags: -Z */' \
991.79Srillig		'/* lint1-flags: -Z */' \
1001.79Srillig		'/* lint1-only-if: schar uchar ilp32 lp64 int long */' \
1011.79Srillig		'/* lint1-skip-if: ldbl-64 ldbl-96 ldbl-128 */' \
1021.58Srillig		'' \
1031.58Srillig		'// TODO: Add some code that passes.' \
1041.58Srillig		'// TODO: Add some code that fails.' \
1051.58Srillig	> "$$test.c"; \
1061.58Srillig	> "$$test.exp"; \
1071.58Srillig	cvs add "$$test.c" "$$test.exp"; \
1081.58Srillig	printf '%s\n' \
1091.58Srillig		'/^FILES+=/i' \
1101.58Srillig		"FILES+=		$$test.c" \
1111.58Srillig		"FILES+=		$$test.exp" \
1121.58Srillig		'.' 'w' 'q' \
1131.58Srillig	| ed Makefile; \
1141.75Srillig	${MAKE} sync-mi
1151.58Srillig
1161.1Scgd.include <bsd.prog.mk>
117