help-make
[Top][All Lists]
Advanced

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

RE: how to redefine variable in makefile


From: Paul D. Smith
Subject: RE: how to redefine variable in makefile
Date: Thu, 5 Oct 2000 13:25:17 -0400

%% Joylene Nettleton <address@hidden> writes:

  >> Try:
  >> 
  >> output_a : input_main
  >> export ORACLE_HOME=oracle-version-a; \
  >> <pre-process command>
  >> 
  >> Or, using a little fancier sh syntax, you can just write:
  >> 
  >> output_a : input_main
  >> ORACLE_HOME=oracle-version-a <pre-process command>

  jn> but got similar error of not being able to set ORACLE_HOME variable:

  jn> export ORACLE_HOME=/dept/databases/oracle/solaris/7.3.4; \
  jn> /bin/proc define=CM_AIX define=_PNMS ...
  jn> /bin/sh: ORACLE_HOME=/dept/databases/oracle/solaris/7.3.4: is not an 
identifier

Ah.

The reason this doesn't work is that GNU make always invokes /bin/sh.
On your system, /bin/sh is a traditional Bourne shell, not ksh or bash
or zsh or a "newer" Bourne or Bourne-like shell.

In traditional Bourne shell, you can't combine the export and variable
setting on the same line like this:

  export FOO=bar

That's illegal.  This error you're seeing is because your /bin/sh
doesn't understand that syntax.  Try it outside of make; you'll see
(this is really a shell issue, not a make issue):

  $ /bin/sh
  $ export FOO=bar
  /bin/sh: FOO=bar: is not an identifier

Change it to this:

  sqoracle734.c : $(SCSRC)/sqoracle.pc
     @rm -f sqoracle734.c
     ORACLE_HOME=$(ORACLE_734); export ORACLE_HOME; \
     $(ORACLE_HOME)/bin/proc $(ORACLE_DEFINES) include=$(UPDATES) ...

(note splitting the export into a separate command) and it should work.

However, my other suggestion will work with all versions of Bourne shell
and is much simpler:

  sqoracle734.c : $(SCSRC)/sqoracle.pc
     @rm -f sqoracle734.c
     ORACLE_HOME=$(ORACLE_734) \
       $(ORACLE_HOME)/bin/proc $(ORACLE_DEFINES) include=$(UPDATES) ...

(note NO semicolon!!)

If it didn't work for you you'll have to send the exact error message,
because it's definitely not the same problem as the error you quoted
above.

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



reply via email to

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