Makefile question relating to conditional



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.

.



Relevant Pages

  • gmake dumps core in Solaris 10 (x86 and sparc)
    ... % which gmake ... Configuring GNU shtool, ... GNU gdb 6.3 ... Loaded symbols for /lib/libkstat.so.1 ...
    (comp.unix.solaris)
  • Re: BSD make vs. GNU make
    ... the differences between BSD make and GNU make. ... 'gmake' in some cases instead of just plain 'make'? ... the gnu automake, autoconf, libtools system. ... There's a pretty good book, ``GNU Autoconf, Automake, and ...
    (freebsd-questions)
  • Re: Looking for speed increases in "make index" and pkg_version for ports
    ... functions in GNU make which could help in regards to ports. ... Gmake does not provide the flexibility and power that pmake provides. ...
    (freebsd-hackers)
  • Re: gcc/gnat 3.3
    ... > I only say: Use GNU make. ... > The Makefiles are in some cases using gmake only contructs. ...
    (comp.lang.ada)
  • Re: "stat" like tool for Solaris
    ... In fact it's technically an early beta of Solaris 11 according to uname. ... The package appears to be "SUNWgnu-coreutils". ... Shudder, GNU stuff in /usr/bin. ...
    (comp.unix.solaris)