Suffix rules in Makefile

Jon Drews jon.drews at gmail.com
Mon May 2 07:56:37 PDT 2005


5.4-STABLE #0: Sun Apr 24 08:30:32 MDT 2005


Hi:

  I am having trouble with a .SUFFIXES based Makefile. If I use this
Makefile containing .out:

INCLUDES= -Wall -I/usr/local/include
LINK= -L/usr/local/lib
LIBS= -lgsl -lgslcblas -lm
.SUFFIXES : .c .o .out

.o.out:
        ${CC} ${LINK} -o $@ $< ${LIBS}

.c.o:
        ${CC} ${INCLUDES} -c $<

$ make complexPow.out
cc -O2 -pipe -march=pentiumpro  complexPow.c  -o complexPow.out
complexPow.c:4:29: gsl/gsl_complex.h: No such file or directory
                         <snip>
it's not finding it's includes.

However if I change the .out extension to .OUT it works:

INCLUDES= -Wall -I/usr/local/include
LINK= -L/usr/local/lib
LIBS= -lgsl -lgslcblas -lm
.SUFFIXES : .c .o .OUT

.o.OUT:
        ${CC} ${LINK} -o $@ $< ${LIBS}

.c.o:
        ${CC} ${INCLUDES} -c $<

$ make complexPow.OUT
cc -Wall -I/usr/local/include -c complexPow.c
cc -L/usr/local/lib -o complexPow.OUT complexPow.o -lgsl -lgslcblas -lm

  Why does the .SUFFIXES definition for .out, in the first Makefile
not work? I looked in /usr/share/mk/sys.mk and did not see a
definition for .o.out either.
-- 
Kind regards,
Jonathan


More information about the freebsd-questions mailing list