Hi,

I'm using version GNU make v3.79.1 on HP-UX 10.20. I'm having a few
problems with a makefile, the root of the problem seems to be connected
with the $(shell) function. I wonder if you could offer any suggestions?

Basically, I want to set an environment variable according to the
contents of a file.

So if the file is

    INFO_FILE = bar.txt

then

    FOO = $(shell cat $(INFO_FILE))

works fine.

Now it gets a little more complicated because the contents of INFO_FILE
get modified during the build, and I only want to evaluate FOO after
INFO_FILE has been modified. However what I'm finding is that if I
modify the contents of INFO_FILE and then evaluate FOO in the same rule,
then FOO uses the *old* contents of INFO_FILE and not the updated
contents. If I move the operations into different rules then FOO
contains the correct information (although obviously I have to ensure
that the rules get evaluted in the correct order)

After reading the GNU Make manual I presume that this is something to do
with $(shell ...) opening a new shell, so I tried forcing everything
into the same shell, i.e.

target.bar:
        update INFO_FILE ; use FOO

But this still doesn't work.

Any ideas?

Tim Mason

--------------------------------------------------------
[EMAIL PROTECTED]

_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/help-make

Reply via email to