Subj : Re: Makefile question relating to conditional To : comp.programming From : William Date : Sun Sep 25 2005 12:49 pm "Willem" wrote in message news:slrndja7ia.2kgp.willem@toad.stack.nl... > hzmonte@hotmail.com wrote: > ) 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. > > Plain vanilla make will run it fine as well. > > ) 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? > > 'if' is not part of gmake. It is part of sh. gmake (or make) just runs > the whole line as a command. Try typing the following on your commandline: It's not part of sh (bourn shell, ksh, bash, etc.) either, it's c shell syntax. Bourne shell syntax would be something like: if [ `uname` = "SunOS" ] ; then $(CC) $(CFLAGS) $(LDFLAGS_SOL) or [ `uname` = "SunOS" ] && $(CC) $(CFLAGS) $(LDFLAGS_SOL) -Wm .