Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ar(1)

ctags(1)

ex(1)

ld(1)

ls(1)

OMmkmf(1)

make(1)



  mkmf(1)                             CLIX                             mkmf(1)



  NAME

    mkmf - Makefile editor

  SYNOPSIS

    mkmf [-acdil] [-f makefile] [-F template] ["macroname=value" ...]

  FLAGS

    -a            When searching a directory for source and include files,
                  also considers files which have names beginning with
                  periods.  By default, mkmf ignores file names which have
                  leading periods, such as those of backup files created by
                  some editors.

    -c            Suppresses creating makefile from ... message.

    -d            Turns off scanning of source code for include files.  Old
                  dependency information is left untouched in the makefile.

    -f makefile   Specifies an alternative makefile file name.  The default
                  file name is Makefile.

    -i            Causes mkmf to prompt the user for the name of the program
                  or library, and the directory in which it is to be
                  installed.  If <Return> is pressed in response to each of
                  these queries, mkmf assumes that the default program name is
                  a.out or the default library name is lib.a, and the
                  destination directory is the current directory.

    -Iinclude     Specifies an additional directory to search for include
                  files.  This flag is in the same syntax as the C compiler
                  expects, namely, no space between the -I and the include
                  directory.

    -l            Forces the makefile to be a library makefile.

    -F template   Specifies an alternative makefile template file name.  The
                  default program makefile template is p.Makefile and the
                  default library makefile template is l.Makefile.  The mkmf
                  command normally looks for template  in /usr/lib/mkmf or
                  $PROJECT/lib.  However, template can be specified as an
                  absolute pathname.

  DESCRIPTION

    The mkmf command 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



  2/94 - Intergraph Corporation                                              1






  mkmf(1)                             CLIX                             mkmf(1)



    generates dependency information which is appended to the makefile.
    Source code files are identified by their file name suffixes.  The
    recognized suffixes are as follows:

    .c   C

    .e   efl

    .F   FORTRAN

    .f   FORTRAN

    .h   Include files

    .i   Pascal include files

    .l   lex or Lisp

    .o   Object files

    .p   Pascal

    .r   ratfor

    .s   Assembler

    .y   yacc

    The mkmf command checks for an existing makefile before creating one.  If
    no -f flag is present, the makefiles makefile and Makefile are tried, in
    that order.

    After the makefile has been created, arbitrary changes can be made using a
    regular text editor.  The mkmf command can also be used to 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 flag must be used.

  Make Requests

    Given a makefile created by the mkmf command, make recognizes the
    following requests:

    all       Compiles and loads a program or library.

    clean     Removes all unnecessary files.

    depend    Edits the makefile and regenerates the dependency information.




  2                                              Intergraph Corporation - 2/94






  mkmf(1)                             CLIX                             mkmf(1)



    extract   Extracts all the object files from the library and places them
              in the same directory as the source code files.  The library is
              not altered.

    index     Prints an index of functions on standard output.

    install   Compiles and loads the program or library and moves it to its
              destination directory.

    library   Compiles and loads a library.

    tags      Creates a tags file for the ex editor, for C, Pascal, and
              FORTRAN source code files.

    program   Compiles and links a program.

    update    Recompiles only if there are source code files that are newer
              than the program or library, links and installs the program or
              library.

    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, use the following command:

    make program install clean


  Macro Definitions

    The mkmf command understands the following macro definitions:

    CFLAGS     C compiler flags.  After searching for included files in the
               directory currently being processed, mkmf searches in
               directories named in -I compiler flags, and then in the
               /usr/include directory.  Alternatively, the include directories
               can be named directly on the command line in the same syntax as
               they are expected by the C compiler, namely, -Ifilename.  Any
               number of include directories may be named.

    DEST       Directory in which the program or library is to be installed.

    EXTHDRS    List of included files external to the current directory.  The
               mkmf command automatically updates this macro definition in the
               makefile if dependency information is being generated.

    FFLAGS     FORTRAN compiler flags.  After searching for included files in
               the directory currently being processed, mkmf searches in
               directories named in -I compiler flags, and then in the
               /usr/include directory.

    HDRS       List of included files in the current directory.  The mkmf



  2/94 - Intergraph Corporation                                              3






  mkmf(1)                             CLIX                             mkmf(1)



               command automatically updates this macro definition in the
               makefile.

    LIBRARY    Library name.  This macro also assumes the -l flag is used.

    LIBS       List of libraries needed by the link editor to resolve external
               references.

    MAKEFILE   Makefile name.

    OBJS       List of object files.  The mkmf command automatically updates
               this macro definition in the makefile.

    PROGRAM    Program name.

    SRCS       List of source code files.  The mkmf command automatically
               updates this macro definition in the makefile.

    SUFFIX     List of additional file name suffixes for mkmf to recognize.

    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 following
    command may be given:

    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 quotation marks.

  File Name Suffixes

    The mkmf command can be instructed to recognize additional file name
    suffixes, or ignore the ones it already recognizes, by specifying suffix
    descriptions in the SUFFIX macro definition.  Each suffix description
    takes the form .suffix:tI.  The t is a character indicating the contents
    of the file, and may have one of the following values:

    s   Source file

    o   Object file

    h   Header file

    x   Executable file

    The I is an optional character indicating the include syntax for included
    files.  It may have one of the following values:




  4                                              Intergraph Corporation - 2/94






  mkmf(1)                             CLIX                             mkmf(1)



    C   C syntax

    F   FORTRAN, Efl, Ratfor syntax

    P   Pascal syntax

    The following table describes the default configuration for mkmf:

    .c:sC   C

    .e:sF   efl

    .F:sF   FORTRAN

    .f:sF   FORTRAN

    .h:h    Include files

    .i:h    Pascal include files

    .l:sC   lex or Lisp

    .o:o    Object files

    .p:sP   Pascal

    .r:sF   ratfor

    .s:s    Assembler

    .y:sC   yacc

    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 the following:

    "SUFFIX = .obj:o  .i:  .f:s"


  Include Statement Syntax

    Following are examples of the syntax of include statements for C, FORTRAN,
    and Pascal:

    The following is a C example; the number sign character # must be the
    first character in the line:

    #include "filename"


    The following is a FORTRAN example; the include statement starts in column



  2/94 - Intergraph Corporation                                              5






  mkmf(1)                             CLIX                             mkmf(1)



    7:

    include 'filename'

    INCLUDE 'filename'


    The following is a Pascal example; the number sign # must be the first
    character in the line:

    #include "filename"

    #INCLUDE "filename"


  User-Defined Templates

    If mkmf can not find a makefile within the current directory, it uses one
    of the standard makefile templates, p.Makefile or l.Makefile, in
    /usr/lib/mkmf unless the user has alternative template files in a
    directory $PROJECT/lib, where $PROJECT is the absolute pathname of the
    directory assigned to the PROJECT environment variable.

  FILES

    /usr/lib/mkmf/p.Makefile  Standard program makefile template.

    /usr/lib/mkmf/l.Makefile  Standard library makefile template.

    $PROJECT/lib/p.Makefile   User-defined program makefile template.

    $PROJECT/lib/l.Makefile   User-defined library makefile template.

  CAUTIONS

    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.

  EXIT VALUES

    The mkmf command exits with a value of 0 if successful.  If unsuccessful,
    it exits with a value of 1.




  6                                              Intergraph Corporation - 2/94






  mkmf(1)                             CLIX                             mkmf(1)



  RELATED INFORMATION

    Commands:  ar(1), ctags(1), ex(1), ld(1), ls(1), OMmkmf(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.














































  2/94 - Intergraph Corporation                                              7




Typewritten Software • bear@typewritten.org • Edmonds, WA 98026