Makefile question relating to conditional
- From: hzmonte@xxxxxxxxxxx
- Date: 23 Sep 2005 22:40:06 -0700
I inherit a Makefile that has the following rule:
target: main.c
if ( `uname` == "SunOS" ) $(CC) $(CFLAGS) $(LDFLAGS_SOL)
main.c $(DEBUGOBJ) -o main
if ( `uname` == "Linux" ) $(CC) $(CFLAGS) $(LDFLAGS_LINUX)
main.c $(DEBUGOBJ) -o main
It is to be run by GNU gmake, and it does seem to run okay.
But I am not able to see anywhere in the GNU Make manual that says
gmake supports an if conditional with the above syntax. It supports
ifeq, ifneq, etc, but not if(...==...). Is this an undocumented
feature of gmake?
And I am not able to find in the manual what 'xxx' and "xxx" means.
Apparently 'uname' above returns the output of the uname command. But
I am not able to see anywhere in the manual that documents that
anything inside single quotes is to be expanded as a shell command. Is
it another undocumented feature?
And I want to factor out the LDFLAGS. So I try to do the following:
ifeq ('uname', "SunOS")
LDFLAGS = $(LDFLAGS_SOL)
else
ifeq ('uname', "Linux")
LDFLAGS = $(LDFLAGS_SOL)
endif
endif
It does NOT work. And it appears 'uname' returns "uname" in this case.
Section 7.2 of the GNU Make manual gives the following ifeq syntax,
without explaining what 'arg1' and "arg1" mean:
ifeq (arg1, arg2)
ifeq 'arg1' 'arg2'
ifeq "arg1" "arg2"
ifeq "arg1" 'arg2'
ifeq 'arg1' "arg2"
Indeed the manual says nothing about the difference among these five
alternatives.
Can anyone explain all the above? Thank you.
.
- Prev by Date: Re: GNU Public Licences Revisited (again)
- Next by Date: Re: virtual addresses
- Previous by thread: virtual addresses
- Next by thread: Persistency frameworks ?
- Index(es):
Relevant Pages
|
|