[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Does a variable contain the Makefile's name?
From: |
Karl Itschen |
Subject: |
Does a variable contain the Makefile's name? |
Date: |
Thu, 22 Jun 2006 08:56:06 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Hello
I have a makefile called "Makefile-original"
In this file, I would like to make a target choosing between two different
compilers (and corresponding options)
I call it to compile with g++ using
$make -f Makefile-original g++
or
$make -f Makefile-original icc
(to compile with icc)
The file looks like this
--makefile--
<snip lots of stuff>
MAKEFILE = Makefile-original
g++:
$(MAKE) -f $(MAKEFILE) all CC="$(GPP)" CFLAGS="$(GCFLAGS)" LD="$(GPLD)"
LDFLAGS="$(GLDFLAGS)" LIBS="$(GLIBS)" PROG="$(GPROG)"
icc:
$(MAKE) -f $(MAKEFILE) all CC="$(ICC)" CFLAGS="$(ICFLAGS)" LD="$(ILD)"
LDFLAGS="$(ILDFLAGS)" LIBS="$(ILIBS)" PROG="$(IPROG)"
<snip other stuff>
----
Now as you see, I call "make" inside the makefile using $(MAKE) and the
makefile name is passed in as -f $(MAKEFILE). But this has to be hand set in
the makefile. If I change the name of the makefile, it doesn't work anymore (or
needs editing to point to the new makefile name).
So my question is: Is there a variable which contains the name of the makefile
(in shell you would have something like $0 or $1 automatically containing
arguments to the call)?
If not: Is there a more beautiful way to achieve the same result, ie compiling
with different compilers specified at command line?
Thanks for your answers
Karl
- Does a variable contain the Makefile's name?,
Karl Itschen <=