home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-bin / info / make.info-7 < prev    next >
Encoding:
GNU Info File  |  1996-10-12  |  36.9 KB  |  976 lines

  1. This is Info file make.info, produced by Makeinfo-1.64 from the input
  2. file /ade-src/fsf/make/make.texinfo.
  3.  
  4.    This file documents the GNU Make utility, which determines
  5. automatically which pieces of a large program need to be recompiled,
  6. and issues the commands to recompile them.
  7.  
  8.    This is Edition 0.51, last updated 9 May 1996, of `The GNU Make
  9. Manual', for `make', Version 3.75 Beta.
  10.  
  11.    Copyright (C) 1988, '89, '90, '91, '92, '93, '94, '95, '96
  12. Free Software Foundation, Inc.
  13.  
  14.    Permission is granted to make and distribute verbatim copies of this
  15. manual provided the copyright notice and this permission notice are
  16. preserved on all copies.
  17.  
  18.    Permission is granted to copy and distribute modified versions of
  19. this manual under the conditions for verbatim copying, provided that
  20. the entire resulting derived work is distributed under the terms of a
  21. permission notice identical to this one.
  22.  
  23.    Permission is granted to copy and distribute translations of this
  24. manual into another language, under the above conditions for modified
  25. versions, except that this permission notice may be stated in a
  26. translation approved by the Free Software Foundation.
  27.  
  28. 
  29. File: make.info,  Node: Directory Variables,  Next: Standard Targets,  Prev: Command Variables,  Up: Makefile Conventions
  30.  
  31. Variables for Installation Directories
  32. ======================================
  33.  
  34.    Installation directories should always be named by variables, so it
  35. is easy to install in a nonstandard place.  The standard names for these
  36. variables are described below.  They are based on a standard filesystem
  37. layout; variants of it are used in SVR4, 4.4BSD, Linux, Ultrix v4, and
  38. other modern operating systems.
  39.  
  40.    These two variables set the root for the installation.  All the other
  41. installation directories should be subdirectories of one of these two,
  42. and nothing should be directly installed into these two directories.
  43.  
  44. `prefix'
  45.      A prefix used in constructing the default values of the variables
  46.      listed below.  The default value of `prefix' should be
  47.      `/usr/local'.  When building the complete GNU system, the prefix
  48.      will be empty and `/usr' will be a symbolic link to `/'.  (If you
  49.      are using Autoconf, write it as `@prefix@'.)
  50.  
  51. `exec_prefix'
  52.      A prefix used in constructing the default values of some of the
  53.      variables listed below.  The default value of `exec_prefix' should
  54.      be `$(prefix)'.  (If you are using Autoconf, write it as
  55.      `@exec_prefix@'.)
  56.  
  57.      Generally, `$(exec_prefix)' is used for directories that contain
  58.      machine-specific files (such as executables and subroutine
  59.      libraries), while `$(prefix)' is used directly for other
  60.      directories.
  61.  
  62.    Executable programs are installed in one of the following
  63. directories.
  64.  
  65. `bindir'
  66.      The directory for installing executable programs that users can
  67.      run.  This should normally be `/usr/local/bin', but write it as
  68.      `$(exec_prefix)/bin'.  (If you are using Autoconf, write it as
  69.      `@bindir@'.)
  70.  
  71. `sbindir'
  72.      The directory for installing executable programs that can be run
  73.      from the shell, but are only generally useful to system
  74.      administrators.  This should normally be `/usr/local/sbin', but
  75.      write it as `$(exec_prefix)/sbin'.  (If you are using Autoconf,
  76.      write it as `@sbindir@'.)
  77.  
  78. `libexecdir'
  79.      The directory for installing executable programs to be run by other
  80.      programs rather than by users.  This directory should normally be
  81.      `/usr/local/libexec', but write it as `$(exec_prefix)/libexec'.
  82.      (If you are using Autoconf, write it as `@libexecdir@'.)
  83.  
  84.    Data files used by the program during its execution are divided into
  85. categories in two ways.
  86.  
  87.    * Some files are normally modified by programs; others are never
  88.      normally modified (though users may edit some of these).
  89.  
  90.    * Some files are architecture-independent and can be shared by all
  91.      machines at a site; some are architecture-dependent and can be
  92.      shared only by machines of the same kind and operating system;
  93.      others may never be shared between two machines.
  94.  
  95.    This makes for six different possibilities.  However, we want to
  96. discourage the use of architecture-dependent files, aside from object
  97. files and libraries.  It is much cleaner to make other data files
  98. architecture-independent, and it is generally not hard.
  99.  
  100.    Therefore, here are the variables Makefiles should use to specify
  101. directories:
  102.  
  103. `datadir'
  104.      The directory for installing read-only architecture independent
  105.      data files.  This should normally be `/usr/local/share', but write
  106.      it as `$(prefix)/share'.  (If you are using Autoconf, write it as
  107.      `@datadir@'.) As a special exception, see `$(infodir)' and
  108.      `$(includedir)' below.
  109.  
  110. `sysconfdir'
  111.      The directory for installing read-only data files that pertain to a
  112.      single machine-that is to say, files for configuring a host.
  113.      Mailer and network configuration files, `/etc/passwd', and so
  114.      forth belong here.  All the files in this directory should be
  115.      ordinary ASCII text files.  This directory should normally be
  116.      `/usr/local/etc', but write it as `$(prefix)/etc'.  (If you are
  117.      using Autoconf, write it as `@sysconfdir@'.)
  118.  
  119.      Do not install executables in this directory (they probably belong
  120.      in `$(libexecdir)' or `$(sbindir)').  Also do not install files
  121.      that are modified in the normal course of their use (programs
  122.      whose purpose is to change the configuration of the system
  123.      excluded).  Those probably belong in `$(localstatedir)'.
  124.  
  125. `sharedstatedir'
  126.      The directory for installing architecture-independent data files
  127.      which the programs modify while they run.  This should normally be
  128.      `/usr/local/com', but write it as `$(prefix)/com'.  (If you are
  129.      using Autoconf, write it as `@sharedstatedir@'.)
  130.  
  131. `localstatedir'
  132.      The directory for installing data files which the programs modify
  133.      while they run, and that pertain to one specific machine.  Users
  134.      should never need to modify files in this directory to configure
  135.      the package's operation; put such configuration information in
  136.      separate files that go in `$(datadir)' or `$(sysconfdir)'.
  137.      `$(localstatedir)' should normally be `/usr/local/var', but write
  138.      it as `$(prefix)/var'.  (If you are using Autoconf, write it as
  139.      `@localstatedir@'.)
  140.  
  141. `libdir'
  142.      The directory for object files and libraries of object code.  Do
  143.      not install executables here, they probably ought to go in
  144.      `$(libexecdir)' instead.  The value of `libdir' should normally be
  145.      `/usr/local/lib', but write it as `$(exec_prefix)/lib'.  (If you
  146.      are using Autoconf, write it as `@libdir@'.)
  147.  
  148. `infodir'
  149.      The directory for installing the Info files for this package.  By
  150.      default, it should be `/usr/local/info', but it should be written
  151.      as `$(prefix)/info'.  (If you are using Autoconf, write it as
  152.      `@infodir@'.)
  153.  
  154. `lispdir'
  155.      The directory for installing any Emacs Lisp files in this package.
  156.      By default, it should be `/usr/local/share/emacs/site-lisp', but
  157.      it should be written as `$(prefix)/share/emacs/site-lisp'.
  158.  
  159.      If you are using Autoconf, write the default as `@lispdir@'.  In
  160.      order to make `@lispdir@' work, you need the following lines in
  161.      your `configure.in' file:
  162.  
  163.           lispdir='${datadir}/emacs/site-lisp'
  164.           AC_SUBST(lispdir)
  165.  
  166. `includedir'
  167.      The directory for installing header files to be included by user
  168.      programs with the C `#include' preprocessor directive.  This
  169.      should normally be `/usr/local/include', but write it as
  170.      `$(prefix)/include'.  (If you are using Autoconf, write it as
  171.      `@includedir@'.)
  172.  
  173.      Most compilers other than GCC do not look for header files in
  174.      `/usr/local/include'.  So installing the header files this way is
  175.      only useful with GCC.  Sometimes this is not a problem because some
  176.      libraries are only really intended to work with GCC.  But some
  177.      libraries are intended to work with other compilers.  They should
  178.      install their header files in two places, one specified by
  179.      `includedir' and one specified by `oldincludedir'.
  180.  
  181. `oldincludedir'
  182.      The directory for installing `#include' header files for use with
  183.      compilers other than GCC.  This should normally be `/usr/include'.
  184.      (If you are using Autoconf, you can write it as `@oldincludedir@'.)
  185.  
  186.      The Makefile commands should check whether the value of
  187.      `oldincludedir' is empty.  If it is, they should not try to use
  188.      it; they should cancel the second installation of the header files.
  189.  
  190.      A package should not replace an existing header in this directory
  191.      unless the header came from the same package.  Thus, if your Foo
  192.      package provides a header file `foo.h', then it should install the
  193.      header file in the `oldincludedir' directory if either (1) there
  194.      is no `foo.h' there or (2) the `foo.h' that exists came from the
  195.      Foo package.
  196.  
  197.      To tell whether `foo.h' came from the Foo package, put a magic
  198.      string in the file--part of a comment--and `grep' for that string.
  199.  
  200.    Unix-style man pages are installed in one of the following:
  201.  
  202. `mandir'
  203.      The top-level directory for installing the man pages (if any) for
  204.      this package.  It will normally be `/usr/local/man', but you should
  205.      write it as `$(prefix)/man'.  (If you are using Autoconf, write it
  206.      as `@mandir@'.)
  207.  
  208. `man1dir'
  209.      The directory for installing section 1 man pages.  Write it as
  210.      `$(mandir)/man1'.
  211.  
  212. `man2dir'
  213.      The directory for installing section 2 man pages.  Write it as
  214.      `$(mandir)/man2'
  215.  
  216. `...'
  217.      *Don't make the primary documentation for any GNU software be a
  218.      man page.  Write a manual in Texinfo instead.  Man pages are just
  219.      for the sake of people running GNU software on Unix, which is a
  220.      secondary application only.*
  221.  
  222. `manext'
  223.      The file name extension for the installed man page.  This should
  224.      contain a period followed by the appropriate digit; it should
  225.      normally be `.1'.
  226.  
  227. `man1ext'
  228.      The file name extension for installed section 1 man pages.
  229.  
  230. `man2ext'
  231.      The file name extension for installed section 2 man pages.
  232.  
  233. `...'
  234.      Use these names instead of `manext' if the package needs to
  235.      install man pages in more than one section of the manual.
  236.  
  237.    And finally, you should set the following variable:
  238.  
  239. `srcdir'
  240.      The directory for the sources being compiled.  The value of this
  241.      variable is normally inserted by the `configure' shell script.
  242.      (If you are using Autconf, use `srcdir = @srcdir@'.)
  243.  
  244.    For example:
  245.  
  246.      # Common prefix for installation directories.
  247.      # NOTE: This directory must exist when you start the install.
  248.      prefix = /usr/local
  249.      exec_prefix = $(prefix)
  250.      # Where to put the executable for the command `gcc'.
  251.      bindir = $(exec_prefix)/bin
  252.      # Where to put the directories used by the compiler.
  253.      libexecdir = $(exec_prefix)/libexec
  254.      # Where to put the Info files.
  255.      infodir = $(prefix)/info
  256.  
  257.    If your program installs a large number of files into one of the
  258. standard user-specified directories, it might be useful to group them
  259. into a subdirectory particular to that program.  If you do this, you
  260. should write the `install' rule to create these subdirectories.
  261.  
  262.    Do not expect the user to include the subdirectory name in the value
  263. of any of the variables listed above.  The idea of having a uniform set
  264. of variable names for installation directories is to enable the user to
  265. specify the exact same values for several different GNU packages.  In
  266. order for this to be useful, all the packages must be designed so that
  267. they will work sensibly when the user does so.
  268.  
  269. 
  270. File: make.info,  Node: Standard Targets,  Prev: Directory Variables,  Up: Makefile Conventions
  271.  
  272. Standard Targets for Users
  273. ==========================
  274.  
  275.    All GNU programs should have the following targets in their
  276. Makefiles:
  277.  
  278. `all'
  279.      Compile the entire program.  This should be the default target.
  280.      This target need not rebuild any documentation files; Info files
  281.      should normally be included in the distribution, and DVI files
  282.      should be made only when explicitly asked for.
  283.  
  284.      By default, the Make rules should compile and link with `-g', so
  285.      that executable programs have debugging symbols.  Users who don't
  286.      mind being helpless can strip the executables later if they wish.
  287.  
  288. `install'
  289.      Compile the program and copy the executables, libraries, and so on
  290.      to the file names where they should reside for actual use.  If
  291.      there is a simple test to verify that a program is properly
  292.      installed, this target should run that test.
  293.  
  294.      Do not strip executables when installing them.  Devil-may-care
  295.      users can use the `install-strip' target to do that.
  296.  
  297.      If possible, write the `install' target rule so that it does not
  298.      modify anything in the directory where the program was built,
  299.      provided `make all' has just been done.  This is convenient for
  300.      building the program under one user name and installing it under
  301.      another.
  302.  
  303.      The commands should create all the directories in which files are
  304.      to be installed, if they don't already exist.  This includes the
  305.      directories specified as the values of the variables `prefix' and
  306.      `exec_prefix', as well as all subdirectories that are needed.  One
  307.      way to do this is by means of an `installdirs' target as described
  308.      below.
  309.  
  310.      Use `-' before any command for installing a man page, so that
  311.      `make' will ignore any errors.  This is in case there are systems
  312.      that don't have the Unix man page documentation system installed.
  313.  
  314.      The way to install Info files is to copy them into `$(infodir)'
  315.      with `$(INSTALL_DATA)' (*note Command Variables::.), and then run
  316.      the `install-info' program if it is present.  `install-info' is a
  317.      program that edits the Info `dir' file to add or update the menu
  318.      entry for the given Info file; it is part of the Texinfo package.
  319.      Here is a sample rule to install an Info file:
  320.  
  321.           $(infodir)/foo.info: foo.info
  322.           # There may be a newer info file in . than in srcdir.
  323.                   -if test -f foo.info; then d=.; \
  324.                    else d=$(srcdir); fi; \
  325.                   $(INSTALL_DATA) $$d/foo.info $@; \
  326.           # Run install-info only if it exists.
  327.           # Use `if' instead of just prepending `-' to the
  328.           # line so we notice real errors from install-info.
  329.           # We use `$(SHELL) -c' because some shells do not
  330.           # fail gracefully when there is an unknown command.
  331.                   if $(SHELL) -c 'install-info --version' \
  332.                      >/dev/null 2>&1; then \
  333.                     install-info --dir-file=$(infodir)/dir \
  334.                                  $(infodir)/foo.info; \
  335.                   else true; fi
  336.  
  337. `uninstall'
  338.      Delete all the installed files that the `install' target would
  339.      create (but not the noninstalled files such as `make all' would
  340.      create).
  341.  
  342.      This rule should not modify the directories where compilation is
  343.      done, only the directories where files are installed.
  344.  
  345. `install-strip'
  346.      Like `install', but strip the executable files while installing
  347.      them.  The definition of this target can be very simple:
  348.  
  349.           install-strip:
  350.                   $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' \
  351.                           install
  352.  
  353.      Normally we do not recommend stripping an executable unless you
  354.      are sure the program has no bugs.  However, it can be reasonable
  355.      to install a stripped executable for actual execution while saving
  356.      the unstripped executable elsewhere in case there is a bug.
  357.  
  358. `clean'
  359.      Delete all files from the current directory that are normally
  360.      created by building the program.  Don't delete the files that
  361.      record the configuration.  Also preserve files that could be made
  362.      by building, but normally aren't because the distribution comes
  363.      with them.
  364.  
  365.      Delete `.dvi' files here if they are not part of the distribution.
  366.  
  367. `distclean'
  368.      Delete all files from the current directory that are created by
  369.      configuring or building the program.  If you have unpacked the
  370.      source and built the program without creating any other files,
  371.      `make distclean' should leave only the files that were in the
  372.      distribution.
  373.  
  374. `mostlyclean'
  375.      Like `clean', but may refrain from deleting a few files that people
  376.      normally don't want to recompile.  For example, the `mostlyclean'
  377.      target for GCC does not delete `libgcc.a', because recompiling it
  378.      is rarely necessary and takes a lot of time.
  379.  
  380. `maintainer-clean'
  381.      Delete almost everything from the current directory that can be
  382.      reconstructed with this Makefile.  This typically includes
  383.      everything deleted by `distclean', plus more: C source files
  384.      produced by Bison, tags tables, Info files, and so on.
  385.  
  386.      The reason we say "almost everything" is that running the command
  387.      `make maintainer-clean' should not delete `configure' even if
  388.      `configure' can be remade using a rule in the Makefile.  More
  389.      generally, `make maintainer-clean' should not delete anything that
  390.      needs to exist in order to run `configure' and then begin to build
  391.      the program.  This is the only exception; `maintainer-clean' should
  392.      delete everything else that can be rebuilt.
  393.  
  394.      The `maintainer-clean' target is intended to be used by a
  395.      maintainer of the package, not by ordinary users.  You may need
  396.      special tools to reconstruct some of the files that `make
  397.      maintainer-clean' deletes.  Since these files are normally
  398.      included in the distribution, we don't take care to make them easy
  399.      to reconstruct.  If you find you need to unpack the full
  400.      distribution again, don't blame us.
  401.  
  402.      To help make users aware of this, the commands for the special
  403.      `maintainer-clean' target should start with these two:
  404.  
  405.           @echo 'This command is intended for maintainers to use; it'
  406.           @echo 'deletes files that may need special tools to rebuild.'
  407.  
  408. `TAGS'
  409.      Update a tags table for this program.
  410.  
  411. `info'
  412.      Generate any Info files needed.  The best way to write the rules
  413.      is as follows:
  414.  
  415.           info: foo.info
  416.           
  417.           foo.info: foo.texi chap1.texi chap2.texi
  418.                   $(MAKEINFO) $(srcdir)/foo.texi
  419.  
  420.      You must define the variable `MAKEINFO' in the Makefile.  It should
  421.      run the `makeinfo' program, which is part of the Texinfo
  422.      distribution.
  423.  
  424. `dvi'
  425.      Generate DVI files for all Texinfo documentation.  For example:
  426.  
  427.           dvi: foo.dvi
  428.           
  429.           foo.dvi: foo.texi chap1.texi chap2.texi
  430.                   $(TEXI2DVI) $(srcdir)/foo.texi
  431.  
  432.      You must define the variable `TEXI2DVI' in the Makefile.  It should
  433.      run the program `texi2dvi', which is part of the Texinfo
  434.      distribution.(1)  Alternatively, write just the dependencies, and
  435.      allow GNU `make' to provide the command.
  436.  
  437. `dist'
  438.      Create a distribution tar file for this program.  The tar file
  439.      should be set up so that the file names in the tar file start with
  440.      a subdirectory name which is the name of the package it is a
  441.      distribution for.  This name can include the version number.
  442.  
  443.      For example, the distribution tar file of GCC version 1.40 unpacks
  444.      into a subdirectory named `gcc-1.40'.
  445.  
  446.      The easiest way to do this is to create a subdirectory
  447.      appropriately named, use `ln' or `cp' to install the proper files
  448.      in it, and then `tar' that subdirectory.
  449.  
  450.      Compress the tar file file with `gzip'.  For example, the actual
  451.      distribution file for GCC version 1.40 is called `gcc-1.40.tar.gz'.
  452.  
  453.      The `dist' target should explicitly depend on all non-source files
  454.      that are in the distribution, to make sure they are up to date in
  455.      the distribution.  *Note Making Releases: (standards)Releases.
  456.  
  457. `check'
  458.      Perform self-tests (if any).  The user must build the program
  459.      before running the tests, but need not install the program; you
  460.      should write the self-tests so that they work when the program is
  461.      built but not installed.
  462.  
  463.    The following targets are suggested as conventional names, for
  464. programs in which they are useful.
  465.  
  466. `installcheck'
  467.      Perform installation tests (if any).  The user must build and
  468.      install the program before running the tests.  You should not
  469.      assume that `$(bindir)' is in the search path.
  470.  
  471. `installdirs'
  472.      It's useful to add a target named `installdirs' to create the
  473.      directories where files are installed, and their parent
  474.      directories.  There is a script called `mkinstalldirs' which is
  475.      convenient for this; you can find it in the Texinfo package.  You
  476.      can use a rule like this:
  477.  
  478.           # Make sure all installation directories (e.g. $(bindir))
  479.           # actually exist by making them if necessary.
  480.           installdirs: mkinstalldirs
  481.                   $(srcdir)/mkinstalldirs $(bindir) $(datadir) \
  482.                                           $(libdir) $(infodir) \
  483.                                           $(mandir)
  484.  
  485.      This rule should not modify the directories where compilation is
  486.      done.  It should do nothing but create installation directories.
  487.  
  488.    ---------- Footnotes ----------
  489.  
  490.    (1)  `texi2dvi' uses TeX to do the real work of formatting. TeX is
  491. not distributed with Texinfo.
  492.  
  493. 
  494. File: make.info,  Node: Quick Reference,  Next: Complex Makefile,  Prev: Makefile Conventions,  Up: Top
  495.  
  496. Quick Reference
  497. ***************
  498.  
  499.    This appendix summarizes the directives, text manipulation functions,
  500. and special variables which GNU `make' understands.  *Note Special
  501. Targets::, *Note Catalogue of Implicit Rules: Catalogue of Rules, and
  502. *Note Summary of Options: Options Summary, for other summaries.
  503.  
  504.    Here is a summary of the directives GNU `make' recognizes:
  505.  
  506. `define VARIABLE'
  507. `endef'
  508.      Define a multi-line, recursively-expanded variable.
  509.      *Note Sequences::.
  510.  
  511. `ifdef VARIABLE'
  512. `ifndef VARIABLE'
  513. `ifeq (A,B)'
  514. `ifeq "A" "B"'
  515. `ifeq 'A' 'B''
  516. `ifneq (A,B)'
  517. `ifneq "A" "B"'
  518. `ifneq 'A' 'B''
  519. `else'
  520. `endif'
  521.      Conditionally evaluate part of the makefile.
  522.      *Note Conditionals::.
  523.  
  524. `include FILE'
  525.      Include another makefile.
  526.      *Note Including Other Makefiles: Include.
  527.  
  528. `override VARIABLE = VALUE'
  529. `override VARIABLE := VALUE'
  530. `override VARIABLE += VALUE'
  531. `override define VARIABLE'
  532. `endef'
  533.      Define a variable, overriding any previous definition, even one
  534.      from the command line.
  535.      *Note The `override' Directive: Override Directive.
  536.  
  537. `export'
  538.      Tell `make' to export all variables to child processes by default.
  539.      *Note Communicating Variables to a Sub-`make': Variables/Recursion.
  540.  
  541. `export VARIABLE'
  542. `export VARIABLE = VALUE'
  543. `export VARIABLE := VALUE'
  544. `export VARIABLE += VALUE'
  545. `unexport VARIABLE'
  546.      Tell `make' whether or not to export a particular variable to child
  547.      processes.
  548.      *Note Communicating Variables to a Sub-`make': Variables/Recursion.
  549.  
  550. `vpath PATTERN PATH'
  551.      Specify a search path for files matching a `%' pattern.
  552.      *Note The `vpath' Directive: Selective Search.
  553.  
  554. `vpath PATTERN'
  555.      Remove all search paths previously specified for PATTERN.
  556.  
  557. `vpath'
  558.      Remove all search paths previously specified in any `vpath'
  559.      directive.
  560.  
  561.    Here is a summary of the text manipulation functions (*note
  562. Functions::.):
  563.  
  564. `$(subst FROM,TO,TEXT)'
  565.      Replace FROM with TO in TEXT.
  566.      *Note Functions for String Substitution and Analysis: Text
  567.      Functions.
  568.  
  569. `$(patsubst PATTERN,REPLACEMENT,TEXT)'
  570.      Replace words matching PATTERN with REPLACEMENT in TEXT.
  571.      *Note Functions for String Substitution and Analysis: Text
  572.      Functions.
  573.  
  574. `$(strip STRING)'
  575.      Remove excess whitespace characters from STRING.
  576.      *Note Functions for String Substitution and Analysis: Text
  577.      Functions.
  578.  
  579. `$(findstring FIND,TEXT)'
  580.      Locate FIND in TEXT.
  581.      *Note Functions for String Substitution and Analysis: Text
  582.      Functions.
  583.  
  584. `$(filter PATTERN...,TEXT)'
  585.      Select words in TEXT that match one of the PATTERN words.
  586.      *Note Functions for String Substitution and Analysis: Text
  587.      Functions.
  588.  
  589. `$(filter-out PATTERN...,TEXT)'
  590.      Select words in TEXT that *do not* match any of the PATTERN words.
  591.      *Note Functions for String Substitution and Analysis: Text
  592.      Functions.
  593.  
  594. `$(sort LIST)'
  595.      Sort the words in LIST lexicographically, removing duplicates.
  596.      *Note Functions for String Substitution and Analysis: Text
  597.      Functions.
  598.  
  599. `$(dir NAMES...)'
  600.      Extract the directory part of each file name.
  601.      *Note Functions for File Names: Filename Functions.
  602.  
  603. `$(notdir NAMES...)'
  604.      Extract the non-directory part of each file name.
  605.      *Note Functions for File Names: Filename Functions.
  606.  
  607. `$(suffix NAMES...)'
  608.      Extract the suffix (the last `.' and following characters) of each
  609.      file name.
  610.      *Note Functions for File Names: Filename Functions.
  611.  
  612. `$(basename NAMES...)'
  613.      Extract the base name (name without suffix) of each file name.
  614.      *Note Functions for File Names: Filename Functions.
  615.  
  616. `$(addsuffix SUFFIX,NAMES...)'
  617.      Append SUFFIX to each word in NAMES.
  618.      *Note Functions for File Names: Filename Functions.
  619.  
  620. `$(addprefix PREFIX,NAMES...)'
  621.      Prepend PREFIX to each word in NAMES.
  622.      *Note Functions for File Names: Filename Functions.
  623.  
  624. `$(join LIST1,LIST2)'
  625.      Join two parallel lists of words.
  626.      *Note Functions for File Names: Filename Functions.
  627.  
  628. `$(word N,TEXT)'
  629.      Extract the Nth word (one-origin) of TEXT.
  630.      *Note Functions for File Names: Filename Functions.
  631.  
  632. `$(words TEXT)'
  633.      Count the number of words in TEXT.
  634.      *Note Functions for File Names: Filename Functions.
  635.  
  636. `$(firstword NAMES...)'
  637.      Extract the first word of NAMES.
  638.      *Note Functions for File Names: Filename Functions.
  639.  
  640. `$(wildcard PATTERN...)'
  641.      Find file names matching a shell file name pattern (*not* a `%'
  642.      pattern).
  643.      *Note The Function `wildcard': Wildcard Function.
  644.  
  645. `$(shell COMMAND)'
  646.      Execute a shell command and return its output.
  647.      *Note The `shell' Function: Shell Function.
  648.  
  649. `$(origin VARIABLE)'
  650.      Return a string describing how the `make' variable VARIABLE was
  651.      defined.
  652.      *Note The `origin' Function: Origin Function.
  653.  
  654. `$(foreach VAR,WORDS,TEXT)'
  655.      Evaluate TEXT with VAR bound to each word in WORDS, and
  656.      concatenate the results.
  657.      *Note The `foreach' Function: Foreach Function.
  658.  
  659.    Here is a summary of the automatic variables.  *Note Automatic
  660. Variables: Automatic, for full information.
  661.  
  662. `$@'
  663.      The file name of the target.
  664.  
  665. `$%'
  666.      The target member name, when the target is an archive member.
  667.  
  668. `$<'
  669.      The name of the first dependency.
  670.  
  671. `$?'
  672.      The names of all the dependencies that are newer than the target,
  673.      with spaces between them.  For dependencies which are archive
  674.      members, only the member named is used (*note Archives::.).
  675.  
  676. `$^'
  677. `$+'
  678.      The names of all the dependencies, with spaces between them.  For
  679.      dependencies which are archive members, only the member named is
  680.      used (*note Archives::.).  The value of `$^' omits duplicate
  681.      dependencies, while `$+' retains them and preserves their order.
  682.  
  683. `$*'
  684.      The stem with which an implicit rule matches (*note How Patterns
  685.      Match: Pattern Match.).
  686.  
  687. `$(@D)'
  688. `$(@F)'
  689.      The directory part and the file-within-directory part of `$@'.
  690.  
  691. `$(*D)'
  692. `$(*F)'
  693.      The directory part and the file-within-directory part of `$*'.
  694.  
  695. `$(%D)'
  696. `$(%F)'
  697.      The directory part and the file-within-directory part of `$%'.
  698.  
  699. `$(<D)'
  700. `$(<F)'
  701.      The directory part and the file-within-directory part of `$<'.
  702.  
  703. `$(^D)'
  704. `$(^F)'
  705.      The directory part and the file-within-directory part of `$^'.
  706.  
  707. `$(+D)'
  708. `$(+F)'
  709.      The directory part and the file-within-directory part of `$+'.
  710.  
  711. `$(?D)'
  712. `$(?F)'
  713.      The directory part and the file-within-directory part of `$?'.
  714.  
  715.    These variables are used specially by GNU `make':
  716.  
  717. `MAKEFILES'
  718.      Makefiles to be read on every invocation of `make'.
  719.      *Note The Variable `MAKEFILES': MAKEFILES Variable.
  720.  
  721. `VPATH'
  722.      Directory search path for files not found in the current directory.
  723.      *Note `VPATH' Search Path for All Dependencies: General Search.
  724.  
  725. `SHELL'
  726.      The name of the system default command interpreter, usually
  727.      `/bin/sh'.  You can set `SHELL' in the makefile to change the
  728.      shell used to run commands.  *Note Command Execution: Execution.
  729.  
  730. `MAKE'
  731.      The name with which `make' was invoked.  Using this variable in
  732.      commands has special meaning.  *Note How the `MAKE' Variable
  733.      Works: MAKE Variable.
  734.  
  735. `MAKELEVEL'
  736.      The number of levels of recursion (sub-`make's).
  737.      *Note Variables/Recursion::.
  738.  
  739. `MAKEFLAGS'
  740.      The flags given to `make'.  You can set this in the environment or
  741.      a makefile to set flags.
  742.      *Note Communicating Options to a Sub-`make': Options/Recursion.
  743.  
  744. `SUFFIXES'
  745.      The default list of suffixes before `make' reads any makefiles.
  746.  
  747. 
  748. File: make.info,  Node: Complex Makefile,  Next: Concept Index,  Prev: Quick Reference,  Up: Top
  749.  
  750. Complex Makefile Example
  751. ************************
  752.  
  753.    Here is the makefile for the GNU `tar' program.  This is a
  754. moderately complex makefile.
  755.  
  756.    Because it is the first target, the default goal is `all'.  An
  757. interesting feature of this makefile is that `testpad.h' is a source
  758. file automatically created by the `testpad' program, itself compiled
  759. from `testpad.c'.
  760.  
  761.    If you type `make' or `make all', then `make' creates the `tar'
  762. executable, the `rmt' daemon that provides remote tape access, and the
  763. `tar.info' Info file.
  764.  
  765.    If you type `make install', then `make' not only creates `tar',
  766. `rmt', and `tar.info', but also installs them.
  767.  
  768.    If you type `make clean', then `make' removes the `.o' files, and
  769. the `tar', `rmt', `testpad', `testpad.h', and `core' files.
  770.  
  771.    If you type `make distclean', then `make' not only removes the same
  772. files as does `make clean' but also the `TAGS', `Makefile', and
  773. `config.status' files.  (Although it is not evident, this makefile (and
  774. `config.status') is generated by the user with the `configure' program,
  775. which is provided in the `tar' distribution, but is not shown here.)
  776.  
  777.    If you type `make realclean', then `make' removes the same files as
  778. does `make distclean' and also removes the Info files generated from
  779. `tar.texinfo'.
  780.  
  781.    In addition, there are targets `shar' and `dist' that create
  782. distribution kits.
  783.  
  784.      # Generated automatically from Makefile.in by configure.
  785.      # Un*x Makefile for GNU tar program.
  786.      # Copyright (C) 1991 Free Software Foundation, Inc.
  787.      
  788.      # This program is free software; you can redistribute
  789.      # it and/or modify it under the terms of the GNU
  790.      # General Public License ...
  791.      ...
  792.      ...
  793.      
  794.      SHELL = /bin/sh
  795.      
  796.      #### Start of system configuration section. ####
  797.      
  798.      srcdir = .
  799.      
  800.      # If you use gcc, you should either run the
  801.      # fixincludes script that comes with it or else use
  802.      # gcc with the -traditional option.  Otherwise ioctl
  803.      # calls will be compiled incorrectly on some systems.
  804.      CC = gcc -O
  805.      YACC = bison -y
  806.      INSTALL = /usr/local/bin/install -c
  807.      INSTALLDATA = /usr/local/bin/install -c -m 644
  808.      
  809.      # Things you might add to DEFS:
  810.      # -DSTDC_HEADERS        If you have ANSI C headers and
  811.      #                       libraries.
  812.      # -DPOSIX               If you have POSIX.1 headers and
  813.      #                       libraries.
  814.      # -DBSD42               If you have sys/dir.h (unless
  815.      #                       you use -DPOSIX), sys/file.h,
  816.      #                       and st_blocks in `struct stat'.
  817.      # -DUSG                 If you have System V/ANSI C
  818.      #                       string and memory functions
  819.      #                       and headers, sys/sysmacros.h,
  820.      #                       fcntl.h, getcwd, no valloc,
  821.      #                       and ndir.h (unless
  822.      #                       you use -DDIRENT).
  823.      # -DNO_MEMORY_H         If USG or STDC_HEADERS but do not
  824.      #                       include memory.h.
  825.      # -DDIRENT              If USG and you have dirent.h
  826.      #                       instead of ndir.h.
  827.      # -DSIGTYPE=int         If your signal handlers
  828.      #                       return int, not void.
  829.      # -DNO_MTIO             If you lack sys/mtio.h
  830.      #                       (magtape ioctls).
  831.      # -DNO_REMOTE           If you do not have a remote shell
  832.      #                       or rexec.
  833.      # -DUSE_REXEC           To use rexec for remote tape
  834.      #                       operations instead of
  835.      #                       forking rsh or remsh.
  836.      # -DVPRINTF_MISSING     If you lack vprintf function
  837.      #                       (but have _doprnt).
  838.      # -DDOPRNT_MISSING      If you lack _doprnt function.
  839.      #                       Also need to define
  840.      #                       -DVPRINTF_MISSING.
  841.      # -DFTIME_MISSING       If you lack ftime system call.
  842.      # -DSTRSTR_MISSING      If you lack strstr function.
  843.      # -DVALLOC_MISSING      If you lack valloc function.
  844.      # -DMKDIR_MISSING       If you lack mkdir and
  845.      #                       rmdir system calls.
  846.      # -DRENAME_MISSING      If you lack rename system call.
  847.      # -DFTRUNCATE_MISSING   If you lack ftruncate
  848.      #                       system call.
  849.      # -DV7                  On Version 7 Unix (not
  850.      #                       tested in a long time).
  851.      # -DEMUL_OPEN3          If you lack a 3-argument version
  852.      #                       of open, and want to emulate it
  853.      #                       with system calls you do have.
  854.      # -DNO_OPEN3            If you lack the 3-argument open
  855.      #                       and want to disable the tar -k
  856.      #                       option instead of emulating open.
  857.      # -DXENIX               If you have sys/inode.h
  858.      #                       and need it 94 to be included.
  859.      
  860.      DEFS =  -DSIGTYPE=int -DDIRENT -DSTRSTR_MISSING \
  861.              -DVPRINTF_MISSING -DBSD42
  862.      # Set this to rtapelib.o unless you defined NO_REMOTE,
  863.      # in which case make it empty.
  864.      RTAPELIB = rtapelib.o
  865.      LIBS =
  866.      DEF_AR_FILE = /dev/rmt8
  867.      DEFBLOCKING = 20
  868.      
  869.      CDEBUG = -g
  870.      CFLAGS = $(CDEBUG) -I. -I$(srcdir) $(DEFS) \
  871.              -DDEF_AR_FILE=\"$(DEF_AR_FILE)\" \
  872.              -DDEFBLOCKING=$(DEFBLOCKING)
  873.      LDFLAGS = -g
  874.      
  875.      prefix = /usr/local
  876.      # Prefix for each installed program,
  877.      # normally empty or `g'.
  878.      binprefix =
  879.      
  880.      # The directory to install tar in.
  881.      bindir = $(prefix)/bin
  882.      
  883.      # The directory to install the info files in.
  884.      infodir = $(prefix)/info
  885.      
  886.      #### End of system configuration section. ####
  887.      
  888.      SRC1 =  tar.c create.c extract.c buffer.c \
  889.              getoldopt.c update.c gnu.c mangle.c
  890.      SRC2 =  version.c list.c names.c diffarch.c \
  891.              port.c wildmat.c getopt.c
  892.      SRC3 =  getopt1.c regex.c getdate.y
  893.      SRCS =  $(SRC1) $(SRC2) $(SRC3)
  894.      OBJ1 =  tar.o create.o extract.o buffer.o \
  895.              getoldopt.o update.o gnu.o mangle.o
  896.      OBJ2 =  version.o list.o names.o diffarch.o \
  897.              port.o wildmat.o getopt.o
  898.      OBJ3 =  getopt1.o regex.o getdate.o $(RTAPELIB)
  899.      OBJS =  $(OBJ1) $(OBJ2) $(OBJ3)
  900.      AUX =   README COPYING ChangeLog Makefile.in  \
  901.              makefile.pc configure configure.in \
  902.              tar.texinfo tar.info* texinfo.tex \
  903.              tar.h port.h open3.h getopt.h regex.h \
  904.              rmt.h rmt.c rtapelib.c alloca.c \
  905.              msd_dir.h msd_dir.c tcexparg.c \
  906.              level-0 level-1 backup-specs testpad.c
  907.      
  908.      all:    tar rmt tar.info
  909.      
  910.      tar:    $(OBJS)
  911.              $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
  912.      
  913.      rmt:    rmt.c
  914.              $(CC) $(CFLAGS) $(LDFLAGS) -o $@ rmt.c
  915.      
  916.      tar.info: tar.texinfo
  917.              makeinfo tar.texinfo
  918.      
  919.      install: all
  920.              $(INSTALL) tar $(bindir)/$(binprefix)tar
  921.              -test ! -f rmt || $(INSTALL) rmt /etc/rmt
  922.              $(INSTALLDATA) $(srcdir)/tar.info* $(infodir)
  923.      
  924.      $(OBJS): tar.h port.h testpad.h
  925.      regex.o buffer.o tar.o: regex.h
  926.      # getdate.y has 8 shift/reduce conflicts.
  927.      
  928.      testpad.h: testpad
  929.              ./testpad
  930.      
  931.      testpad: testpad.o
  932.              $(CC) -o $@ testpad.o
  933.      
  934.      TAGS:   $(SRCS)
  935.              etags $(SRCS)
  936.      
  937.      clean:
  938.              rm -f *.o tar rmt testpad testpad.h core
  939.      
  940.      distclean: clean
  941.              rm -f TAGS Makefile config.status
  942.      
  943.      realclean: distclean
  944.              rm -f tar.info*
  945.      
  946.      shar: $(SRCS) $(AUX)
  947.              shar $(SRCS) $(AUX) | compress \
  948.                > tar-`sed -e '/version_string/!d' \
  949.                           -e 's/[^0-9.]*\([0-9.]*\).*/\1/' \
  950.                           -e q
  951.                           version.c`.shar.Z
  952.      
  953.      dist: $(SRCS) $(AUX)
  954.              echo tar-`sed \
  955.                   -e '/version_string/!d' \
  956.                   -e 's/[^0-9.]*\([0-9.]*\).*/\1/' \
  957.                   -e q
  958.                   version.c` > .fname
  959.              -rm -rf `cat .fname`
  960.              mkdir `cat .fname`
  961.              ln $(SRCS) $(AUX) `cat .fname`
  962.              -rm -rf `cat .fname` .fname
  963.              tar chZf `cat .fname`.tar.Z `cat .fname`
  964.      
  965.      tar.zoo: $(SRCS) $(AUX)
  966.              -rm -rf tmp.dir
  967.              -mkdir tmp.dir
  968.              -rm tar.zoo
  969.              for X in $(SRCS) $(AUX) ; do \
  970.                  echo $$X ; \
  971.                  sed 's/$$/^M/' $$X \
  972.                  > tmp.dir/$$X ; done
  973.              cd tmp.dir ; zoo aM ../tar.zoo *
  974.              -rm -rf tmp.dir
  975.  
  976.