Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: checking syntax on multiple files

by blue_cowdawg (Monsignor)
on Jan 09, 2013 at 19:44 UTC ( #1012555=note: print w/ replies, xml ) Need Help??

in reply to checking syntax on multiple files

$ cat Makefile all: for pl in $^ ;\ do \ perl -c $$pl ;\ done

Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg

Comment on Re: checking syntax on multiple files
Download Code
Replies are listed 'Best First'.
Re^2: checking syntax on multiple files
by xorl (Deacon) on Jan 09, 2013 at 20:01 UTC

    Thanks, but it isn't quite right.

    if has a problem but is ok, it doesn't stop the install

    Using the filenames from my question. Foo has a syntax error while bar is a ok. This proceeds to install the files when I want to prevent that:

    install: foo bar for pl in $^; do perl -c -Mstrict $$pl; done $(INSTALL) $^ /home/ltharris/tests/makestuf /installdir
    Any other suggestions? Thanks in advance.

      Make only cares about the exit status of the shell; the shell eats them in the for loop. Try perl -c -Mstrict $$pl || exit 1

      (I'm not a make wizard but I might try to create a "perl -c" target for each of the files in question. Well, a transformation rule perhaps. No idea on how to achieve that...)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1012555]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (9)
As of 2015-11-25 15:56 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (682 votes), past polls