[Top][All Lists]

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

Communicating Variables to a Sub-make

From: Martin d'Anjou
Subject: Communicating Variables to a Sub-make
Date: Tue, 17 Sep 2002 16:03:16 -0400 (EDT)

Hi everyone,

I try to understand how variables are passed to sub-make. In the Makefile
below, target "c"  below is scheduled for later execution by target "b".

all: b

export BAR=one
        @echo Target b FOO: $(FOO)
        @echo Target b BAR $(BAR)
        @echo Target b OTHER: $(OTHER)
        @echo Target b MAKEFLAGS: $(MAKEFLAGS)
        rsh hostA "echo 'make c FOO=sweet' | at now + 1 minute"

        @echo Target c FOO: $(FOO) 
        @echo Target c BAR: $(BAR) 
        @echo Target c OTHER: $(OTHER)
        @echo Target c MAKEFLAGS: $(MAKEFLAGS)

% make OTHER=ok BAR=two

Then the following minute I get:
Target c FOO: sweet
Target c BAR: one
Target c OTHER:
Target c MAKEFLAGS: FOO=sweet

How do I get the end result to have BAR=two and OTHER=ok?

I am puzzled because the manual says:

"make automatically passes down variable values that were defined on the
command line, by putting them in the MAKEFLAGS variable."

Can someone explain? I am really tempted at passing $(MAKEFLAGS) like 
this, but it does not work all the time:

rsh hostA "echo 'make c FOO=sweet $(MAKEFLAGS)' | at now + 1 minute"

Martin d'A.

reply via email to

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