Some glue to allow lint(1) to work on the kernel. This is not
complete without some config(8) work. Config(8) needs to provide some ${NORMAL_LINT} rules to make foo.ln files.
This commit is contained in:
parent
5155733cbd
commit
90e71b610d
@ -74,6 +74,8 @@ ${FULLKERNEL}: ${SYSTEM_DEP} vers.o
|
||||
${SYSTEM_OBJS}: assym.s miidevs.h vnode_if.h ${BEFORE_DEPEND:M*.h} ${MFILES:T:S/.m$/.h/}
|
||||
.endif
|
||||
|
||||
LNFILES= ${CFILES:T:S/.c$/.ln/}
|
||||
|
||||
.for mfile in ${MFILES}
|
||||
# XXX the low quality .m.o rules gnerated by config are normally used
|
||||
# instead of the .m.c rules here.
|
||||
@ -90,8 +92,9 @@ kernel-clean:
|
||||
${MFILES:T:S/.m$/.c/} ${MFILES:T:S/.m$/.h/} \
|
||||
${CLEAN}
|
||||
|
||||
lint: ${CFILES}
|
||||
${LINT} ${LINTKERNFLAGS} ${CFLAGS:M-[DILU]*} ${.ALLSRC}
|
||||
lint: ${LNFILES}
|
||||
${LINT} ${LINTKERNFLAGS} ${CFLAGS:M-[DILU]*} ${.ALLSRC} \
|
||||
2>&1 | tee -a linterrs
|
||||
|
||||
# This is a hack. BFD "optimizes" away dynamic mode if there are no
|
||||
# dynamic references. We could probably do a '-Bforcedynamic' mode like
|
||||
@ -206,12 +209,21 @@ kernel-reinstall:
|
||||
config.o:
|
||||
${NORMAL_C}
|
||||
|
||||
config.ln:
|
||||
${NORMAL_LINT}
|
||||
|
||||
env.o: env.c
|
||||
${NORMAL_C}
|
||||
|
||||
env.ln: env.c
|
||||
${NORMAL_LINT}
|
||||
|
||||
hints.o: hints.c
|
||||
${NORMAL_C}
|
||||
|
||||
hints.ln: hints.c
|
||||
${NORMAL_LINT}
|
||||
|
||||
vers.c: $S/conf/newvers.sh $S/sys/param.h ${SYSTEM_DEP}
|
||||
sh $S/conf/newvers.sh ${KERN_IDENT}
|
||||
|
||||
@ -220,6 +232,9 @@ vers.c: $S/conf/newvers.sh $S/sys/param.h ${SYSTEM_DEP}
|
||||
vers.o:
|
||||
${NORMAL_C}
|
||||
|
||||
vers.ln:
|
||||
${NORMAL_LINT}
|
||||
|
||||
vnode_if.c: $S/tools/vnode_if.awk $S/kern/vnode_if.src
|
||||
${AWK} -f $S/tools/vnode_if.awk $S/kern/vnode_if.src -c
|
||||
|
||||
@ -229,10 +244,16 @@ vnode_if.h: $S/tools/vnode_if.awk $S/kern/vnode_if.src
|
||||
vnode_if.o:
|
||||
${NORMAL_C}
|
||||
|
||||
vnode_if.ln:
|
||||
${NORMAL_LINT}
|
||||
|
||||
majors.c: $S/conf/majors $S/conf/majors.awk
|
||||
${AWK} -f $S/conf/majors.awk $S/conf/majors > majors.c
|
||||
|
||||
majors.o:
|
||||
${NORMAL_C}
|
||||
|
||||
majors.ln:
|
||||
${NORMAL_LINT}
|
||||
|
||||
.include "kern.mk"
|
||||
|
@ -14,6 +14,7 @@ KODIR?= /boot/${KERNEL}
|
||||
M= ${MACHINE_ARCH}
|
||||
|
||||
AWK?= awk
|
||||
LINT?= lint
|
||||
NM?= nm
|
||||
OBJCOPY?= objcopy
|
||||
SIZE?= size
|
||||
@ -54,6 +55,9 @@ WERROR?= -Werror
|
||||
# can override the others.
|
||||
CFLAGS+= ${CONF_CFLAGS}
|
||||
|
||||
# Optional linting. This can be overridden in /etc/make.conf.
|
||||
LINTFLAGS= ${LINTOBJKERNFLAGS}
|
||||
|
||||
NORMAL_C= ${CC} -c ${CFLAGS} ${WERROR} ${PROF} ${.IMPSRC}
|
||||
NORMAL_S= ${CC} -c ${ASM_CFLAGS} ${WERROR} ${.IMPSRC}
|
||||
PROFILE_C= ${CC} -c ${CFLAGS} ${WERROR} ${.IMPSRC}
|
||||
@ -62,6 +66,8 @@ NORMAL_C_NOWERROR= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC}
|
||||
NORMAL_M= ${AWK} -f $S/tools/makeobjops.awk ${.IMPSRC} -c ; \
|
||||
${CC} -c ${CFLAGS} ${WERROR} ${PROF} ${.PREFIX}.c
|
||||
|
||||
NORMAL_LINT= ${LINT} ${LINTFLAGS} ${CFLAGS:M-[DIU]*} ${.IMPSRC}
|
||||
|
||||
GEN_CFILES= $S/$M/$M/genassym.c
|
||||
SYSTEM_CFILES= config.c env.c hints.c majors.c vnode_if.c
|
||||
SYSTEM_DEP= Makefile ${SYSTEM_OBJS}
|
||||
|
Loading…
x
Reference in New Issue
Block a user