%% Gernot Ziegler <[EMAIL PROTECTED]> writes:

  gz> Now my problem is rather ... simple: I wish to use $(OSTYPE) in my
  gz> Makefile, and the code I am using is The funny thing is that a
  gz> simple "make" on my Linux machine (Not on the IRIX, it works there
  gz> with GNU make) doesn't find this OSTYPE env variable, it reports
  gz> it to be empty

  gz> but as soon as I reset the variable with
  gz> [root@c94 texmpeg]# export OSTYPE=linux-gnu

  gz> it works !!

  gz> That's a real weirdie, isn't it ? ;)

I don't know why you think it's weird: you have solved your own problem.

Shell builtin variables like OSTYPE are not exported by default.  They
are defined only in the shell.  So, any program the shell creates,
_including make_, cannot see that value just as it couldn't see any
other non-exported value.

Once you export it, then it becomes visible to subprocesses (BTW, you
don't have to reset the value, just use "export OSTYPE").


But, note that this variable is set by your shell (bash) and is a
shell-specific feature.  That means that if other people use different
shells (sh, csh, tcsh, ksh, etc.) and try to invoke your build
environment, it will fail.

I strongly recommend _against_ using this kind of environment-specific
value in your makefiles.  Try this, for a more portable solution:

  OSTYPE := $(shell uname -msr)

Or season the options to uname to taste.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[EMAIL PROTECTED]>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist


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

Reply via email to