A.5. Secondary GNUmakefiles

The TOM makefiles employ a file named GNUmakefile.link to list extra objects and libraries needed by the unit being built. The GNUmakefile.link is created by running the $(TOMMAKEFILES_DIR)/genlinkfile shell script. genlinkfile tries to locate all unit files in the $(LINK_UNITS) along the $(UNIT_PATH), including the corresponding .la (libtool archive) files. When a unit is found but the archive isn't, as is the case with the installed TOM standard units, the name of a library directory is constructed in such a way that also the TOM standard units can be found in their installed place.

genlinkfile emits, for each unit found, lines that add to the following macros:


Directives (-l and -L) to have the linker link with the unit's library archive.


Files that the unit being built depends upon, suitable for use as a makefile dependency.

In addition, each unit can be accompanied by a GNUmakefile.unit; for every unit used, that makefile is included by the GNUmakefile.link. These GNUmakefile.unit files can add command line arguments to the linking phase of the unit being built:


Linker arguments; UF_PRE_LIBS will precede all units' UF_POST_LIBS. This is, for example, used by a library that provides an abstraction of X11 and that uses AC_PATH_XTRA from autoconf AC_PATH_EXTRA sets X_PRE_LIBS, X_LIBS, and X_EXTRA_LIBS, and the library's GNUmakefile.unit.in will look like this: