


make(1S)             SunOS Specific Commands             make(1S)



NAME
     make - maintain, update, and regenerate related programs and
     files

SYNOPSIS
     /usr/ccs/bin/make [ -f _m_a_k_e_f_i_l_e ] ...  [ -d ] [ -dd ] [ -D ]
          [ -DD ] [ -e ] [ -i ] [ -k ] [ -n ] [ -p ] [ -P ]
          [ -q ] [ -r ] [ -s ] [ -S ] [ -t ] [ _t_a_r_g_e_t ...  ]
          [ _m_a_c_r_o=_v_a_l_u_e ...  ]

DESCRIPTION
     make executes a list of shell commands associated with  each
     _t_a_r_g_e_t,  typically  to  create  or update a file of the same
     name.  _m_a_k_e_f_i_l_e contains entries that describe how to  bring
     a  target  up  to  date  with  respect  to those on which it
     depends, which are called _d_e_p_e_n_d_e_n_c_i_e_s.  Since  each  depen-
     dency  is  a  target,  it  may have dependencies of its own.
     Targets, dependencies, and sub-dependencies comprise a  tree
     structure  that  make traces when deciding whether or not to
     rebuild a _t_a_r_g_e_t.

     make recursively checks each _t_a_r_g_e_t  against  its  dependen-
     cies,  beginning  with the first target entry in _m_a_k_e_f_i_l_e if
     no _t_a_r_g_e_t argument is supplied on  the  command  line.   If,
     after  processing  all of its dependencies, a target file is
     found either to be missing, or to be older than any  of  its
     dependencies,  make  rebuilds it.  Optionally with this ver-
     sion of make, a target can be treated  as  out-of-date  when
     the commands used to generate it have changed since the last
     time the target was built.

     To build a given target, make executes the list of commands,
     called  a  _r_u_l_e.   This rule may be listed explicitly in the
     target's makefile entry, or it may be supplied implicitly by
     make.

     When no _m_a_k_e_f_i_l_e is specified with a -f option:

          +o   If there is a file named makefile  in  the  working
             directory,  make uses that file.  If, however, there
             is an SCCS history file (SCCS/s.makefile)  which  is
             newer,  make  attempts  to retrieve and use the most
             recent version.

          +o   In the absence of the  above  file(s),  if  a  file
             named  Makefile is present in the working directory,
             make attempts to use it.  If there is an  SCCS  his-
             tory  file  (SCCS/s.Makefile)  that  is  newer, make
             attempts to retrieve and use the  most  recent  ver-
             sion.





Sun Microsystems    Last change: 16 Mar 1993                    1






make(1S)             SunOS Specific Commands             make(1S)



     If no _t_a_r_g_e_t is specified on the command line, make uses the
     first target defined in _m_a_k_e_f_i_l_e.

     If a _t_a_r_g_e_t has no makefile entry, or if its  entry  has  no
     rule,  make attempts to derive a rule by each of the follow-
     ing methods, in turn, until a suitable rule is found.  (Each
     method is described under USAGE below.)

          +o   Pattern matching rules.

           +o   Implicit  rules,  read  in  from  a  user-supplied
             makefile.

          +o   Standard  implicit  rules  (also  known  as  suffix
             rules),    typically   read   in   from   the   file
             </usr/share/lib/make/make.rules>.

          +o   SCCS retrieval.  make  retrieves  the  most  recent
             version  from  the  SCCS history file (if any).  See
             the description of the  .SCCS_GET:  special-function
             target for details.

          +o   The rule from the .DEFAULT: target entry, if  there
             is such an entry in the makefile.

     If there is no makefile entry for a _t_a_r_g_e_t, if no  rule  can
     be  derived  for building it, and if no file by that name is
     present, make issues an error message and halts.

OPTIONS
     -f _m_a_k_e_f_i_l_e
          Use the description file  _m_a_k_e_f_i_l_e.   A  ` - '  as  the
          _m_a_k_e_f_i_l_e argument denotes the standard input.  The con-
          tents of _m_a_k_e_f_i_l_e, when present, override the  standard
          set of implicit rules and predefined macros.  When more
          than one `-f  _m_a_k_e_f_i_l_e'  argument  pair  appears,  make
          uses  the  concatenation  of  those  files, in order of
          appearance.

     -d    Display the reasons why make chooses to rebuild a tar-
          get;  make  displays  any and all dependencies that are
          newer.  In addition, make displays options read in from
          the MAKEFLAGS environment variable.

     -dd   Display the dependency check and  processing  in  vast
          detail.

     -D    Display the text of the makefiles read in.

     -DD   Display the text of the  makefiles,  make.rules  file,
          the state file, and all hidden-dependency reports.




Sun Microsystems    Last change: 16 Mar 1993                    2






make(1S)             SunOS Specific Commands             make(1S)



     - e    Environment  variables  override  assignments  within
          makefiles.

     -i    Ignore error codes returned by  commands.   Equivalent
          to the special-function target `.IGNORE:'.

     -k    When a nonzero error status is returned by a rule,  or
          when  make  cannot  find  a  rule,  abandon work on the
          current target,  but  continue  with  other  dependency
          branches that do not depend on it.

     -n    No execution mode.  Print commands, but do not execute
          them.   Even  lines  beginning  with  an @ are printed.
          However, if a command line contains a reference to  the
          $(MAKE)  macro,  that  line is always executed (see the
          discussion of MAKEFLAGS in Reading  Makefiles  and  the
          Environment).

     -p    Print out the complete set of  macro  definitions  and
          target descriptions.

     -P    Merely report dependencies, rather than building them.

     -q    Question mode.  make returns a zero or nonzero  status
          code  depending on whether or not the target file is up
          to date.

       -  r    Do   not   read   in    the    default    makefile
          </usr/share/lib/make/make.rules>.

     -s    Silent mode.  Do not print command lines  before  exe-
          cuting them.  Equivalent to the special-function target
          `.SILENT:'.

     -S    Undo the effect of the - k  option.   Stop  processing
          when a non-zero exit status is returned by a command.

     -t    Touch the target files  (bringing  them  up  to  date)
          rather  than  performing  their  rules.   _T_h_i_s  _c_a_n  _b_e
          _d_a_n_g_e_r_o_u_s _w_h_e_n _f_i_l_e_s _a_r_e _m_a_i_n_t_a_i_n_e_d _b_y  _m_o_r_e  _t_h_a_n  _o_n_e
          _p_e_r_s_o_n.   When  the  .KEEP_STATE: target appears in the
          makefile, this option updates the state file just as if
          the rules had been performed.

     _m_a_c_r_o=_v_a_l_u_e
          Macro definition.  This definition overrides any  regu-
          lar  definition  for  the  specified  macro  within the
          makefile itself, or in the environment.  However,  this
          definition can still be overridden by conditional macro
          assignments.





Sun Microsystems    Last change: 16 Mar 1993                    3






make(1S)             SunOS Specific Commands             make(1S)



USAGE
     Refer  to  make  in  _S_u_n_O_S _5._3 _P_r_o_g_r_a_m_m_i_n_g   _U_t_i_l_i_t_i_e_s   for
     tutorial information.

  Reading Makefiles and the Environment
     When make first starts, it reads the  MAKEFLAGS  environment
     variable  to  obtain  any  the  following  options specified
     present in its value:  -d, -D, -e, -i, -k, -l, -n, -p, -q, -
     r,  -s, -S, or -t.  (Within the MAKEFLAGS value, the leading
     `-' character for the option string is omitted.)  make  then
     reads  the  command  line for additional options, which also
     take effect.

     Next, make reads in a default makefile that  typically  con-
     tains  predefined  macro  definitions,  target  entries  for
     implicit rules, and additional rules, such as the  rule  for
     retrieving  SCCS  files.   If  present,  make  uses the file
     make.rules in the current directory; otherwise it reads  the
     file  </usr/share/lib/make/make.rules>,  which  contains the
     standard definitions and rules.
     Use the directive:

          include </usr/share/lib/make/make.rules>

     in your local make.rules file to include them.

     Next, make imports variables from  the  environment  (unless
     the -e option is in effect), and treats them as defined mac-
     ros.  Because  make  uses  the  most  recent  definition  it
     encounters,  a  macro  definition  in  the makefile normally
     overrides an environment variable of the same name.  When -e
     is  in  effect,  however,  environment variables are read in
     _a_f_t_e_r all makefiles have  been  read.   In  that  case,  the
     environment  variables  take  precedence over definitions in
     the makefile.

     Next, make reads the state file, .make.state  in  the  local
     directory  if  it exists, and then any makefiles you specify
     with -f, or one of makefile or Makefile as described above.

     Next, (after reading the environment if -e  is  in  effect),
     make reads in any macro definitions supplied as command line
     arguments.  These override macro definitions in the makefile
     and  the  environment  both,  but  only for the make command
     itself.

     make exports environment variables, using the most  recently
     defined  value.   Macro  definitions supplied on the command
     line are not normally exported, unless the macro is also  an
     environment variable.





Sun Microsystems    Last change: 16 Mar 1993                    4






make(1S)             SunOS Specific Commands             make(1S)



     make does not export macros defined in the makefile.  If  an
     environment  variable is set, and a macro with the same name
     is defined on the command line, make exports  its  value  as
     defined  on  the command line. Unless -e is in effect, macro
     definitions within the makefile take precedence  over  those
     imported from the environment.

     The macros MAKEFLAGS, MAKE,  KEEP_STATE,  SHELL,  HOST_ARCH,
     HOST_MACH,  and  TARGET_MACH are special cases. See Special-
     Purpose Macros, below, for details.

  Makefile Target Entries
     A target entry has the following format:

          _t_a_r_g_e_t...  [:|::]  [_d_e_p_e_n_d_e_n_c_y] ...  [; _c_o_m_m_a_n_d] ...
               [_c_o_m_m_a_n_d]
               ...

     The first line contains the name of a target,  or  a  space-
     separated  list  of target names, terminated with a colon or
     double colon.  If a  list  of  targets  is  given,  this  is
     equivalent  to  having a separate entry of the same form for
     each target.  The colon(s) may be followed by a  _d_e_p_e_n_d_e_n_c_y,
     or a dependency list.  make checks this list before building
     the target.  The dependency list may be  terminated  with  a
     semicolon  (;),  which  in  turn can be followed by a single
     Bourne shell command.  Subsequent lines in the target  entry
     begin  with a TAB, and contain Bourne shell commands.  These
     commands comprise the rule for building the target.

     Shell commands may be continued across input lines by escap-
     ing  the  NEWLINE with a backslash (\).  The continuing line
     must also start with a TAB.

     To rebuild a target, make expands macros, strips off initial
     TAB  characters and either executes the command directly (if
     it contains no shell metacharacters), or passes each command
     line to a Bourne shell for execution.

     The first line that does not begin with a TAB  or  #  begins
     another target or macro definition.

  Special Characters
  _G_l_o_b_a_l
     #    Start a comment.  The comment ends at the next NEWLINE.
          If  the  # follows the TAB in a command line, that line
          is passed to the shell (which  also  treats  #  as  the
          start of a comment).

     include _f_i_l_e_n_a_m_e
          If the word include appears as the first seven  letters
          of a line and is followed by a SPACE or TAB, the string



Sun Microsystems    Last change: 16 Mar 1993                    5






make(1S)             SunOS Specific Commands             make(1S)



          that follows is taken as a filename to  interpolate  at
          that  line.   include files can be nested to a depth of
          no more than about 16.  If _f_i_l_e_n_a_m_e is a  macro  refer-
          ence, it is expanded.

  _T_a_r_g_e_t_s _a_n_d _D_e_p_e_n_d_e_n_c_i_e_s
     :    Target list terminator.  Words following the colon  are
          added to the dependency list for the target or targets.
          If a target is named in more than one  colon-terminated
          target  entry, the dependencies for all its entries are
          added to form that target's complete dependency list.

     ::   Target terminator  for  alternate  dependencies.   When
          used  in place of a `:'  the double-colon allows a tar-
          get to be checked and updated with respect to alternate
          dependency  lists.  When the target is out-of-date with
          respect to dependencies listed in the first  alternate,
          it  is built according to the rule for that entry. When
          out-of-date with respect  to  dependencies  in  another
          alternate, it is built according the rule in that other
          entry.  Implicit rules do  not  apply  to  double-colon
          targets;  you must supply a rule for each entry.  If no
          dependencies are specified, the  rule  is  always  per-
          formed.

     _t_a_r_g_e_t [+ _t_a_r_g_e_t...]  :
          Target group.  The rule in the target entry builds  all
          the  indicated targets as a group.  It is normally per-
          formed only once per make run, but is checked for  com-
          mand  dependencies  every time a target in the group is
          encountered in the dependency scan.

     %    Pattern matching wild card metacharacter.  Like the `*'
          shell wild card, `%' matches any string of zero or more
          characters in a target name or dependency, in the  tar-
          get  portion  of  a  conditional  macro  definition, or
          within a pattern replacement  macro  reference.   Note:
          only  one  `%' can appear in a target, dependency-name,
          or pattern-replacement macro reference.

     ./_p_a_t_h_n_a_m_e
          make ignores the leading `./' characters  from  targets
          with  names  given  as pathnames relative to "dot," the
          working directory.

  _M_a_c_r_o_s
     =    Macro definition.  The word to the left of this charac-
          ter  is the macro name; words to the right comprise its
          value.  Leading and trailing white space characters are
          stripped  from the value.  A word break following the =
          is implied.




Sun Microsystems    Last change: 16 Mar 1993                    6






make(1S)             SunOS Specific Commands             make(1S)



     $    Macro  reference.   The  following  character,  or  the
          parenthesized  or bracketed string, is interpreted as a
          macro reference:  make expands the reference (including
          the $) by replacing it with the macro's value.

     ( )
     { }  Macro-reference name  delimiters.  A  parenthesized  or
          bracketed  word appended to a $ is taken as the name of
          the macro being referred to.  Without  the  delimiters,
          make  recognizes  only the first character as the macro
          name.

     $$   A reference to the  dollar-sign  macro,  the  value  of
          which  is  the  character  `$'.   Used to pass variable
          expressions beginning with $ to the shell, to refer  to
          environment  variables which are expanded by the shell,
          or to delay processing of  dynamic  macros  within  the
          dependency list of a target, until that target is actu-
          ally processed.

     \$   Escaped  dollar-sign  character.   Interpreted   as   a
          literal dollar sign within a rule.

     +=   When used in place of `=', appends a string to a  macro
          definition  (must  be surrounded by white space, unlike
          `=').

     :=   Conditional macro assignment.  When preceded by a  list
          of  targets  with  explicit  target  entries, the macro
          definition that follows takes  effect  when  processing
          only those targets, and their dependencies.

     :sh =
          Define the value of a macro to be the output of a  com-
          mand (see Command Substitutions, below).

     :sh  In a macro reference, execute the command stored in the
          macro,  and  replace  the  reference with the output of
          that command (see Command Substitutions).

  _R_u_l_e_s
     -     make ignores any nonzero error code returned by a com-
          mand line for which the first non-TAB character is a `-
          '.  This character is not passed to the shell  as  part
          of  the  command line.  make normally terminates when a
          command returns nonzero status, unless the -i  or   - k
          options,  or the .IGNORE: special-function target is in
          effect.

     @    If the first non-TAB character is a @,  make  does  not
          print the command line before executing it.  This char-
          acter is not passed to the shell.



Sun Microsystems    Last change: 16 Mar 1993                    7






make(1S)             SunOS Specific Commands             make(1S)



     ?    Escape  command-dependency  checking.   Command   lines
          starting with this character are not subject to command
          dependency checking.

     !    Force command-dependency  checking.  Command-dependency
          checking is applied to command lines for which it would
          otherwise be suppressed.   This  checking  is  normally
          suppressed for lines that contain references to the `?'
          dynamic macro (for example, `$?').

     When any combination of `-', `@', `?', or `!'  appear as the
     first  characters after the TAB, all that are present apply.
     None are passed to the shell.

  Special-Function Targets
     When incorporated in a makefile, the following target  names
     perform special-functions:

     .DEFAULT:
          If it has an entry in the makefile, the rule  for  this
          target  is  used  to  process a target when there is no
          other entry for it, no rule for  building  it,  and  no
          SCCS history file from which to retrieve a current ver-
          sion.  make ignores any dependencies for this target.

     .DONE:
          If defined in the makefile, make processes this  target
          and its dependencies after all other targets are built.
          This target is also performed when make halts  with  an
          error, unless the .FAILED target is defined.

     .FAILED:
          This target, along with its dependencies, is  performed
          instead  of .DONE when defined in the makefile and make
          halts with an error.

     .IGNORE:
          Ignore  errors.   When  this  target  appears  in   the
          makefile,  make  ignores  non-zero error codes returned
          from commands.

     .INIT:
          If defined in the makefile, this target and its  depen-
          dencies  are  built  before  any other targets are pro-
          cessed.

     .KEEP_STATE:
          If this target appears in the  makefile,  make  updates
          the  state file, .make.state, in the current directory.
          This target also activates  command  dependencies,  and
          hidden  dependency  checks.   (See also the ENVIRONMENT
          section.)



Sun Microsystems    Last change: 16 Mar 1993                    8






make(1S)             SunOS Specific Commands             make(1S)



     .MAKE_VERSION:
          A target-entry of the form:

               .MAKE_VERSION:  VERSION-_n_u_m_b_e_r

          enables version  checking.   If  the  version  of  make
          differs from the version indicated, make issues a warn-
          ing message.

     .NO_PARALLEL:
          Currently, this target has no effect, it  is,  however,
          reserved for future use.

     .PARALLEL:
          Currently of no effect, but reserved for future use.

     .PRECIOUS:
          List of files not to delete.  make does not remove  any
          of  the  files  listed  as dependencies for this target
          when interrupted.  make normally  removes  the  current
          target when it receives an interrupt.

     .SCCS_GET:
          This  target  contains  the  rule  for  retrieving  the
          current  version of an SCCS file from its history file.
          To suppress automatic retrieval, add an entry for  this
          target with an empty rule to your makefile.

     .SILENT:
          Run silently. When this target appears in the makefile,
          make does not echo commands before executing them.

     .SUFFIXES:
          The suffixes list for selecting implicit rules (see The
          Suffixes List).

     .WAIT:
          Currently of no effect, but reserved for future use.

  _C_l_e_a_r_i_n_g _S_p_e_c_i_a_l _T_a_r_g_e_t_s
     In this version of make, you can clear the definition of the
     following special targets by supplying entries for them with
     no dependencies and no rule:

          .DEFAULT,  .SCCS_GET,  and .SUFFIXES

  Command Dependencies
     When the .KEEP_STATE: target appears in the  makefile,  make
     checks  the  command for building a target against the state
     file, .make.state.  If the command  has  changed  since  the
     last make run, make rebuilds the target.




Sun Microsystems    Last change: 16 Mar 1993                    9






make(1S)             SunOS Specific Commands             make(1S)



  Hidden Dependencies
     When the .KEEP_STATE: target appears in the  makefile,  make
     reads  reports  from cpp(1) and other compilation processors
     for any "hidden" files, such as #include files.  If the tar-
     get  is out of date with respect to any of these files, make
     rebuilds it.

  Macros
     Entries of the form

          _m_a_c_r_o=_v_a_l_u_e

     define macros.  _m_a_c_r_o is the name of the macro,  and  _v_a_l_u_e,
     which  consists  of all characters up to a comment character
     or unescaped NEWLINE, is the value.  make strips both  lead-
     ing and trailing white space in accepting the value.

     Subsequent references to the macro, of the  forms:   $(_n_a_m_e)
     or ${_n_a_m_e} are replaced by _v_a_l_u_e.  The parentheses or brack-
     ets can be omitted in a reference to a macro with a  single-
     character name.

     Macro references can contain references to other macros,  in
     which case nested references are expanded first.

  _S_u_f_f_i_x _R_e_p_l_a_c_e_m_e_n_t _M_a_c_r_o _R_e_f_e_r_e_n_c_e_s
     Substitutions within macros can be made as follows:

          $(_n_a_m_e:_s_t_r_i_n_g_1=_s_t_r_i_n_g_2)

     where _s_t_r_i_n_g_1 is either a suffix, or a word to  be  replaced
     in the macro definition, and _s_t_r_i_n_g_2 is the replacement suf-
     fix or word.  Words in a macro value are separated by SPACE,
     TAB, and escaped NEWLINE characters.

  _P_a_t_t_e_r_n _R_e_p_l_a_c_e_m_e_n_t _M_a_c_r_o _R_e_f_e_r_e_n_c_e_s
     Pattern matching replacements can also be applied to macros,
     with a reference of the form:
          $(_n_a_m_e:  _o_p%_o_s= _n_p%_n_s)

     where _o_p is the existing (old) prefix and _o_s is the existing
     (old)  suffix,  _n_p and _n_s are the new prefix and new suffix,
     respectively, and the pattern matched by % (a string of zero
     or more characters), is carried forward from the value being
     replaced.  For example:
          PROGRAM=fabricate
          DEBUG= $(PROGRAM:%=tmp/%-g)

     sets the value of DEBUG to tmp/fabricate-g.

     Note: pattern replacement macro references cannot be used in
     the  dependency  list  of  a  pattern  matching  rule; the %



Sun Microsystems    Last change: 16 Mar 1993                   10






make(1S)             SunOS Specific Commands             make(1S)



     characters  are  not  evaluated  independently.   Also,  any
     number of % metacharacters can appear after the equal-sign.

  _A_p_p_e_n_d_i_n_g _t_o _a _M_a_c_r_o
     Words can be appended to macro values as follows:

          _m_a_c_r_o += _w_o_r_d ...

  Special-Purpose Macros
     When the MAKEFLAGS variable is present in  the  environment,
     make  takes  options  from  it,  in combination with options
     entered on the command line.   make  retains  this  combined
     value  as  the MAKEFLAGS macro, and exports it automatically
     to each command or shell it invokes.

     Note: flags passed by way of MAKEFLAGS  are  only  displayed
     when the -d, or -dd options are in effect.

     The MAKE macro is another special case.  It  has  the  value
     make by default, and temporarily overrides the -n option for
     any line in which it is referred  to.   This  allows  nested
     invocations of make written as:

          $(MAKE) ...

     to run recursively, with the -n flag in effect for all  com-
     mands  but  make.  This  lets  you  use `make -n' to test an
     entire hierarchy of makefiles.

     For compatibility with the 4.2 BSD make, the MFLAGS macro is
     set from the MAKEFLAGS variable by prepending a `-'.  MFLAGS
     is not exported automatically.

     The SHELL macro, when set to a  single-word  value  such  as
     /usr/bin/csh,  indicates  the  name of an alternate shell to
     use.  The default is /bin/sh.  Note:  make executes commands
     that  contain no shell metacharacters itself.  Built-in com-
     mands, such as dirs in  the  C  shell,  are  not  recognized
     unless  the  command  line  includes  a  metacharacter  (for
     instance, a semicolon).   This  macro  is  neither  imported
     from, nor exported to the environment, regardless of -e.  To
     be sure it is set  properly,  you  must  define  this  macro
     within every makefile that requires it.












Sun Microsystems    Last change: 16 Mar 1993                   11






make(1S)             SunOS Specific Commands             make(1S)



     The following  macros  are  provided  for  use  with  cross-
     compilation:

     HOST_ARCH
          The  machine  architecture  of  the  host  system.   By
          default,  this  is  the  output of the arch(1B) command
          prepended with `-'.  Under normal  circumstances,  this
          value should never be altered by the user.

     HOST_MACH
          The  machine  architecture  of  the  host  system.   By
          default,  this is the output of the mach(1B), prepended
          with `- '.   Under  normal  circumstances,  this  value
          should never be altered by the user.

     TARGET_ARCH
          The machine architecture  of  the  target  system.   By
          default, the output of mach, prepended with `-'.

  Dynamic Macros
     There are several dynamically  maintained  macros  that  are
     useful  as  abbreviations within rules.  They are shown here
     as references; if you were to define them, make would simply
     override the definition.

     $*   The basename of  the  current  target,  derived  as  if
          selected for use with an implicit rule.

     $<   The name of a dependency file, derived as  if  selected
          for use with an implicit rule.

     $@   The name of the  current  target.   This  is  the  only
          dynamic  macro  whose value is strictly determined when
          used in a dependency list. (In which case it takes  the
          form `$$@'.)

     $?   The list of dependencies that are newer than  the  tar-
          get.    Command-dependency  checking  is  automatically
          suppressed for lines that contain this macro,  just  as
          if  the  command had been prefixed with a `?'.  See the
          description of  `?',  under  Makefile  Special  Tokens,
          above.   You  can  force this check with the ! command-
          line prefix.

     $%   The name of the library member being  processed.   (See
          Library Maintenance, below.)

     To refer to the $@ dynamic macro within a  dependency  list,
     precede  the  reference with an additional `$' character (as
     in, `$$@').  Because make assigns $< and $* as it would  for
     implicit  rules  (according  to  the  suffixes  list and the
     directory contents), they may be unreliable when used within



Sun Microsystems    Last change: 16 Mar 1993                   12






make(1S)             SunOS Specific Commands             make(1S)



     explicit target entries.

     These macros can be modified to apply either to the filename
     part,  or  the directory part of the strings they stand for,
     by adding an upper case F or D, respectively (and  enclosing
     the resulting name in parentheses or braces).  Thus, `$(@D)'
     refers to the directory part of the string `$@'; if there is
     no  directory  part,  `.'  is assigned.  $(@F) refers to the
     filename part.

  Conditional Macro Definitions
     A macro definition of the form:

          _t_a_r_g_e_t-_l_i_s_t := _m_a_c_r_o = _v_a_l_u_e

     indicates that when processing any of the targets listed _a_n_d
     _t_h_e_i_r  _d_e_p_e_n_d_e_n_c_i_e_s  ,  _m_a_c_r_o is to be set to the _v_a_l_u_e sup-
     plied.  Note that if a conditional macro is referred to in a
     dependency  list,  the  $  must be delayed (use $$ instead).
     Also, _t_a_r_g_e_t-_l_i_s_t may contain a % pattern, in which case the
     macro  will be conditionally defined for all targets encoun-
     tered that match the pattern.  A pattern replacement  refer-
     ence can be used within the _v_a_l_u_e.

     You can temporarily append to a macro's value with a  condi-
     tional definition of the form:

          _t_a_r_g_e_t-_l_i_s_t := _m_a_c_r_o += _v_a_l_u_e

  Predefined Macros
     make supplies the macros shown in the table that follows for
     compilers  and  their options, host architectures, and other
     commands.  Unless these macros are read  in  as  environment
     variables,  their  values  are not exported by make.  If you
     run make with any of these set in the environment, it  is  a
     good idea to add commentary to the makefile to indicate what
     value each is expected to take.  If -r is  in  effect,  make
     does   not   read  the  default  makefile  (./make.rules  or
     </usr/share/lib/make/make.rules>)  in  which   these   macro
     definitions are supplied.
                      Table of Predefined Macros

          Use     Macro             Default Value

     Library       AR           ar
     Archives      ARFLAGS      rv

     Assembler     AS           as
     Commands      ASFLAGS
                   COMPILE.s    $(AS) $(ASFLAGS)
                   COMPILE.S    $(CC) $(ASFLAGS) $(CPPFLAGS) -c




Sun Microsystems    Last change: 16 Mar 1993                   13






make(1S)             SunOS Specific Commands             make(1S)



     C   Compiler  CC           cc
     Commands      CFLAGS
                   CPPFLAGS
                   COMPILE.c    $(CC) $(CFLAGS) $(CPPFLAGS) -c

                   LINK.c       $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)


     C++           CCC          CC
     Compiler      CCFLAGS      CFLAGS
     Commands      CPPFLAGS
                   COMPILE.cc   $(CCC) $(CCFLAGS) $(CPPFLAGS) -c
                   LINK.cc       $(CCC) $CCFLAGS) $(CPPFLAGS) $(LDFLAGS)

     FORTRAN 77    FC           f77
     Compiler      FFLAGS
     Commands      COMPILE.f    $(FC) $(FFLAGS) -c
                   LINK.f       $(FC) $(FFLAGS) $(  LDFLAGS)
                   COMPILE.F    $(FC) $(FFLAGS) $(CPPFLAGS) -c
                   LINK.F       $(FC) $(FFLAGS) $(CPPFLAGS) $(LDFLAGS)


     Link Editor   LD           ld
     Command       LDFLAGS

     lex           LEX          lex
     Command       LFLAGS
                   LEX.l        $(LEX) $(LFLAGS) -t

     lint          LINT         lint
     Command       LINTFLAGS
                   LINT.c       $(LINT) $(LINTFLAGS) $(CPPFLAGS)

     Modula 2      M2C          m2c
     Commands      M2FLAGS
                   MODFLAGS
                   DEFFLAGS
                   COMPILE.def  $(M2C) $(M2FLAGS) $(DEFFLAGS)
                   COMPILE.mod  $(M2C) $(M2FLAGS) $(MODFLAGS)

     Pascal        PC           pc
     Compiler      PFLAGS
     Commands      COMPILE.p    $(PC) $(PFLAGS) $(CPPFLAGS)
                   LINK.p       $(PC) $(PFLAGS) $(CPPFLAGS) $(LDFLAGS)


     Ratfor        RFLAGS
     Compilation   COMPILE.r    $(FC) $(FFLAGS) $(RFLAGS)
     Commands      LINK.r       $(FC) $(FFLAGS) $(RFLAGS)
                                     $(LDFLAGS)

     rm            RM           rm -f



Sun Microsystems    Last change: 16 Mar 1993                   14






make(1S)             SunOS Specific Commands             make(1S)



     Command

     sccs          SCCSFLAGS
     Command       SCCSGETFLAGS -s

     yacc          YACC         yacc
     Command       YFLAGS
                   YACC.y       $(YACC) $(YFLAGS)

     Suffixes      SUFFIXES .o .c .c~ .cc .cc~ .y .y~ .l .l~ .s .s~ .sh .sh~ .S .S~ .ln
     List                   .h .h~ .f .f~ .F .F~  .mod .mod~ .sym .def .def~ .p .p~ .r .r~
                          .cps .cps~ .C .C~ .Y .Y~ .L .L~

  Implicit Rules
     When a target has no entry in the makefile, make attempts to
     determine  its  class  (if  any) and apply the rule for that
     class.  An implicit rule describes how to build  any  target
     of  a  given class, from an associated dependency file.  The
     class of a target can be determined either by a pattern,  or
     by  a  suffix;  the  corresponding dependency file (with the
     same basename) from which such a target might be built.   In
     addition  to a predefined set of implicit rules, make allows
     you to define your own, either by pattern, or by suffix.

  _P_a_t_t_e_r_n _M_a_t_c_h_i_n_g _R_u_l_e_s
     A target entry of the form:

          _t_p%_t_s:  _d_p%_d_s
               _r_u_l_e

     is a pattern matching rule, in which _t_p is a target  prefix,
     _t_s  is a target suffix, _d_p is a dependency prefix, and _d_s is
     a dependency suffix (any of  which  may  be  null).   The  %
     stands  for  a  basename  of zero or more characters that is
     matched in the target, and is used to construct the name  of
     a  dependency.   When  make encounters a match in its search
     for an implicit rule, it uses the rule in that target  entry
     to  build  the  target  from  the dependency file.  Pattern-
     matching implicit rules typically make use of the $@ and  $<
     dynamic macros as placeholders for the target and dependency
     names.  Other, regular dependencies may occur in the  depen-
     dency list.  An entry of the form:

          _t_p%_t_s:   [_d_e_p_e_n_d_e_n_c_y ...]   _d_p%_d_s   [_d_e_p_e_n_d_e_n_c_y ...]
               _r_u_l_e

     is a valid pattern matching rule.

  _S_u_f_f_i_x _R_u_l_e_s
     When no pattern matching rule applies, make checks the  tar-
     get  name  to see if it ends with a suffix in the known suf-
     fixes list.  If so, make checks for  any  suffix  rules,  as



Sun Microsystems    Last change: 16 Mar 1993                   15






make(1S)             SunOS Specific Commands             make(1S)



     well  as a dependency file with same root and another recog-
     nized suffix, from which to build it.

     The target entry for a suffix rule takes the form:

          _D_s_T_s:
               _r_u_l_e

     where _T_s is the suffix of the target, _D_s is  the  suffix  of
     the  dependency  file,  and  _r_u_l_e is the rule for building a
     target in the class.  Both _D_s and _T_s must appear in the suf-
     fixes  list.   (A  suffix  need  not begin with a `.'  to be
     recognized.)

     A suffix rule with only one suffix describes how to build  a
     target  having  a null (or no) suffix from a dependency file
     with the indicated suffix.  For instance, the .c rule  could
     be  used  to build an executable program named file from a C
     source file named `file.c'.  If a target with a null  suffix
     has an explicit dependency, make omits the search for a suf-
     fix rule.

              Table of Standard Implicit (Suffix) Rules

     Use         Implicit  Command Line(s)
                 Rule

     Assembly     .s.o    $(COMPILE.s) -o $@ $<
     Files        .s      $(COMPILE.s) -o $@ $<
                  .s.a    $(COMPILE.s) -o $% $<
                          $(AR) $(ARFLAGS) $@ $%
                          $(RM) $%
                  .S.o    $(COMPILE.S) -o $@ $<
                  .S.a    $(COMPILE.S) -o $% $<
                          $(AR) $(ARFLAGS) $@ $%
                          $(RM) $%

     C            .c      $(LINK.c) -o $@ $< $(LDLIBS)
     Files        .c.ln   $(LINT.c) $(OUTPUT_OPTION) -i $<
                  .c.o    $(COMPILE.c) $(OUTPUT_OPTION) $<
                  .c.a    $(COMPILE.c) -o $% $<
                          $(AR) $(ARFLAGS) $@ $%
                          $(RM) $%

     C++          .cc      $(LINK.cc) -o $@ $< $(LDLIBS)
     Files        .cc.o    $(COMPILE.cc) $(OUTPUT_OPTION) $<
                  .cc.a    $(COMPILE.cc) -o $% $<
                           $(AR) $(ARFLAGS) $@ $%
                           $(RM) $%

     FORTRAN 77  .f       $(LINK.f) -o $@ $< $(LDLIBS)
     Files       .f.o     $(COMPILE.f) $(OUTPUT_OPTION) $<



Sun Microsystems    Last change: 16 Mar 1993                   16






make(1S)             SunOS Specific Commands             make(1S)



                 .f.a     $(COMPILE.f) -o $% $<
                          $(AR) $(ARFLAGS) $@ $%
                          $(RM) $%
                 .F       $(LINK.F) -o $@ $< $(LDLIBS)
                 .F.o     $(COMPILE.F) $(OUTPUT_OPTION) $<
                 .F.a     $(COMPILE.F) -o $% $<
                          $(AR) $(ARFLAGS) $@ $%
                          $(RM) $%

     lex         .l       $(RM) $*.c
     Files                $(LEX.l) $< > $*.c
                          $(LINK.c) -o $@ $*.c $(LDLIBS)
                          $(RM) $*.c
                 .l.c     $(RM) $@
                          $(LEX.l) $< > $@
                 .l.ln    $(RM) $*.c
                          $(LEX.l) $< > $*.c
                          $(LINT.c) -o $@ -i $*.c
                          $(RM) $*.c
                 .l.o     $(RM) $*.c
                          $(LEX.l) $< > $*.c
                          $(COMPILE.c) -o $@ $*.c
                          $(RM) $*.c

     Modula 2   .mod      $(COMPILE.mod) -o $@ -e $@ $<
     Files      .mod.o    $(COMPILE.mod) -o $@ $<
                .def.sym  $(COMPILE.def) -o $@ $<

     NeWS       .cps.h    cps $*.cps

     Pascal     .p        $(LINK.p) -o $@ $< $(LDLIBS)
     Files      .p.o      $(COMPILE.p) $(OUTPUT_OPTION) $<

     Ratfor     .r        $(LINK.r) -o $@ $< $(LDLIBS)
     Files      .r.o      $(COMPILE.r) $(OUTPUT_OPTION) $<
                .r.a      $(COMPILE.r) -o $% $<
                          $(AR) $(ARFLAGS) $@ $%
                          $(RM) $%

     SCCS       .SCCS_GET sccs $(SCCSFLAGS) get $(SCCSGETFLAGS) $@ -G$@
     Files

     Shell      .sh       cat $< >$@
     Scripts              chmod +x $@

     yacc       .y        $(YACC.y) $<
     Files                $(LINK.c) -o $@ y.tab.c $(LDLIBS)
                          $(RM) y.tab.c
                .y.c      $(YACC.y) $<
                          mv y.tab.c $@
                .y.ln     $(YACC.y) $<
                          $(LINT.c) -o $@ -i y.tab.c



Sun Microsystems    Last change: 16 Mar 1993                   17






make(1S)             SunOS Specific Commands             make(1S)



                          $(RM) y.tab.c
                .y.o      $(YACC.y) $<
                          $(COMPILE.c) -o $@ y.tab.c
                          $(RM) y.tab.c

     make reads in the standard set of implicit  rules  from  the
     file  </usr/share/lib/make/make.rules>,  unless   - r  is in
     effect, or there is a make.rules file in the local directory
     that does not include that file.

  The Suffixes List
     The suffixes list is given as the list of  dependencies  for
     the `.SUFFIXES:'  special-function target.  The default list
     is contained in the SUFFIXES macro (See _T_a_b_l_e _o_f  _P_r_e_d_e_f_i_n_e_d
     _M_a_c_r_o_s  for  the standard list of suffixes).  You can define
     additional .SUFFIXES: targets; a .SUFFIXES  target  with  no
     dependencies clears the list of suffixes.  Order is signifi-
     cant within the list; make selects a rule  that  corresponds
     to  the target's suffix and the first dependency-file suffix
     found in the list.  To place suffixes at  the  head  of  the
     list,  clear  the list and replace it with the new suffixes,
     followed by the default list:

          .SUFFIXES:
          .SUFFIXES: _s_u_f_f_i_x_e_s $(SUFFIXES)

     A tilde (~) indicates that if a  dependency  file  with  the
     indicated suffix (minus the ~) is under SCCS its most recent
     version should be retrieved, if necessary, before the target
     is processed.

  Library Maintenance
     A target name  of the form:

          _l_i_b(_m_e_m_b_e_r ...)

     refers to a member, or a space-separated list of members, in
     an ar(1) library.

     The dependency of the library member  on  the  corresponding
     file  must  be  given  as an explicit entry in the makefile.
     This can be handled by a pattern matching rule of the form:

          _l_i_b(%._s): %._s

     where ._s is the suffix of the member; this suffix  is  typi-
     cally .o for object libraries.

     A target name of the form

          _l_i_b((_s_y_m_b_o_l))




Sun Microsystems    Last change: 16 Mar 1993                   18






make(1S)             SunOS Specific Commands             make(1S)



     refers to the member of a  randomized  object  library  that
     defines the entry point named _s_y_m_b_o_l.

  Command Execution
     Command lines are executed one at a time, _e_a_c_h  _b_y  _i_t_s  _o_w_n
     _p_r_o_c_e_s_s  _o_r  _s_h_e_l_l. Shell commands, notably cd, are ineffec-
     tual across an unescaped NEWLINE in the makefile.  A line is
     printed  (after macro expansion) just before being executed.
     This is suppressed if it starts with a `@', if  there  is  a
     `.SILENT:'   entry  in  the makefile, or if make is run with
     the -s option.  Although the -n  option  specifies  printing
     without  execution,  lines  containing the macro $(MAKE) are
     executed regardless, and  lines  containing  the  @  special
     character  are  printed.   The -t (touch) option updates the
     modification date of a file  without  executing  any  rules.
     This  can  be  dangerous when sources are maintained by more
     than one person.

  Bourne Shell Constructs
     To use the Bourne shell if control structure for  branching,
     use a command line of the form:
          if _e_x_p_r_e_s_s_i_o_n ; \
          then _c_o_m_m_a_n_d ; \
               ... ; \
          else ; \
               ... ; \
          fi

     Although composed of several input lines, the  escaped  NEW-
     LINE  characters  insure  that  make  treats them all as one
     (shell) command line.

     To use the Bourne shell for control structure for loops, use
     a command line of the form:
          for _v_a_r in _l_i_s_t ; \
               do _c_o_m_m_a_n_d; \
               ... ;\
          done

     To refer to a shell variable,  use  an  escaped  dollar-sign
     (\$).  This prevents expansion of the dollar-sign by make.

  Command Substitutions
     To incorporate the standard output of a shell command  in  a
     macro, use a definition of the form:

          _M_A_C_R_O:sh =_c_o_m_m_a_n_d

     The command is executed only once, standard error output  is
     discarded,  and NEWLINE characters are replaced with SPACEs.
     If the command has a non-zero exit status, make  halts  with
     an error.



Sun Microsystems    Last change: 16 Mar 1993                   19






make(1S)             SunOS Specific Commands             make(1S)



     To capture the output of a shell command in a  macro  refer-
     ence, use a reference of the form:

          $(_M_A_C_R_O:sh)

     where _M_A_C_R_O is the name of a macro containing a valid Bourne
     shell  command  line.  In this case, the command is executed
     whenever the reference is evaluated.  As with shell  command
     substitutions,  the  reference is replaced with the standard
     output of the command.  If the command has a  non-zero  exit
     status, make halts with an error.

  _S_i_g_n_a_l_s
     INT, SIGTERM, and QUIT signals received  from  the  keyboard
     halt  make and remove the target file being processed unless
     that target is in the dependency list for `.PRECIOUS:'.

EXAMPLES
     This makefile says that pgm depends on  two  files  a.o  and
     b.o,  and  that  they  in turn depend on their corresponding
     source files (a.c and b.c) along with a common file incl.h:
          pgm: a.o b.o
               $(LINK.c) -o $@ a.o b.o
          a.o: incl.h a.c
               cc -c a.c
          b.o: incl.h b.c
               cc -c b.c

     The following makefile uses implicit rules  to  express  the
     same dependencies:
          pgm: a.o b.o
               cc a.o b.o -o pgm
          a.o b.o: incl.h

ENVIRONMENT
     KEEP_STATE
          This environment variable has the same  effect  as  the
          .KEEP_STATE:  special-function target.  It enables com-
          mand dependencies, hidden dependencies and  writing  of
          the state file.

     ATT_SV_MAKE
          This environment variable causes  make  to  invoke  the
          generic      System      V      version     of     make
          (/usr/ccs/lib/sv4.make).  See sysV-make(1).

FILES
     /usr/ccs/make       make
     makefile
     Makefile            current version(s) of  make  description
                         file
     SCCS/s.makefile



Sun Microsystems    Last change: 16 Mar 1993                   20






make(1S)             SunOS Specific Commands             make(1S)



     SCCS/s.Makefile     SCCS  history  files   for   the   above
                         makefile(s)
     make.rules          default file for  user-defined  targets,
                         macros, and implicit rules
     </usr/share/lib/make/make.rules>
                         makefile for standard implicit rules and
                         macros (not read if make.rules is)
     .make.state         state file in the local directory

SEE ALSO
     ar(1), cd(1), passwd(4)

     _S_o_l_a_r_i_s _2._3 _A_d_v_a_n_c_e_d _U_s_e_r'_s _G_u_i_d_e
     _S_u_n_O_S _5._3 _P_r_o_g_r_a_m_m_i_n_g _U_t_i_l_i_t_i_e_s

DIAGNOSTICS
     make returns an exit status of 1 when it halts as  a  result
     of an error.  Otherwise it returns an exit status of 0.

     Do not know how to make _t_a_r_g_e_t. Stop.
          There is no makefile entry  for  _t_a_r_g_e_t,  and  none  of
          make's  implicit  rules  apply  (there is no dependency
          file with  a  suffix  in  the  suffixes  list,  or  the
          target's suffix is not in the list).

     *** _t_a_r_g_e_t removed.
          make was interrupted  while  building  _t_a_r_g_e_t.   Rather
          than  leaving  a  partially-completed  version  that is
          newer than its  dependencies,  make  removes  the  file
          named _t_a_r_g_e_t.

     *** _t_a_r_g_e_t not removed.
          make was interrupted while building _t_a_r_g_e_t  and  _t_a_r_g_e_t
          was not present in the directory.

     *** _t_a_r_g_e_t could not be removed, _r_e_a_s_o_n
          make was interrupted while building _t_a_r_g_e_t,  which  was
          not removed for the indicated reason.

     Read of include file `_f_i_l_e' failed
          The makefile indicated in an include directive was  not
          found, or was inaccessible.

     Loop detected when expanding macro value `_m_a_c_r_o'
          A reference to the macro being defined was found in the
          definition.

     Could not write state file `_f_i_l_e'
          You used the .KEEP_STATE: target, but do not have write
          permission on the state file.

     *** Error code _n



Sun Microsystems    Last change: 16 Mar 1993                   21






make(1S)             SunOS Specific Commands             make(1S)



          The previous shell command  returned  a  nonzero  error
          code.

     *** _s_i_g_n_a_l _m_e_s_s_a_g_e
          The previous shell command was aborted due to a signal.
          If  ` -  core dumped' appears after the message, a core
          file was created.

     Conditional macro conflict encountered
          Displayed only when -d is in effect, this message indi-
          cates that two or more parallel targets currently being
          processed depend on a target which is built differently
          for  each  by  virtue of conditional macros.  Since the
          target cannot simultaneously  satisfy  both  dependency
          relationships, it is conflicted.

BUGS
     Some commands  return  nonzero  status  inappropriately;  to
     overcome  this difficulty, prefix the offending command line
     in the rule with a `-'.

     Filenames with the characters `=', `:', or `@', do not work.

     You cannot build file.o from lib(file.o).

     Options supplied by MAKEFLAGS should be reported for  nested
     make  commands.   Use the -d option to find out what options
     the nested command picks up from MAKEFLAGS.

     This version of make is  incompatible  in  certain  respects
     with previous versions:

          +o   The -d option output is much briefer in  this  ver-
             sion.    - dd now produces the equivalent voluminous
             output.

          +o   make attempts to derive values for the dynamic mac-
             ros  `$*', `$<', and `$?', while processing explicit
             targets.  It uses the same method  as  for  implicit
             rules;  in  some cases this can lead either to unex-
             pected values, or to an empty value being  assigned.
             (Actually,  this  was  true  for earlier versions as
             well, even though the  documentation  stated  other-
             wise.)

          +o   make no longer searches the current  directory  for
             SCCS history files.

          +o   Suffix replacement  in  macro  references  are  now
             applied after the macro is expanded.





Sun Microsystems    Last change: 16 Mar 1993                   22






make(1S)             SunOS Specific Commands             make(1S)



     There is no guarantee that makefiles created for  this  ver-
     sion of make will work with earlier versions.

     If there is no make.rules file in the current directory, and
     the  file  </usr/share/lib/make/make.rules> is missing, make
     stops before processing any targets.  To force make  to  run
     anyway,  create  an  empty  make.rules  file  in the current
     directory.

     Once a dependency is made, make assumes the dependency  file
     is  present  for the remainder of the run.  If a rule subse-
     quently removes that file and future targets depend  on  its
     existence, unexpected errors may result.

     When hidden dependency checking is in effect, the $? macro's
     value  includes  the names of hidden dependencies.  This can
     lead to improper filename arguments to commands when  $?  is
     used in a rule.

     Pattern replacement macro references cannot be used  in  the
     dependency list of a pattern matching rule.

     Unlike previous versions, this  version  of  make  strips  a
     leading `./' from the value of the `$@' dynamic macro.

     With automatic SCCS retrieval, this version of make does not
     support tilde suffix rules.

     The only dynamic macro whose value  is  strictly  determined
     when used in a dependency list is $@ (takes the form `$$@').

     make invokes the shell with the - e  (exit-on-errors)  argu-
     ment.   Thus,  with  semicolon-separated  command sequences,
     execution of the later commands depends on  the  success  of
     the  former.   This  is  consistent  with make's behavior of
     halting immediately when a problem  occurs,  but  cannot  be
     inferred from the syntax of the rule alone.


















Sun Microsystems    Last change: 16 Mar 1993                   23



