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