Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

perl from makefile

by bhasky76 (Initiate)
on Jun 13, 2013 at 07:08 UTC ( #1038692=perlquestion: print w/ replies, xml ) Need Help??
bhasky76 has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks, I am using a makefile to do the following things 1. perl script to parse a C file. Then 2. using gcc to compile the same C file. Now in case there is a gcc compilation error it stops the make utility at that point. But I am unable to stop the make if there is any compilation/runtime error while executing the perl script. Please shed some light.

The makefile is like
@echo Parsing tmp.c; \ perl c_parser.pl arg1 arg2;\ echo Compiling tmp.c;\ gc tmp.c

Comment on perl from makefile
Download Code
Re: perl from makefile
by aitap (Deacon) on Jun 13, 2013 at 07:27 UTC
    This is Makefile question, not a Perl question. Your Makefile says: "run a command consisting of four lines without printing it". Remove backslashes, and you'll have four different commands, and make will be able to stop the execution if Perl parser fails. You can also add set -e; \ before perl ..., this will make the subshell which is running your multi-line command fail if any of the following commands fail.
Re: perl from makefile
by choroba (Abbot) on Jun 13, 2013 at 07:31 UTC
    Makefile stops, if the command returns a non-zero exit status. In a command list (i.e. simple commands separarated by semicolons), the exit status is the status of the last command in the list. You have two options:
    1. Remove the semicolons and backslashes. Make will run each line separately and stop if there is a problem.
    2. Replace each semicolon with a &&. That way, the shell will stop on the first error (short circuiting the "and").
    لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2014-10-02 07:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (50 votes), past polls