[Top][All Lists]

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

Re: export not working...

From: Christopher J Bottaro
Subject: Re: export not working...
Date: Wed, 21 Jan 2004 10:14:36 -0600
User-agent: KMail/1.5

hmm, how about if i do this then...

export MYVAR = DEBUG
        cd $@ && $(MAKE)

that doesn't work either.  make says "commands commence before first target".  
what am i doing wrong?  the make syntax is not tabbed, only the command is...

on another note, how would one do a recursive make clean without using a shell 
for loop?  right now i have it like this:

        @for d in $(SUBDIRS); do \
                cd $dd && $(MAKE) clean || exit 1; \

but what is the "correct" way to do this?

thank for the help.

On Tuesday 20 January 2004 11:22 pm, Paul D. Smith wrote:
> %% Christopher J Bottaro <address@hidden> writes:
>   cjb> i'm trying to do a recursive make, but the variables i export are
>   cjb> not being seen by the sub makes.
>   cjb> SUBDIRS = blah...
>   cjb> $(SUBDIRS):
>   cjb>        @if [ $(ARCH) = LINUX ]; then \
>   cjb>                export MYVAR = DEBUG; \
>   cjb>        fi
>   cjb>        cd $@ && $(MAKE)
>   cjb> when the sub make runs, MYVAR is not defined.  what am i doing
> wrong?
> You are confusing shell syntax, which is what command scripts are
> written in, with makefile syntax.  You can't mix shell commands and make
> commands together in the same command like that.
> Every line (well, there are some exceptions but it's best to not take
> advantage of them) that begins with a TAB is not interpreted by make at
> all, except to expand variable references; instead it's passed to the
> shell.
> Every line that does not begin with a TAB is considered a make command
> line, and is interpreted by make before make starts to process any
> rules.
> Here:
>       @if [ $(ARCH) = LINUX ]; then \
>               export MYVAR = DEBUG; \
>       fi
> you are trying to stick a make command (the export) into the middle of a
> shell script (the if statement).  You can't do that.

Christopher J Bottaro
Software Developer
GeoCenter, Inc

reply via email to

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