1
votes

I have a GNU make makefile with some explicit suffix rules defined which make is not honoring.

Here is the relevant part of the makefile:

#------------------------------------------------------------
# Suffix Targets
#------------------------------------------------------------
.SUFFIXES = .$(C++_SUFFIX) .$(C_SUFFIX) .$(IDL_SUFFIX) .hh .o

.$(IDL_SUFFIX).hh:
        @echo "TARGET   : .$(IDL_SUFFIX).hh"
        @echo "COMPILER : $(IDL)"
        @echo "OPTIONS  : $(IDL_COMPILE_OPTS)"
        $(IDL) $(IDL_COMPILE_OPTS) $*.$(IDL_SUFFIX)
        @echo "COMPILED : $*.hh $*C.$(C++_SUFFIX) $*S.$(C++_SUFFIX)"

.$(C++_SUFFIX).o:
        @echo "TARGET   : .$(C++_SUFFIX).o"
        @echo "COMPILER : $(C++)"
        @echo "OPTIONS  : $(C++_COMPILE_OPTS) $(NO_LINK_PHASE) -o $*.o"
        $(C++) $(C++_COMPILE_OPTS) $(NO_LINK_PHASE) -o $*.o $*.$(C++_SUFFIX)
        @echo "COMPILED : $*.o"

.$(C_SUFFIX).o:
        @echo "TARGET   : .$(C_SUFFIX).o"
        @echo "COMPILER : $(C)"
        @echo "OPTIONS  : $(C_COMPILE_OPTS) $(NO_LINK_PHASE) -o $*.o"
        $(C) $(C_COMPILE_OPTS) $(NO_LINK_PHASE) -o $*.o $*.$(C_SUFFIX)
        @echo "COMPILED : $*.o"

The suffix names are defined earlier in the makefile:

#------------------------------------------------------------
# Suffixes
#------------------------------------------------------------
C++_SUFFIX = cpp
C_SUFFIX   = c
IDL_SUFFIX = idl

However, when make is run it fails to find a sufficient suffix rule to make .hh files from .idl files (The first suffix rule I defined)

Make: Don't know how to make /path/to/example/file.hh.  Stop.

Any help would be appreciated.

1
That leading slash looks wrong to me... unless you have a /file.idl file in the root of your filesystem too.Etan Reisner
Just an example. I'd rather not post the real path. Company rules & all. There is a "file.idl" in the same directory as the "file.hh" dependency which is the source of the error message. I will make the fake path more fakey.Lee Fowler
What does make -d report about the attempt there? Also is there a reason you are using suffix rules instead of pattern rules?Etan Reisner
` look for explicit deps. 1 look for implicit rules. 1 Looking for Single suffix rule. setvar: @ = /vobs/sso/pdm-interface/AIidl/aiPdmStandardPart.hh noreset = 0 envflg = 0 Mflags = 040001 setvar: ? = noreset = 0 envflg = 0 Mflags = 040001 predecessor list: $! = /vobs/sso/pdm-interface/AIidl/aiPdmStandardPart.hh all setvar: @ = /vobs/sso/pdm-interface/AIidl/aiPdmStandardPart.hh noreset = 0 envflg = 0 Mflags = 040001 setvar: ? = noreset = 0 envflg = 0 Mflags = 040001 predecessor list: $! = /vobs/sso/pdm-interface/AIidl/aiPdmStandardPart.hh all`Lee Fowler
Is that supposed to be the output from make -d? Because none of that looks like GNU make output. Are you sure you're using GNU make? Are you, perhaps, using clearmake in GNU make emulation mode? I see your path contains "/vobs"MadScientist

1 Answers

3
votes

For anyone who stumbles upon this in the future, my mistake was, of course, a simple one.

.SUFFIXES is special target, not variable. Therefore, to append to the .SUFFIXES list you use the syntax

.SUFFIXES: .list .of .suffixes 

and not

.SUFFIXES = .list .of .suffixes