On Wed, Apr 16, 2014 at 08:07:55PM +0400, Vadim Zhukov wrote:
> This is a PoC I'm currently using while hacking at our libtool. What
> I dream about is putting such code in /usr/share/bsd.perl.mk or such,
> allowing to run checks for all Perl-based tools in base.It's better to
> know something is broken at build time rather after install, isn't it?
>
> If idea and actual implementation is approved, I'll prepare and mail
> out a patch for /usr/share/bsd.perl.mk (or whatever) and actual
> Makefiles.
>
> Any recommendations or other comments are welcome. Maybe, this should
> be put in some other file or done differently... Thanks in advance.
> --
> WBR,
> Vadim Zhukov
>
>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/src/usr.bin/libtool/Makefile,v
> retrieving revision 1.7
> diff -u -p -r1.7 Makefile
> --- Makefile 16 Apr 2014 10:31:27 -0000 1.7
> +++ Makefile 16 Apr 2014 15:58:30 -0000
> @@ -37,4 +37,12 @@ realinstall:
> ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
> ${.CURDIR}/libtool ${DESTDIR}${BINDIR}/libtool
>
> +PERLCHECK= libtool ${PACKAGES}
> +.for pm in libtool ${PERLCHECK}
> +CLEANFILES += ${pm:C@/@_@g}.perlcheck
> +all: ${pm:C@/@_@g}.perlcheck
> +${pm:C@/@_@g}.perlcheck: ${pm}
> + rm -f $@; perl -c ${.CURDIR}/${pm} && touch $@
> +.endfor
> +
> .include <bsd.prog.mk>
Nope, doesn't always work. "use" needs to actually eval part of the code,
and so for complicated code, -c will "just" check the syntax and say there
are issues, because there is some code which really really needs the use
to be evaluated to be syntaxicallt correct.