next up previous contents
Next: lib/make/make.subdir Up: Make files Previous: lib/make/make.configuration   Contents


lib/make/make.thornlib

This makefile is responsible for producing a library from the contents of a thorn's source directory.

In each source directory of a thorn the author may put two files.

  • make.code.defn This should contain a line
    SRCS =
    
    which lists the names of source files in that directory.
  • make.code.deps This is an optional file which gives standard make dependency rules for the files in that directory.

In addition the thorn's top-level make.code.defn file can contain a line

SUBDIRS =

which lists all subdirectories of the thorn's src directory which contain files to be compiled.

To process the subdirectories the makefile runs the sub-makefile make.subdir in each subdirectory.

Once that is done it compiles files in the src directory and then all the object files into a library which is named by the NAME make-variable.

All object files are compiled by the rules given in make.config.rules.

Since the make language doesn't contain looping constructions it is a bit tricky to construct the full list of object files. To do this the makefile uses the GNU make foreach function to include all the subdirectory make.code.defn files, along with two auxiliary files make.pre and make.post which are included respectively before and after each make.code.defn file. These auxiliary files allow the SRCS variables set in the make.code.defn files to be concatanated onto one make variable CCTK_SRCS.

Extensive use is made of the two different flavours of variable (simply-expanded and recursively-expanded) available within GNU make.

The GNU `-include' construct is used to suppress warnings when an optional file is not available.


next up previous contents
Next: lib/make/make.subdir Up: Make files Previous: lib/make/make.configuration   Contents