Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Sep 2002 16:59:02 +0100
From:      Mark Murray <mark@grondar.za>
To:        arch@freebsd.org
Subject:   More lint work for share/mk/ (review, please)
Message-ID:  <200209191559.g8JFx27s001093@grimreaper.grondar.org>

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

Hi all

I've been running the attached patches for a while now, and they
allow me to complete make worlds with a commercial lint, a ports
lint and freebsd "base" lint.

<example>
WANT_LINT=     yes
To use a commercial lint, you might put this:
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}\)
... with suitable values in your /etc/make.conf. Some of this is already
present; the patch fixes-and-extends.
</example>

They also allow parts of the tree to be "notlinted". The mechanism
for this may look clunky, and I'll listen to folks who feel that it
needs to be done differently. There are two knobs; WANT_LINT, which
is a make.conf thing, and turns on overall linting. The other is
NOLINT, and this is supposed to be put into individual Makefiles
to kill copious lint output from code out of our control (like
GNU stuff, other contrib/ code and so on).

Comments (remembering this is a no-bikeshed zone!) ?? :-)

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

------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <1090.1032451109.2@grimreaper.grondar.org>
Content-Description: diff

Index: bsd.lib.mk
===================================================================
RCS file: /home/ncvs/src/share/mk/bsd.lib.mk,v
retrieving revision 1.137
diff -u -d -r1.137 bsd.lib.mk
--- bsd.lib.mk	17 Sep 2002 01:48:53 -0000	1.137
+++ bsd.lib.mk	17 Sep 2002 08:33:51 -0000
@@ -204,7 +204,7 @@
 	${RANLIB} ${.TARGET}
 .endif
 
-.if defined(WANT_LINT) && defined(LIB) && !empty(LIB)
+.if defined(WANT_LINT) && !defined(NOLINT) && defined(LIB) && !empty(LIB)
 LINTLIB=	llib-l${LIB}.ln
 _LIBS+=		${LINTLIB}
 LINTOBJS+=	${SRCS:M*.c:.c=.ln}
@@ -273,7 +273,7 @@
 	${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
 	    ${_INSTALLFLAGS} lib${LIB}_pic.a ${DESTDIR}${LIBDIR}
 .endif
-.if defined(WANT_LINT) && defined(LIB) && !empty(LIB)
+.if defined(WANT_LINT) && !defined(NOLINT) && defined(LIB) && !empty(LIB)
 	${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
 	    ${_INSTALLFLAGS} ${LINTLIB} ${DESTDIR}${LINTLIBDIR}
 .endif
@@ -292,7 +292,7 @@
 
 .if !target(lint)
 lint: ${SRCS:M*.c}
-	${LINT} ${LINTOBJFLAGS} ${CFLAGS:M-[DIU]*} ${.ALLSRC}
+	${LINT} ${LINTFLAGS} ${CFLAGS:M-[DIU]*} ${.ALLSRC}
 .endif
 
 .if !defined(NOMAN)
Index: bsd.prog.mk
===================================================================
RCS file: /home/ncvs/src/share/mk/bsd.prog.mk,v
retrieving revision 1.127
diff -u -d -r1.127 bsd.prog.mk
--- bsd.prog.mk	17 Sep 2002 01:48:53 -0000	1.127
+++ bsd.prog.mk	17 Sep 2002 08:33:51 -0000
@@ -3,7 +3,7 @@
 
 .include <bsd.init.mk>
 
-.SUFFIXES: .out .o .c .cc .cpp .cxx .C .m .y .l .s .S .asm
+.SUFFIXES: .out .o .c .cc .cpp .cxx .C .m .y .l .ln .s .S .asm
 
 CFLAGS+=${COPTS} ${DEBUG_FLAGS}
 
@@ -157,9 +157,9 @@
 .endif
 
 .if !target(lint)
-lint: ${SRCS}
+lint: ${SRCS:M*.c}
 .if defined(PROG)
-	${LINT} ${LINTFLAGS} ${CFLAGS:M-[DIU]*} ${.ALLSRC} | more 2>&1
+	${LINT} ${LINTFLAGS} ${CFLAGS:M-[DIU]*} ${.ALLSRC}
 .endif
 .endif
 
Index: bsd.sys.mk
===================================================================
RCS file: /home/ncvs/src/share/mk/bsd.sys.mk,v
retrieving revision 1.10
diff -u -d -r1.10 bsd.sys.mk
--- bsd.sys.mk	7 Jul 2002 18:47:52 -0000	1.10
+++ bsd.sys.mk	12 Sep 2002 20:54:10 -0000
@@ -29,7 +29,7 @@
 .  endif
 # BDECFLAGS
 .  if ${WARNS} > 5
-CFLAGS		+=	-ansi -pedantic -Wbad-function-cast -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls
+CFLAGS		+=	-ansi -pedantic -Wbad-function-cast -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wno-long-long
 .  endif
 .  if ${WARNS} > 1 && ${WARNS} < 5
 # XXX Delete -Wuninitialized by default for now -- the compiler doesn't
Index: sys.mk
===================================================================
RCS file: /home/ncvs/src/share/mk/sys.mk,v
retrieving revision 1.63
diff -u -d -r1.63 sys.mk
--- sys.mk	17 Sep 2002 01:48:54 -0000	1.63
+++ sys.mk	17 Sep 2002 08:33:52 -0000
@@ -132,6 +132,14 @@
 
 # DOUBLE SUFFIX RULES
 
+.c.ln:
+	${LINT} ${LINTOBJFLAGS} ${CFLAGS:M-[DIU]*} ${.IMPSRC} || \
+	    touch ${.TARGET}
+
+.cc.ln .C.ln .cpp.ln .cxx.ln:
+	${LINT} ${LINTOBJFLAGS} ${CXXFLAGS:M-[DIU]*} ${.IMPSRC} || \
+	    touch ${.TARGET}
+
 .c.o:
 	${CC} ${CFLAGS} -c ${.IMPSRC}
 
@@ -175,6 +183,14 @@
 .sh:
 	cp -p ${.IMPSRC} ${.TARGET}
 	chmod a+x ${.TARGET}
+
+.c.ln:
+	${LINT} ${LINTOBJFLAGS} ${CFLAGS:M-[DIU]*} ${.IMPSRC} || \
+	    touch ${.TARGET}
+
+.cc.ln .C.ln .cpp.ln .cxx.ln:
+	${LINT} ${LINTOBJFLAGS} ${CXXFLAGS:M-[DIU]*} ${.IMPSRC} || \
+	    touch ${.TARGET}
 
 .c:
 	${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}

------- =_aaaaaaaaaa0--

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




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