MKOVMAKE(8) UNIX Programmer's Manual MKOVMAKE(8) NAME mkovmake - optimizing overlay makefile generator SYNOPSIS mkovmake [-O_n [_b_a_s_e_s_i_z_e] [-n]] [-f _m_a_k_e_f_i_l_e] [-s _o_v_s_i_z_e] [-v _m_a_x _o_v'_s] [-o _p_r_o_g_r_a_m] [-l _l_i_b_r_a_r_i_e_s ...] [_a_r_c_h_i_v_e_s.a ...] _b_a_s_e_m_o_d_u_l_e_s.o ... -Z _o_v_m_o_d_u_l_e_s.o ... DESCRIPTION _M_k_o_v_m_a_k_e produces an overlay makefile (see _m_a_k_e(1)) for a given set of object modules (see _l_d(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. _M_k_o_v_m_a_k_e 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 _m_a_k_e 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 _m_a_k_e entry inside it. If these options are not used, _m_k_o_v_m_a_k_e will guess at the best sizes and use standard names, respectively. OPTIONS -O_n 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 _n_m(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, _m_k_o_v_m_a_k_e 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) _b_a_s_e_s_i_z_e 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, _m_k_o_v_m_a_k_e will guess at how much room the libraries will take up, upto 24k. If _b_a_s_e_s_i_z_e 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. -f_m_a_k_e_f_i_l_e Specify the name of the generated makefile. If not specified, stdout will be used. -s_o_v_s_i_z_e Specify the maximum size of overlays. Just as _b_a_s_e_s_i_z_e above, if followed by a "k" or "K", _o_v_s_i_z_e will be mul- tiplied by 1024, and if less than 10, it will be multi- plied by 8192. If _o_v_s_i_z_e is not specified, _m_k_o_v_m_a_k_e will compute the total amount of text that is not already assigned to the base, and guess at the size of overlays. _M_k_o_v_m_a_k_e guesses, pessimisticly, that 1/16th of each overlay will be left blank. -v_m_a_x _o_v'_s Specify the maximum number of overlays to use. The default is NOVL, 15. -o_p_r_o_g_r_a_m The name of the program being made. This is used in the _m_a_k_e entry generated after the base and overlay definitions. If not used, the makefile macro $(PRO- GRAM) will be inserted. -l_l_i_b_r_a_r_i_e_s ... _a_r_c_h_i_v_e_s.a ... Extra libraries or archives, such as _t_e_r_m_l_i_b or _m can be specified, and will be placed in the generated _m_a_k_e 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. _b_a_s_e_m_o_d_u_l_e_s.o ... -Z _o_v_m_o_d_u_l_e_s.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. _M_k_o_v_m_a_k_e will ignore all redundancies, so _o_v_m_o_d_u_l_e_s.o may be a macro of all modules, while _b_a_s_e_m_o_d_u_l_e_s.o may be a subset. If using level-2 optim- ization, only one list, the macro of all modules, is necessary. EXAMPLES If _m_k_o_v_m_a_k_e 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 ... _m_k_o_v_m_a_k_e failed to use _m_a_l_l_o_c(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 _b_a_s_e_s_i_z_e 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. _M_k_o_v_m_a_k_e 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 _m_k_o_v_m_a_k_e to put a certain group of modules together on an overlay. _M_k_o_v_m_a_k_e is incapable of telling how _o_f_t_e_n 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