Extend the lint handling a bit.

o Make it possible to prevent parts of the tree from being linted
  (say) during a 'make world' by setting NOLINT in a leaf Makefile.

o Make "make lint" work (better) for executable programs.

o Clean up (nuke!) a syntax damaged pipeline.
This commit is contained in:
markm 2002-09-20 19:32:51 +00:00
parent 2539e3d8a0
commit e9da443a09
3 changed files with 14 additions and 6 deletions

View File

@ -204,7 +204,7 @@ lib${LIB}_pic.a: ${SOBJS}
${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 @@ _libinstall:
${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 @@ realinstall: _maninstall
.if !target(lint)
lint: ${SRCS:M*.c}
${LINT} ${LINTOBJFLAGS} ${CFLAGS:M-[DIU]*} ${.ALLSRC}
${LINT} ${LINTFLAGS} ${CFLAGS:M-[DIU]*} ${.ALLSRC}
.endif
.if !defined(NOMAN)

View File

@ -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 @@ realinstall: _maninstall
.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

View File

@ -176,6 +176,14 @@ HTAGSFLAGS=
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}