Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Mar 2002 12:24:43 +0000
From:      Mark Murray <mark@grondar.za>
To:        audit@freebsd.org
Subject:   "make lint" diffs (commit candidate)
Message-ID:  <200203111224.g2BCOhDN025023@grimreaper.grondar.org>

next in thread | raw e-mail | index | archive | help
------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <24924.1015849450.1@grimreaper>

Hi

As folks have no doubt noticed, I have been doing some lint work.

I have some local diffs that make this work possible, and I'd like
to share them with the world.

There are the main things to bear in mind when looking at these.

1) I want other lints to be able to work, with suitable additions
   to /etc/make.conf. I use:
#
# Local lint stuff
#
LINT=          /usr/local/bin/flexelint
LINTFLAGS=     -b -zero /etc/lint/co-freebsd.lnt
LINTKERNFLAGS= -b -zero /etc/lint/co-freebsd-kern.lnt
LINTOBJFLAGS=  -u -library -b -zero /etc/lint/co-freebsd.lnt -oo\(${.TARGET}\)
LINTLIBFLAGS=  -u -library -b -zero /etc/lint/co-freebsd.lnt -ol\(${.TARGET}\)

For flexelint, and leave them out for "system" lint.

2) I want "make world" to populate /usr/libdata/lint/ with lint libraries.
   This only works if you turn it on with
WANT_LINT=              yes
   in /etc/make.conf

3) I want "make lint" to work in src/<dir>/<someapplet>

This is quite stable for me, and has been working for a while. I have
recently tidied it up a bit.

YMMV.

Comments?

M
-- 
o       Mark Murray
\_
O.\_    Warning: this .sig is umop ap!sdn

------- =_aaaaaaaaaa0
Content-Type: text/plain; name="lint.diff"; charset="us-ascii"
Content-ID: <24924.1015849450.2@grimreaper>
Content-Description: Lint build fixes

Index: share/mk/bsd.lib.mk
===================================================================
RCS file: /home/ncvs/src/share/mk/bsd.lib.mk,v
retrieving revision 1.101
diff -u -d -r1.101 bsd.lib.mk
--- share/mk/bsd.lib.mk	21 Feb 2002 10:23:41 -0000	1.101
+++ share/mk/bsd.lib.mk	21 Feb 2002 22:40:24 -0000
@@ -54,7 +54,15 @@
 # prefer .s to a .c, add .po, remove stuff not used in the BSD libraries
 # .So used for PIC object files
 .SUFFIXES:
-.SUFFIXES: .out .o .po .So .S .s .c .cc .cpp .cxx .m .C .f .y .l
+.SUFFIXES: .out .o .po .So .S .s .c .cc .cpp .cxx .m .C .f .y .l .ln
+
+.c.ln:
+	${LINT} ${LINTOBJFLAGS} ${CFLAGS:M-[DIU]*} ${.IMPSRC} || \
+		touch ${.TARGET}
+
+.cc.ln .C.ln .cpp.ln .cxx.ln:
+	${LINT} ${LINTOBJFLAGS} ${CFLAGS:M-[DIU]*} ${.IMPSRC} || \
+		touch ${.TARGET}
 
 .c.o:
 	${CC} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
@@ -157,6 +165,14 @@
 .endif
 .endif
 
+LINTOBJS+= ${SRCS:M*.c:C/\..+$/.ln/}
+
+.if defined(WANT_LINT) && defined(LIB) && defined(LINTOBJS) && (${LINTOBJS} != "")
+LINTLIB=llib-l${LIB}.ln
+.else
+LINTLIB=
+.endif
+
 .if defined(SHLIB_NAME)
 _LIBS+=${SHLIB_NAME}
 .endif
@@ -169,9 +185,9 @@
 .endif
 
 .if !defined(NOMAN)
-all: objwarn ${_LIBS} all-man _SUBDIR # llib-l${LIB}.ln
+all: objwarn ${_LIBS} all-man _SUBDIR ${LINTLIB}
 .else
-all: objwarn ${_LIBS} _SUBDIR # llib-l${LIB}.ln
+all: objwarn ${_LIBS} _SUBDIR ${LINTLIB}
 .endif
 
 OBJS+=	${SRCS:N*.h:R:S/$/.o/g}
@@ -219,17 +235,22 @@
 	${RANLIB} lib${LIB}_pic.a
 .endif
 
-llib-l${LIB}.ln: ${SRCS}
-	${LINT} -C${LIB} ${CFLAGS:M-[DIU]*} ${.ALLSRC:M*.c}
+.if defined(WANT_LINT) && defined(LIB) && defined(LINTOBJS) && (${LINTOBJS} != "")
+${LINTLIB}: ${LINTOBJS}
+	@${ECHO} building lint library ${SHLIB_NAME}
+	@rm -f ${LINTLIB}
+	${LINT} ${LINTLIBFLAGS} ${CFLAGS:M-[DIU]*} ${.ALLSRC}
+.endif
 
 .if !target(clean)
 clean:	_SUBDIR
 	rm -f a.out ${OBJS} ${STATICOBJS} ${OBJS:S/$/.tmp/} ${CLEANFILES}
-	rm -f lib${LIB}.a # llib-l${LIB}.ln
+	rm -f lib${LIB}.a ${LINTLIB}
 	rm -f ${POBJS} ${POBJS:S/$/.tmp/} lib${LIB}_p.a
 	rm -f ${SOBJS} ${SOBJS:.So=.so} ${SOBJS:S/$/.tmp/} \
 	    ${SHLIB_NAME} ${SHLIB_LINK} \
 	    lib${LIB}.so.* lib${LIB}.so lib${LIB}_pic.a
+	rm -f ${LINTOBJS} ${LINTLIB}
 .if defined(CLEANDIRS) && !empty(CLEANDIRS)
 	rm -rf ${CLEANDIRS}
 .endif
@@ -323,6 +344,10 @@
 		ln -fs $$l $$t; \
 	done; true
 .endif
+.if defined(WANT_LINT) && defined(LIB) && defined(LINTOBJS) && (${LINTOBJS} != "")
+	${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
+	    ${_INSTALLFLAGS} ${LINTLIB} ${DESTDIR}${LINTLIBDIR}
+.endif
 
 install: afterinstall _SUBDIR
 .if !defined(NOMAN)
@@ -345,8 +370,10 @@
 .endif
 
 .if !target(lint)
-lint:
+lint: ${SRCS:M*.c} _SUBDIR
+	${LINT} ${LINTOBJFLAGS} ${CFLAGS:M-[DIU]*} ${.ALLSRC} | more 2>&1
 .endif
+
 
 .if !defined(NOMAN)
 .include <bsd.man.mk>
Index: share/mk/sys.mk
===================================================================
RCS file: /home/ncvs/src/share/mk/sys.mk,v
retrieving revision 1.56
diff -u -d -r1.56 sys.mk
--- share/mk/sys.mk	31 Aug 2001 12:20:43 -0000	1.56
+++ share/mk/sys.mk	15 Feb 2002 22:54:30 -0000
@@ -76,7 +76,10 @@
 LDFLAGS		?=
 
 LINT		?=	lint
-LINTFLAGS	?=	-chapbx
+LINTFLAGS	?=	-cghapbx -L /usr/libdata/lint
+LINTKERNFLAGS	?=	${LINTFLAGS}
+LINTOBJFLAGS	?=	-cghapbxu -i
+LINTLIBFLAGS	?=	-cghapbxu -C ${LIB}
 
 MAKE		?=	make
 
Index: sys/conf/kern.post.mk
===================================================================
RCS file: /home/ncvs/src/sys/conf/kern.post.mk,v
retrieving revision 1.10
diff -u -d -r1.10 kern.post.mk
--- sys/conf/kern.post.mk	1 Mar 2002 01:21:29 -0000	1.10
+++ sys/conf/kern.post.mk	6 Mar 2002 11:26:05 -0000
@@ -57,6 +57,9 @@
 kernel-clobber:
 	find . -type f ! -name version -delete
 
+lint: ${CFILES}
+	${LINT} ${LINTKERNFLAGS} ${CFLAGS:M-[DILU]*} ${.ALLSRC} | more 2>&1
+
 locore.o: $S/$M/$M/locore.s assym.s
 	${NORMAL_S}
 
Index: sys/conf/kmod.mk
===================================================================
RCS file: /home/ncvs/src/sys/conf/kmod.mk,v
retrieving revision 1.113
diff -u -d -r1.113 kmod.mk
--- sys/conf/kmod.mk	1 Mar 2002 01:21:29 -0000	1.113
+++ sys/conf/kmod.mk	6 Mar 2002 11:03:21 -0000
@@ -338,6 +338,9 @@
 
 regress:
 
+lint: ${SRCS}
+	${LINT} ${LINTKERNFLAGS} ${CFLAGS:M-[DILU]*} ${.ALLSRC:M*.c} | more 2>&1
+
 .include <bsd.dep.mk>
 
 .if !exists(${DEPENDFILE})

------- =_aaaaaaaaaa0--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200203111224.g2BCOhDN025023>