lint.mk revision 1.2 1 # $NetBSD: lint.mk,v 1.2 2021/05/02 19:29:30 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:C/^.*$/LintStub_&.c/g}
11 KERNLINTFLAGS?= -bcehnxzFS
12 NORMAL_LN?= ${LINT} ${KERNLINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i $< -o $@
13
14 _lsrc=${CFILES} ${LINTSTUBS} ${MI_CFILES} ${MD_CFILES}
15 LOBJS?= ${_lsrc:T:S/.c$/.ln/g} ${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