Next: , Previous: Tags, Up: Miscellaneous


18.2 Handling new file extensions

It is sometimes useful to introduce a new implicit rule to handle a file type that Automake does not know about.

For instance, suppose you had a compiler that could compile .foo files to .o files. You would simply define an suffix rule for your language:

     .foo.o:
             foocc -c -o $@ $<

Then you could directly use a .foo file in a _SOURCES variable and expect the correct results:

     bin_PROGRAMS = doit
     doit_SOURCES = doit.foo

This was the simpler and more common case. In other cases, you will have to help Automake to figure which extensions you are defining your suffix rule for. This usually happens when your extensions does not start with a dot. Then, all you have to do is to put a list of new suffixes in the SUFFIXES variable before you define your implicit rule.

For instance, the following definition prevents Automake to misinterpret ‘.idlC.cpp:’ as an attempt to transform .idlC files into .cpp files.

     SUFFIXES = .idl C.cpp
     .idlC.cpp:
             # whatever

As you may have noted, the SUFFIXES variable behaves like the .SUFFIXES special target of make. You should not touch .SUFFIXES yourself, but use SUFFIXES instead and let Automake generate the suffix list for .SUFFIXES. Any given SUFFIXES go at the start of the generated suffixes list, followed by Automake generated suffixes not already in the list.