简体   繁体   中英

GNU make not recognizing suffix rule

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM