next up previous contents index
Next: 6.3.3 An example NEMO Up: 6.3 Building NEMO programs Previous: 6.3.1 Manual pages   Contents   Index


6.3.2 Makefiles

Makefiles are scripts in which "the rules are defined to make targets", see make(1) for many more details. In other words, the Makefile tells how to compile and link libraries and programs. NEMO uses Makefiles extensively for installation, updates and various other system utilities. Sometimes scripts are also available to perform tasks that can be done by a Makefile.

There are basically three types of Makefiles in NEMO:

1. The first (top) level Makefile. It lives in NEMO's root directory (normally referred to as $NEMO) and can steer installation on any of a number of selected machines, it includes some import and export facilities (tar/shar) and various other system maintenance utilities. At installation it makes sure all directories are present, does some other initialization, and then calls Makefile's one level down to do the rest of the dirty work. The top level Makefile is not of direct concern to an application programmer, nor should it be modified without consent of the NEMO system manager.

2. Second level Makefiles, currently in $NEMO/src and $NEMO/usr, steer the building of libraries and programs by calling Makefiles in subdirectories one more level down. Both this 2nd level Makefile and the one described earlier are solely the responsibility of NEMO system manager. You don't have to be concerned with them, except to know of their existence because your top level Makefile(s) must be callable by one of the second level Makefiles. This interface will be described next.

3. Third level Makefiles live in source or user directories $NEMO/src/topic and $NEMO/usr/name (and possibly below). They steer the installation of user specific programs and libraries, they may update NEMO libraries too. The user writes his own Makefile, he usually splits up his directory in one or more subdirectories, where the real work is done by what we could then call level 4 or even level 5 Makefiles. However, this is completely the freedom of a user. The level 3 Makefiles normally have two kinds of entry points (or 'targets'): the user 'install' targets are used by the user, and make sure this his sources, binaries, libraries, include files etc. are copied to the proper places under $NEMO. The second kind of entry point are the 'nemo' targets and never called by you, the user; they are only called by Makefiles one directory level up from within $NEMO below during the rebuilding process of NEMO, i.e. a user never calls a nemo target, NEMO will do this during its installation. Currently we have NEMO install itself in two phases, resulting in two 'nemo' targets: 'nemo_lib' (phase 1) and 'nemo_bin' (phase 2). A third 'nemo' target must be present to create a lookup table of directories and targets for system maintenance. This target must be called 'nemo_src', and must also call lower level Makefiles if applicable.

This means that user Makefiles MUST have at least these three targets in order to rebuild itself from scratch. In case a user decides to split up his directories, the Makefiles must also visit each of those directories and make calls through the same entry points 'nemo_lib' and 'nemo_bin', 'nemo_src'; a sort of hierarchical install process.

For more details see the template Makefiles in NEMO's sec subdirectories and the example below in section [*].

We expect a more general install mechanism with a few more strict rules for writing Makefiles, in some next release of NEMO.


next up previous contents index
Next: 6.3.3 An example NEMO Up: 6.3 Building NEMO programs Previous: 6.3.1 Manual pages   Contents   Index
(c) Peter Teuben