lint.mk revision 1.5 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
9 ALLSFILES?= ${MD_SFILES} ${SFILES}
10 LINTSTUBS?= ${ALLSFILES:T:R:%=LintStub_%.c}
11 KERNLINTFLAGS?= -bceghnxzFS
12 NORMAL_LN?= ${LINT} ${KERNLINTFLAGS} ${CPPFLAGS:M-[IDU]*} -o $@ -i $<
13
14 _lsrc= ${CFILES} ${LINTSTUBS} ${MI_CFILES} ${MD_CFILES}
15 LOBJS?= ${_lsrc:T:.c=.ln} ${LIBKERNLN} ${SYSLIBCOMPATLN}
16
17 .for sfile in ${ALLSFILES}
18 LintStub_${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
30 lint: ${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.
38 syntax-only: ${CFILES} ${MD_CFILES}
39 ${CC} -fsyntax-only -combine ${CFLAGS} ${CPPFLAGS} \
40 ${CFILES} ${MD_CFILES}
41