Next: , Previous: , Up: Some example packages   [Index]


17.2 A tricker example

Here is another, trickier example. It shows how to generate two programs (ctags and etags) from the same source file (etags.c). The difficult part is that each compilation of etags.c requires different cpp flags.

bin_PROGRAMS = etags ctags
ctags_SOURCES =
ctags_LDADD = ctags.o
ctags_DEPENDENCIES = ctags.o

etags.o:
        $(COMPILE) -DETAGS_REGEXPS etags.c

ctags.o:
        $(COMPILE) -DCTAGS -o ctags.o etags.c

Note that ctags_SOURCES is defined to be empty – that way no implicit value is substituted. The implicit value, however, is used to generate etags from etags.o.

ctags_LDADD is used to get ctags.o into the link line, while ctags_DEPENDENCIES exists to make sure that ctags.o gets built in the first place.

This is a somewhat pathological example.