MKOVMAKE(8) UNIX Programmer's Manual MKOVMAKE(8) NAME mkovmake - optimizing overlay makefile generator SYNOPSIS mkovmake [-On [basesize] [-n]] [-f makefile] [-s ovsize] [-v max ov's] [-o program] [-l libraries ...] [archives.a ...] basemodules.o ... -Z ovmodules.o ... DESCRIPTION Mkovmake produces an overlay makefile (see make(1)) for a given set of object modules (see ld(1)). It is intended to be used inside makefiles in order to avoid computing module sizes and base/overlay structures each time changes are made in the source. Mkovmake can be included, as shown in the examples below, inside makefiles of distributed sources so that the base and overlays would be automatically con- structed whenever the program is made by a PDP-11. The makefile generated contains the make entry necessary for loading the modules together into an automatic-overlay exe- cutable. There are several options to allow various levels of user involvement in the construction process. These options set the sizes of various components or the name of either the generated makefile or the make entry inside it. If these options are not used, mkovmake will guess at the best sizes and use standard names, respectively. OPTIONS -On Use optimizer level n. -O1 Put only those modules listed before the -Z in the base, and construct optimal overlays for the remaining modules. The algorithm of optimization for overlays is to iteratively add the module with the greatest number of "ties" with the modules currently on the overlay. A "tie" is a match between a global undefined symbol (see nm(1)) in one module with a global text symbol in another. This measure is on a per-kbyte of text basis, and modules are added until no more will fit. If n is not specified, level 1 optimization is assumed. -O2 Optimize both the base and the overlays. If a -Z flag is used, modules before it will be placed in the base, plus those modules with the greatest number of global text symbols per kbyte of text, until no more modules will fit. If no -Z appears on the command line, mkovmake will assume no ini- tial base preference and will examine all modules for base and overlay optimization. This is recom- mended for beginners. Printed 11/24/99 June 30, 1990 1 MKOVMAKE(8) UNIX Programmer's Manual MKOVMAKE(8) basesize If level-2 optimization is specified and the fol- lowing argument begins with a number, it will be used as the size of the base, without libraries. If not used, mkovmake will guess at how much room the libraries will take up, upto 24k. If basesize is followed by the letter "k" or "K", it will be multiplied by 1024. If it is less than 10, it will be multiplied by 8192. -n List the global text and undefined symbols as they are encountered, preceded by the module name and a "T" for text or "U" for undefined. If no optimization is specified, modules will be packed on overlays as they appear in the command line until no more fit. -fmakefile Specify the name of the generated makefile. If not specified, stdout will be used. -sovsize Specify the maximum size of overlays. Just as basesize above, if followed by a "k" or "K", ovsize will be mul- tiplied by 1024, and if less than 10, it will be multi- plied by 8192. If ovsize is not specified, mkovmake will compute the total amount of text that is not already assigned to the base, and guess at the size of overlays. Mkovmake guesses, pessimisticly, that 1/16th of each overlay will be left blank. -vmax ov's Specify the maximum number of overlays to use. The default is NOVL, 15. -oprogram The name of the program being made. This is used in the make entry generated after the base and overlay definitions. If not used, the makefile macro $(PRO- GRAM) will be inserted. -llibraries ... archives.a ... Extra libraries or archives, such as termlib or m can be specified, and will be placed in the generated make entry preceding the c library. If not used, $(LIBS) will be inserted. Multiple libraries and archives can be specified and will be placed together in the order they appear on the command line. basemodules.o ... -Z ovmodules.o ... Printed 11/24/99 June 30, 1990 2 MKOVMAKE(8) UNIX Programmer's Manual MKOVMAKE(8) Specify modules to be placed in the base and overlays, respectively. Mkovmake will ignore all redundancies, so ovmodules.o may be a macro of all modules, while basemodules.o may be a subset. If using level-2 optim- ization, only one list, the macro of all modules, is necessary. EXAMPLES If mkovmake is being used inside a makefile, the following lines can be inserted to automatically construct the base and overlay definitions and load the result. The macro $(OBJS) is the list of all modules, mybigprogram is the pro- gram being made, and termlib is a library that has to be loaded with the object modules: mkovmake -fOvmakefile -O2 $(OBJS) -omybigprogram -ltermlib make -f Ovmakefile If it is known that $(BASE) is a macro of the only modules that are wanted in the base, $(GAME) is the program being made, and $(LIBS) contains libraries (with -l prefixed) to be loaded with the modules, the following lines can be used: mkovmake -fOvmakefile -O -o$(GAME) $(LIBS) $(BASE) -Z $(OBJS) make -f Ovmakefile If the user just wants a sample optimal makefile for the modules in the current working directory, mkovmake -O2 *.o SEE ALSO make(1), nm(1), ld(1), strip(1), a.out(5), nlist(3) DIAGNOSTICS mkovmake: unknown file type. A command-line argument not recognized as an option argument didn't end in .o or .a. mkovmake: not enough memory for ... mkovmake failed to use malloc(2) to clear space for a needed list. mkovmake: specified modules don't fit in base. Level-2 optimization was used, and some modules were specified to be put in the base. But these modules were too big. Use basesize to increase the base allot- ment, or reduce the number of base modules. BUGS Certain pathological cases may cause unpredictable results. In particular, if the argument to an -f, -o, or -l option is separated from the f, o, or l by a space or tab, and the argument ends, for some reason, in .o, the second parsing of the command line will think it's a name of an object module Printed 11/24/99 June 30, 1990 3 MKOVMAKE(8) UNIX Programmer's Manual MKOVMAKE(8) and attempt to open it. Otherwise, options and names of modules may be freely mixed. Mkovmake assumes that all arguments ending with .o or .a are simple object modules or archives, respectively, rather than looking at the magic number and complaining if not. There is no way to tell mkovmake to put a certain group of modules together on an overlay. Mkovmake is incapable of telling how often a routine is called, or whether an executable could be loaded even without overlays. AUTHOR Dennis T. Flaherty, U of Notre Dame dennisf@ndcvx.cc.nd.edu Printed 11/24/99 June 30, 1990 4