Getting Started | Documentation | Glish | Learn More | Programming | Contact Us |
Version 1.9 Build 1556 |
|
The app, imp, ftn and tst makefiles (§10.6) look for and, if found, include an adjunct makedefs (p) file which may contain definitions (or, in principle, rules) which apply to a particular source code directory. The adjunct files are architecture-specific and are primarily intended to control compiler options on a per-sourcefile basis.
The adjunct files reside in $INSTARCH (see §1.2) and have names of the following form
Form Examples --------------------------------- --------------------- imp <package>[-<module>].defs aips.defs aips-Tables.defs tst <package>[-<module>]-test.defs aips-Tables-test.defs ftn <package>-fortran[-<module>].defs aips-fortran.defs app <package>_<app>.defs aips_gtable.defs
As a simple example of the use of a makedefs adjunct, the applications makefile uses a variable called BIN as a hook to allow conditional compilation of an application. If BIN is set to blank in an adjunct file for a particular architecture then compilation of that particular application will be skipped during a recursive system build.
The following adjunct makedefs decreases the optimization level for TSMCube.cc for the GNU C++ compiler running under OSF/1. The file, $(AIPSCODE)/install/alpha_gnu/aips-Tables.defs, is included by the implement makefile, and it illustrates the general scheme:
# Switch off optimization for TSMCube. LVL := $(C++OPTLVL) LVL0 := -O0 TSMCube := 0 C++OPTLVL = $(LVL$($*))
Although this is a non-trivial construct the general form should be easy to follow. The operative part is the last line in which C++OPTLVL, a recursively expanded makedefs variable which determines the C++ optimization level, is evaluated as a ``computed'' variable within the pattern rule which compiles TSMCube.o from TSMCube.cc:
For any other source file in the $(AIPSCODE)/aips/implement/Tables/ directory, say Table.cc, the sequence would be as follows:
The default case relied on Table being undefined as a makefile variable. This is a safe assumption since makefile variable names are case-sensitive and while AIPS++ source file names contain a mixture of upper- and lower-case characters, the makedefs and makefile variables in AIPS++ are all upper-case.
The makedefs variables which specify debug or optimization flags for the various compilers are
These variables are not used directly in the makefiles but are instead used as components in the definition of variables which contain all of the compiler flags. An imporant prerequisite for this system is that these variables, namely C++DBG, C++OPT, CDBG, COPT, FCDBG, and FCOPT, be recursively expanded. This also applies for the programmer compilation option variables C++FLAGS, CFLAGS, and FCFLAGS.