MKMF(1) — NEWS-OS Programmer’s Manual
NAME
mkmf − makefile editor
SYNOPSIS
mkmf [−acdil] [−f makefile] [−F template] [macroname=value ...]
DESCRIPTION
Mkmf creates a makefile that tells the make command how to construct and maintain programs and libraries. After gathering up all the source code file names in the current working directory and inserting them into the makefile, mkmf scans source code files for included files and generates dependency information which is appended to the makefile. Source code files are identified by their file name suffixes. Mkmf knows about the following suffixes:
.cC
.eEfl
.FFortran
.fFortran
.hInclude files
.iPascal include files
.lLex or Lisp
.oObject files
.pPascal
.rRatfor
.sAssembler
.yYacc
Mkmf checks for an existing makefile before creating one. If no −f option is present, the makefiles ‘makefile’ and ‘Makefile’ are tried in order. After the makefile has been created, arbitrary changes can be made using a regular text editor. Mkmf can also be used to re-edit the macro definitions in the makefile, regardless of changes that may have been made since it was created. By default, mkmf creates a program makefile. To create a makefile that deals with libraries, the −l option must be used. Make Requests Given a makefile created by mkmf, make recognizes the following requests:
allCompile and load a program or library.
cleanRemove all unnecessary files.
dependEdit the makefile and regenerate the dependency information.
extractExtract all the object files from the library and place them in the same directory as the source code files. The library is not altered.
indexPrint an index of functions on standard output.
installCompile and load the program or library and move it to its destination directory.
libraryCompile and load a library.
printPrint source code files on standard output.
tagsCreate a tags file for the ex editor, for C, Pascal, and Fortran source code files.
programCompile and link a program.
updateRecompile only if there are source code files that are newer than the program or library, link and install the program or library. In the case of an out-of-date library, all the object files are extracted from the library before any recompilation takes place. Several requests may be given simultaneously. For example, to compile and link a program, move the program to its destination directory, and remove any unnecessary object files:
make program install clean Macro Definitions Mkmf understands the following macro definitions:
CFLAGSC compiler flags. After searching for included files in the directory currently being processed, mkmf searchs in directories named in −I compiler options, and then in the ‘/usr/include’ and ’/usr/sony/include’ directory.
DESTDirectory where the program or library is to be installed.
EXTHDRSList of included files external to the current directory. Mkmf automatically updates this macro definition in the makefile if dependency information is being generated.
FFLAGSFortran compiler flags. After searching for included files in the directory currently being processed, mkmf searchs in directories named in −I compiler options, and then in the ‘/usr/include’ and ’/usr/sony/include’ directory.
HDRSList of included files in the current directory. Mkmf automatically updates this macro definition in the makefile.
LIBRARYLibrary name. This macro also implies the −l option.
LIBSList of libraries needed by the link editor to resolve external references.
MAKEFILEMakefile name.
OBJSList of object files. Mkmf automatically updates this macro definition in the makefile.
PROGRAMProgram name.
SRCSList of source code files. Mkmf automatically updates this macro definition in the makefile.
SUFFIXList of additional file name suffixes for mkmf to know about. Both these and any other macro definitions already within the makefile may be replaced by definitions on the command line in the form macroname=value . For example, to change the C compiler flags, the program name, and the destination directory in the makefile, the user might type the following line:
mkmf “CFLAGS=−I../include −O” PROGRAM=mkmf DEST=/usr/new
Note that macro definitions like CFLAGS with blanks in them must be enclosed in double quote ‘"’ marks. File Name Suffixes Mkmf can be instructed to recognize additional file name suffixes, or ignore ones that it already knows about, by specifying suffix descriptions in the SUFFIX macro definition. Each suffix description takes the form ‘.suffix:tI’ where t is a character indicating the contents of the file (s = source file, o = object file, h = header file, x = executable file) and I is an optional character indicating the include syntax for included files (C = C syntax, F = Fortran, Efl, and Ratfor syntax, P = Pascal syntax). The following table describes the default configuration for mkmf:
.c:sCC
.e:sFEfl
.F:sFFortran
.f:sFFortran
.h:hInclude files
.i:hPascal include files
.l:sCLex or Lisp
.o:oObject files
.p:sPPascal
.r:sFRatfor
.s:sAssembler
.y:sCYacc
For example, to change the object file suffix to .obj, undefine the Pascal include file suffix, and prevent Fortran files from being scanned for included files, the SUFFIX macro definition might look like:
"SUFFIX = .obj:o .i: .f:s" Include Statement Syntax The syntax of include statements for C, Fortran, and Pascal source code are of the form
C:#include "filename"
where # must be the first character in the line.
Fortran:include ’filename’
INCLUDE ’filename’
where the include statement starts in column 7.
Pascal:#include "filename"
#INCLUDE "filename"
where # must be the first character in the line.
User-Defined Templates If mkmf can not find a makefile within the current directory, it normally uses one of the standard makefile templates, ‘p.Makefile’ or ‘l.Makefile’, in /usr/new/lib unless the user has alternative ‘p.Makefile’ or ‘l.Makefile’ template files in a directory $PROJECT/lib where $PROJECT is the absolute pathname of the directory assigned to the PROJECT environment variable.
OPTIONS
−aWhen searching a directory for source and include files, also consider files which have names beginning with periods. By default, mkmf ignores file names which have leading "dots," such as those of backup files created by some editors.
−cSuppress ‘creating makefile from ...’ message.
−dTurn off scanning of source code for ‘include’ files. Old dependency information is left untouched in the makefile.
−f makefile
Specify an alternative makefile file name. The default file name is ‘Makefile’.
−iCause mkmf to prompt the user for the name of the program or library, and the directory where it is to be installed. If a carriage return is typed in response to each of these queries, mkmf will assume that the default program name is a.out or the default library name is lib.a, and the destination directory is the current directory.
−lForce the makefile to be a library makefile.
−F template
Specify an alternative makefile template file name. The default program makefile template is ‘p.Makefile’ and the default library makefile template is ‘l.Makefile’. Mkmf normally looks for template in /usr/new/lib or $PROJECT/lib. However, template can be specified as an absolute pathname.
FILES
/usr/new/lib/p.MakefileStandard program makefile template.
/usr/new/lib/l.MakefileStandard library makefile template.
$PROJECT/lib/p.MakefileUser-defined program makefile template.
$PROJECT/lib/l.MakefileUser-defined library makefile template.
SEE ALSO
ar(1), ctags(1), ex(1), ld(1), ls(1), make(1) Feldman, S.I., "Make − A Program for Maintaining Computer Programs" Walden, K., "Automatic Generation of Make Dependencies", Software−Practice and Experience, vol. 14, no. 6, pp. 575-585, June 1984.
DIAGNOSTICS
Exit status 0 is normal. Exit status 1 indicates an error.
AUTHOR
Peter J. Nicklin
BUGS
The name of the makefile is included as a macro definition within the makefile and must be changed if the makefile is renamed. Since executable files are dependent on libraries, standard library abbreviations must be expanded to full pathnames within the LIBS macro definition in the makefile. Generated dependency information appears after a line in the makefile beginning with ‘###’. This line must not be removed, nor must any other information be inserted in the makefile below this line.
NEWS-OSRelease 4.1C