xref: /netbsd-src/sys/conf/lint.mk (revision ec77a15a7f20df1bc234723ab429ff88ac69c16c)
1# $NetBSD: lint.mk,v 1.5 2022/08/27 21:49:33 rillig Exp $
2
3##
4## lint
5##
6
7.if !target(lint)
8.PATH: $S
9ALLSFILES?=	${MD_SFILES} ${SFILES}
10LINTSTUBS?=	${ALLSFILES:T:R:%=LintStub_%.c}
11KERNLINTFLAGS?=	-bceghnxzFS
12NORMAL_LN?=	${LINT} ${KERNLINTFLAGS} ${CPPFLAGS:M-[IDU]*} -o $@ -i $<
13
14_lsrc=		${CFILES} ${LINTSTUBS} ${MI_CFILES} ${MD_CFILES}
15LOBJS?=		${_lsrc:T:.c=.ln} ${LIBKERNLN} ${SYSLIBCOMPATLN}
16
17.for sfile in ${ALLSFILES}
18LintStub_${sfile:T:R}.c: ${sfile} assym.h
19	${_MKTARGET_COMPILE}
20	${CC} -E -C ${AFLAGS} ${CPPFLAGS} ${sfile} | \
21	      ${TOOL_AWK} -f $S/kern/genlintstub.awk >${.TARGET}
22.endfor
23
24.for cfile in ${CFILES} ${LINTSTUBS} ${MI_CFILES} ${MD_CFILES}
25${cfile:T:R}.ln: ${cfile}
26	${_MKTARGET_COMPILE}
27	${NORMAL_LN}
28.endfor
29
30lint: ${LOBJS}
31	${LINT} ${KERNLINTFLAGS} ${CPPFLAGS:M-[IDU]*} ${LOBJS}
32.endif
33
34# XXX who uses this?
35# Attempt to do a syntax-only compile of the entire kernel as one entity.
36# Alas, bugs in the GCC C frontend prevent this from completely effective
37# but information can be gleaned from the output.
38syntax-only: ${CFILES} ${MD_CFILES}
39	${CC} -fsyntax-only -combine ${CFLAGS} ${CPPFLAGS} \
40		${CFILES} ${MD_CFILES}
41