help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: using if statement


From: Don Hinton
Subject: Re: using if statement
Date: Fri, 4 May 2007 09:04:15 -0500
User-agent: KMail/1.9.6

On Friday 04 May 2007 08:22:36 Satish Somasundaram wrote:
> Hi,
>
>             I just tried this. But the compilation does not stop.
>
> Is there any other way of achieving this?

Here's an example of how I handle dependencies which includes recursive 
makefiles.  In our actual projects, we have these rules in makefiles we 
include and only set a couple of variables, e.g., MKLIST or SUBDIRS.

https://research.isis.vanderbilt.edu/ir_wiki/GNU_make_examples

hth...
don

>
>
> rgds,
> Satish
>
> On 5/4/07, Eli Zaretskii <address@hidden> wrote:
> > > Date: Thu, 3 May 2007 18:58:46 +0530
> > > From: "Satish Somasundaram" <address@hidden>
> > >
> > >      I have an recursive make file to invoke all Makefiles in the
> > > subdirectories. But i want the execution to stop when we encounter an
> >
> > error
> >
> > > in any of the sub directories. I thought of using if [ $? -ne 0 ] trap
> >
> > .But
> >
> > > i belive it wont work, since Makefile already has $? defined for a
> >
> > different
> >
> > > cause. Can someone help me out with this.
> > >
> > > all:
> > >
> > >            for dir in `$(SUB_DIRS)`; do \
> > >            $(MAKE) -C $$dir; \
> > >            done
> >
> > Does the following (100% untested) modification work?
> >
> >            for dir in `$(SUB_DIRS)`; do \
> >            $(MAKE) -C $$dir || (echo "ERROR" && exit 1); \
> >            done



-- 
Don Hinton <don.hinton at vanderbilt.edu> or <hintonda at gmail.com>
Institute for Software Integrated Systems (ISIS), Vanderbilt University
tel: 615.480.5667 or 615.870.9728

Attachment: pgpk7i4gmNsoz.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]