How to make a makefile terminate

How to make a makefile terminate

Post by Kza W » Fri, 09 Nov 2001 16:36:35



Hi, I have a complicated series of steps involved in compiling a set
of files, not all source code, some are custom files that get parsed
by a preprocessor.

Anyway, make is confusing me.  Lets assume, I have an .alpha file and
I want to preprocess it into a .beta file.

The first step is my custom proprocessor turning the .alpha into a
.beta.  Each subsequent step depends on the .beta.

When my preprocessor fails, make knows this and says:

make: Fatal error: Command failed for target `rdfFullTest.beta'
I would have expected make to stop there and give up, but it doesn't
it goes on to the next step, which depends on the .beta.

Is there a way to force make to quit? Like reading an exit code or
something?

By the way I am using sun workshop make, and its hard to find the
answer to this simple question on the internet.

Thanks

 
 
 

How to make a makefile terminate

Post by Ben Pfaf » Fri, 09 Nov 2001 16:38:04



> Anyway, make is confusing me.  Lets assume, I have an .alpha file and
> I want to preprocess it into a .beta file.

This question is not on-topic in comp.lang.c, so please drop
comp.lang.c from followups.
--
"Let others praise ancient times; I am glad I was born in these."
--Ovid (43 BC-18 AD)

 
 
 

How to make a makefile terminate

Post by Jens.Toerr.. » Fri, 09 Nov 2001 21:05:27



Quote:> Hi, I have a complicated series of steps involved in compiling a set
> of files, not all source code, some are custom files that get parsed
> by a preprocessor.
> Anyway, make is confusing me.  Lets assume, I have an .alpha file and
> I want to preprocess it into a .beta file.
> The first step is my custom proprocessor turning the .alpha into a
> .beta.  Each subsequent step depends on the .beta.
> When my preprocessor fails, make knows this and says:
> make: Fatal error: Command failed for target `rdfFullTest.beta'
> I would have expected make to stop there and give up, but it doesn't
> it goes on to the next step, which depends on the .beta.
> Is there a way to force make to quit? Like reading an exit code or
> something?
> By the way I am using sun workshop make, and its hard to find the
> answer to this simple question on the internet.

I have never worked with sun workshop make so I don't know if the following
will help you. But, usually, if you have a file A that depends on B, which
in turn depends on  file C you would have rules like the following in your
makefile:

A: B
    commands that creates A from B

B: C
    commands that creates B from C

This tells make when trying to create A to look for a method to create B
first, thus invoking the second rule. Now if the creation of B from C
fails make will stop because it can't create the file on which A depends.

I don't know if this answers your question, but without actually seeing your
makefile it's hard to figure out what's going wrong in your case.

                                         Regards, Jens
--
      _  _____  _____

  _  | |  | |    | |          AG Moebius, Institut fuer Molekuelphysik
 | |_| |  | |    | |          Fachbereich Physik, Freie Universitaet Berlin
  \___/ens|_|homs|_|oerring   Tel: ++49 (0)30 838 - 53394 / FAX: - 56046

 
 
 

How to make a makefile terminate

Post by Dan P » Fri, 09 Nov 2001 21:01:34



Quote:>By the way I am using sun workshop make, and its hard to find the
>answer to this simple question on the internet.

And the idea that comp.unix.solaris was the right place for your question
was, obviously, too subtle for you.

Dan
--
Dan Pop
CERN, IT Division

Mail:  CERN - IT, Bat. 31 1-014, CH-1211 Geneve 23, Switzerland

 
 
 

How to make a makefile terminate

Post by Andrew Giert » Fri, 09 Nov 2001 21:03:27


[comp.lang.c snipped because they are an irritable lot]

 Kza> When my preprocessor fails, make knows this and says:

 Kza> make: Fatal error: Command failed for target `rdfFullTest.beta'
 Kza> I would have expected make to stop there and give up, but it
 Kza> doesn't it goes on to the next step, which depends on the .beta.

post the simplest makefile you have that illustrates the problem.

--
Andrew.

comp.unix.programmer FAQ: see <URL: http://www.erlenstar.demon.co.uk/unix/>
                           or <URL: http://www.whitefang.com/unix/>

 
 
 

How to make a makefile terminate

Post by Paul D. Smit » Fri, 09 Nov 2001 23:56:25



  kw> Anyway, make is confusing me.  Lets assume, I have an .alpha file and
  kw> I want to preprocess it into a .beta file.

  kw> The first step is my custom proprocessor turning the .alpha into a
  kw> .beta.  Each subsequent step depends on the .beta.

  kw> When my preprocessor fails, make knows this and says:

  kw> make: Fatal error: Command failed for target `rdfFullTest.beta'

  kw> I would have expected make to stop there and give up, but it doesn't
  kw> it goes on to the next step, which depends on the .beta.

There's no way we can answer your question unless you provide more
information, such as a sample makefile showing the problem.  Given the
information you've provided, assuming your makefile is correctly written
to reflect your intent, make should not (and does not) build ".beta".

So, there must be important details in your situation that you've not
communicated here.

--
-------------------------------------------------------------------------------

 http://www.gnu.org                      http://www.paulandlesley.org/gmake/
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

 
 
 

How to make a makefile terminate

Post by Chuck Dillo » Sat, 10 Nov 2001 01:10:36



> make: Fatal error: Command failed for target `rdfFullTest.beta'
> I would have expected make to stop there and give up, but it doesn't
> it goes on to the next step, which depends on the .beta.

'Fatal error' means fatal, whatever make process generated that message
terminated soon after.  If the process continues it's whatever called this
fatally wounded make that is continuing.

-- ced

--
Chuck Dillon
Senior Software Engineer
Accelrys Inc., a subsidiary of Pharmacopeia, Inc.

 
 
 

How to make a makefile terminate

Post by Kza W » Sat, 10 Nov 2001 15:21:41



Quote:> So, there must be important details in your situation that you've not
> communicated here.

Thanks everyone, someone here at work actually helped me.  For some
reason there was a - leading the command line for calling the
preprocessor, this makes make NOT terminate.  Interesting that I
couldn't find this documented anywhere.

Thanks all.

Kza

 
 
 

How to make a makefile terminate

Post by Andrew Giert » Sat, 10 Nov 2001 21:08:26


 Kza> Thanks everyone, someone here at work actually helped me.  For
 Kza> some reason there was a - leading the command line for calling
 Kza> the preprocessor, this makes make NOT terminate.  Interesting
 Kza> that I couldn't find this documented anywhere.

It's documented in every manpage for make(1) that I've ever read, and
in every tutorial on make that I've seen, and in the SUS specs.

Here's the relevent part of the Solaris 7 manpage for make:

     -         make ignores any nonzero error code returned by  a
               command line for which the first non-TAB character
               is a `-'. This character  is  not  passed  to  the
               shell  as part of the command line. make  normally
               terminates when a command returns nonzero  status,
               unless  the  -i  or  -k  options,  or the .IGNORE:
               special-function target is in effect.

--
Andrew.

comp.unix.programmer FAQ: see <URL: http://www.erlenstar.demon.co.uk/unix/>
                           or <URL: http://www.whitefang.com/unix/>

 
 
 

1. Terminating parent vs terminating children

Hello all,

Consider the following situation:

A parent process allocates a set of semaphores. It then begins to
spawn children (which use the semaphores). The semaphores are
a global resource and so need to be explicitly destroyed; however
if a *child* process destroys them accidentally then things could
get nasty. So the question becomes: where is the best place to
clean up?

There seem to be two places to put cleanup code: in exit
procedures, which are installed using atexit(), and in signal
functions. In the code that I am patching, the signal functions
for SIGTERM, SIGTRAP, SIGQUIT and SIGINT etc all call
exit() and so atexit() would seem like a good idea. However,
I think I am correct in saying that both signal handlers and
exit procedures are inherited by child processes.

I *could* do the following:

int child_pid = -1;
atexit(MainCleanupProcess);
...
child_pid = fork();
if (child_pid==0)
{
  atexit(CleanupChildProcess);
  ...

with

void MainCleanupProcess(void)
{
  if (child_pid != 0)
  {
    /* destroy semaphores */
  }

but I can't shake the feeling that there is probably a better
way of doing this. Can anyone shed any light, please?
(Using portable UNIX...)

Thanks in advance,
Chris.

2. slow isp connection

3. Imake making bad Makefiles

4. GASP problems

5. Makefile not making

6. aha152x=0x340,10,7 doesn't work

7. making Makefiles

8. CERN 3.0 mkdir... can`t?

9. diff -rcN ups-2.45.2/Makefile ups/Makefile

10. sed/awk - generating Makefiles (Re: awk processing of Makefile macros)

11. GCC: "makefile" not "Makefile"?

12. cvs commit: ports/java Makefile ports/java/forte Makefile distinfo (fwd)

13. prototype Makefiles - sharing Makefiles between projects