Ignore:
Timestamp:
Sep 15, 2006, 7:09:38 AM (19 years ago)
Author:
bird
Message:

Untested merge with GNU Make v3.81 (vendor/gnumake/2005-05-16 -> vendor/gnumake/current).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gmake/doc/make-stds.texi

    r151 r503  
    99@cindex standards for makefiles
    1010
    11 @c Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001 Free
    12 @c Software Foundation, Inc.
     11@c Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001,
     12@c 2004, 2005 Free Software Foundation, Inc.
    1313
    1414@c Permission is granted to copy, distribute and/or modify this document
     
    294294Installation directories should always be named by variables, so it is
    295295easy to install in a nonstandard place.  The standard names for these
    296 variables are described below.  They are based on a standard filesystem
    297 layout; variants of it are used in SVR4, 4.4BSD, GNU/Linux, Ultrix v4,
    298 and other modern operating systems.
     296variables and the values they should have in GNU packages are
     297described below.  They are based on a standard filesystem layout;
     298variants of it are used in GNU/Linux and other modern operating
     299systems.
     300
     301Installers are expected to override these values when calling
     302@command{make} (e.g., @kbd{make prefix=/usr install} or
     303@command{configure} (e.g., @kbd{configure --prefix=/usr}).  GNU
     304packages should not try to guess which value should be appropriate for
     305these variables on the system they are being installed onto: use the
     306default settings specified here so that all GNU packages behave
     307identically, allowing the installer to achieve any desired layout.
    299308
    300309These two variables set the root for the installation.  All the other
     
    356365@file{/usr/local/libexec}, but write it as @file{$(exec_prefix)/libexec}.
    357366(If you are using Autoconf, write it as @samp{@@libexecdir@@}.)
     367
     368The definition of @samp{libexecdir} is the same for all packages, so
     369you should install your data in a subdirectory thereof.  Most packages
     370install their data under @file{$(libexecdir)/@var{package-name}/},
     371possibly within additional subdirectories thereof, such as
     372@file{$(libexecdir)/@var{package-name}/@var{machine}/@var{version}}.
    358373@end table
    359374
     
    378393architecture-independent, and it is generally not hard.
    379394
    380 Therefore, here are the variables Makefiles should use to specify
    381 directories:
     395Here are the variables Makefiles should use to specify directories
     396to put these various kinds of files in:
    382397
    383398@table @samp
     399@item datarootdir
     400The root of the directory tree for read-only architecture-independent
     401data files.  This should normally be @file{/usr/local/share}, but
     402write it as @file{$(prefix)/share}.  (If you are using Autoconf, write
     403it as @samp{@@datarootdir@@}.)  @samp{datadir}'s default value is
     404based on this variable; so are @samp{infodir}, @samp{mandir}, and
     405others.
     406
    384407@item datadir
    385 The directory for installing read-only architecture independent data
    386 files.  This should normally be @file{/usr/local/share}, but write it as
    387 @file{$(prefix)/share}.
    388 (If you are using Autoconf, write it as @samp{@@datadir@@}.)
    389 As a special exception, see @file{$(infodir)}
    390 and @file{$(includedir)} below.
     408The directory for installing idiosyncratic read-only
     409architecture-independent data files for this program.  This is usually
     410the same place as @samp{datarootdir}, but we use the two separate
     411variables so that you can move these program-specific files without
     412altering the location for Info files, man pages, etc.
     413
     414This should normally be @file{/usr/local/share}, but write it as
     415@file{$(datarootdir)}.  (If you are using Autoconf, write it as
     416@samp{@@datadir@@}.)
     417
     418The definition of @samp{datadir} is the same for all packages, so you
     419should install your data in a subdirectory thereof.  Most packages
     420install their data under @file{$(datadir)/@var{package-name}/}.
    391421
    392422@item sysconfdir
     
    420450@file{$(prefix)/var}.
    421451(If you are using Autoconf, write it as @samp{@@localstatedir@@}.)
    422 
    423 @item libdir
    424 The directory for object files and libraries of object code.  Do not
    425 install executables here, they probably ought to go in @file{$(libexecdir)}
    426 instead.  The value of @code{libdir} should normally be
    427 @file{/usr/local/lib}, but write it as @file{$(exec_prefix)/lib}.
    428 (If you are using Autoconf, write it as @samp{@@libdir@@}.)
    429 
    430 @item infodir
    431 The directory for installing the Info files for this package.  By
    432 default, it should be @file{/usr/local/info}, but it should be written
    433 as @file{$(prefix)/info}.
    434 (If you are using Autoconf, write it as @samp{@@infodir@@}.)
    435 
    436 @item lispdir
    437 The directory for installing any Emacs Lisp files in this package.  By
    438 default, it should be @file{/usr/local/share/emacs/site-lisp}, but it
    439 should be written as @file{$(prefix)/share/emacs/site-lisp}.
    440 
    441 If you are using Autoconf, write the default as @samp{@@lispdir@@}.
    442 In order to make @samp{@@lispdir@@} work, you need the following lines
    443 in your @file{configure.in} file:
    444 
    445 @example
    446 lispdir='$@{datadir@}/emacs/site-lisp'
    447 AC_SUBST(lispdir)
    448 @end example
    449 
     452@end table
     453
     454These variables specify the directory for installing certain specific
     455types of files, if your program has them.  Every GNU package should
     456have Info files, so every program needs @samp{infodir}, but not all
     457need @samp{libdir} or @samp{lispdir}.
     458
     459@table @samp
    450460@item includedir
    451461@c rewritten to avoid overfull hbox --roland
     
    482492To tell whether @file{foo.h} came from the Foo package, put a magic
    483493string in the file---part of a comment---and @code{grep} for that string.
     494
     495@item docdir
     496The directory for installing documentation files (other than Info) for
     497this package.  By default, it should be
     498@file{/usr/local/share/doc/@var{yourpkg}}, but it should be written as
     499@file{$(datarootdir)/doc/@var{yourpkg}}.  (If you are using Autoconf,
     500write it as @samp{@@docdir@@}.)  The @var{yourpkg} subdirectory, which
     501may include a version number, prevents collisions among files with
     502common names, such as @file{README}.
     503
     504@item infodir
     505The directory for installing the Info files for this package.  By
     506default, it should be @file{/usr/local/share/info}, but it should be
     507written as @file{$(datarootdir)/info}.  (If you are using Autoconf,
     508write it as @samp{@@infodir@@}.)  @code{infodir} is separate from
     509@code{docdir} for compatibility with existing practice.
     510
     511@item htmldir
     512@itemx dvidir
     513@itemx pdfdir
     514@itemx psdir
     515Directories for installing documentation files in the particular
     516format.  (It is not required to support documentation in all these
     517formats.)  They should all be set to @code{$(docdir)} by default.  (If
     518you are using Autoconf, write them as @samp{@@htmldir@@},
     519@samp{@@dvidir@@}, etc.)  Packages which supply several translations
     520of their documentation should install them in
     521@samp{$(htmldir)/}@var{ll}, @samp{$(pdfdir)/}@var{ll}, etc. where
     522@var{ll} is a locale abbreviation such as @samp{en} or @samp{pt_BR}.
     523
     524@item libdir
     525The directory for object files and libraries of object code.  Do not
     526install executables here, they probably ought to go in @file{$(libexecdir)}
     527instead.  The value of @code{libdir} should normally be
     528@file{/usr/local/lib}, but write it as @file{$(exec_prefix)/lib}.
     529(If you are using Autoconf, write it as @samp{@@libdir@@}.)
     530
     531@item lispdir
     532The directory for installing any Emacs Lisp files in this package.  By
     533default, it should be @file{/usr/local/share/emacs/site-lisp}, but it
     534should be written as @file{$(datarootdir)/emacs/site-lisp}.
     535
     536If you are using Autoconf, write the default as @samp{@@lispdir@@}.
     537In order to make @samp{@@lispdir@@} work, you need the following lines
     538in your @file{configure.in} file:
     539
     540@example
     541lispdir='$@{datarootdir@}/emacs/site-lisp'
     542AC_SUBST(lispdir)
     543@end example
     544
     545@item localedir
     546The directory for installing locale-specific message catalogs for this
     547package.  By default, it should be @file{/usr/local/share/locale}, but
     548it should be written as @file{$(datarootdir)/locale}.  (If you are
     549using Autoconf, write it as @samp{@@localedir@@}.)  This directory
     550usually has a subdirectory per locale.
    484551@end table
    485552
     
    489556@item mandir
    490557The top-level directory for installing the man pages (if any) for this
    491 package.  It will normally be @file{/usr/local/man}, but you should
    492 write it as @file{$(prefix)/man}.
    493 (If you are using Autoconf, write it as @samp{@@mandir@@}.)
     558package.  It will normally be @file{/usr/local/share/man}, but you
     559should write it as @file{$(datarootdir)/man}.  (If you are using
     560Autoconf, write it as @samp{@@mandir@@}.)
    494561
    495562@item man1dir
     
    536603# NOTE: This directory must exist when you start the install.
    537604prefix = /usr/local
     605datarootdir = $(prefix)/share
     606datadir = $(datarootdir)
    538607exec_prefix = $(prefix)
    539608# Where to put the executable for the command `gcc'.
     
    542611libexecdir = $(exec_prefix)/libexec
    543612# Where to put the Info files.
    544 infodir = $(prefix)/info
     613infodir = $(datarootdir)/info
    545614@end smallexample
    546615
     
    631700Categories}.
    632701
     702@item install-html
     703@itemx install-dvi
     704@itemx install-pdf
     705@itemx install-ps
     706These targets install documentation in formats other than Info;
     707they're intended to be called explicitly by the person installing the
     708package, if that format is desired.  GNU prefers Info files, so these
     709must be installed by the @code{install} target.
     710
     711When you have many documentation files to install, we recommend that
     712you avoid collisions and clutter by arranging for these targets to
     713install in subdirectories of the appropriate installation directory,
     714such as @code{htmldir}.  As one example, if your package has multiple
     715manuals, and you wish to install HTML documentation with many files
     716(such as the ``split'' mode output by @code{makeinfo --html}), you'll
     717certainly want to use subdirectories, or two nodes with the same name
     718in different manuals will overwrite each other.
     719
    633720@item uninstall
    634721Delete all the installed files---the copies that the @samp{install}
    635 target creates.
     722and @samp{install-*} targets create.
    636723
    637724This rule should not modify the directories where compilation is done,
     
    669756@item clean
    670757
    671 Delete all files from the current directory that are normally created by
    672 building the program.  Don't delete the files that record the
    673 configuration.  Also preserve files that could be made by building, but
    674 normally aren't because the distribution comes with them.
     758Delete all files in the current directory that are normally created by
     759building the program.  Also delete files in other directories if they
     760are created by this makefile.  However, don't delete the files that
     761record the configuration.  Also preserve files that could be made by
     762building, but normally aren't because the distribution comes with
     763them.  There is no need to delete parent directories that were created
     764with @samp{mkdir -p}, since they could have existed anyway.
    675765
    676766Delete @file{.dvi} files here if they are not part of the distribution.
    677767
    678768@item distclean
    679 Delete all files from the current directory that are created by
    680 configuring or building the program.  If you have unpacked the source
    681 and built the program without creating any other files, @samp{make
    682 distclean} should leave only the files that were in the distribution.
     769Delete all files in the current directory (or created by this
     770makefile) that are created by configuring or building the program.  If
     771you have unpacked the source and built the program without creating
     772any other files, @samp{make distclean} should leave only the files
     773that were in the distribution.  However, there is no need to delete
     774parent directories that were created with @samp{mkdir -p}, since they
     775could have existed anyway.
    683776
    684777@item mostlyclean
     
    689782
    690783@item maintainer-clean
    691 Delete almost everything from the current directory that can be
    692 reconstructed with this Makefile.  This typically includes everything
    693 deleted by @code{distclean}, plus more: C source files produced by
    694 Bison, tags tables, Info files, and so on.
     784Delete almost everything that can be reconstructed with this Makefile.
     785This typically includes everything deleted by @code{distclean}, plus
     786more: C source files produced by Bison, tags tables, Info files, and
     787so on.
    695788
    696789The reason we say ``almost everything'' is that running the command
    697 @samp{make maintainer-clean} should not delete @file{configure} even if
    698 @file{configure} can be remade using a rule in the Makefile.  More generally,
    699 @samp{make maintainer-clean} should not delete anything that needs to
    700 exist in order to run @file{configure} and then begin to build the
    701 program.  This is the only exception; @code{maintainer-clean} should
    702 delete everything else that can be rebuilt.
     790@samp{make maintainer-clean} should not delete @file{configure} even
     791if @file{configure} can be remade using a rule in the Makefile.  More
     792generally, @samp{make maintainer-clean} should not delete anything
     793that needs to exist in order to run @file{configure} and then begin to
     794build the program.  Also, there is no need to delete parent
     795directories that were created with @samp{mkdir -p}, since they could
     796have existed anyway.  These are the only exceptions;
     797@code{maintainer-clean} should delete everything else that can be
     798rebuilt.
    703799
    704800The @samp{maintainer-clean} target is intended to be used by a maintainer of
     
    744840
    745841@item dvi
    746 Generate DVI files for all Texinfo documentation.
    747 For example:
     842@itemx html
     843@itemx pdf
     844@itemx ps
     845Generate documentation files in the given format, if possible.
     846Here's an example rule for generating DVI files from Texinfo:
    748847
    749848@smallexample
     
    760859of formatting. @TeX{} is not distributed with Texinfo.}  Alternatively,
    761860write just the dependencies, and allow GNU @code{make} to provide the command.
     861
     862Here's another example, this one for generating HTML from Texinfo:
     863
     864@smallexample
     865html: foo.html
     866
     867foo.html: foo.texi chap1.texi chap2.texi
     868        $(TEXI2HTML) $(srcdir)/foo.texi
     869@end smallexample
     870
     871@noindent
     872Again, you would define the variable @code{TEXI2HTML} in the Makefile;
     873for example, it might run @code{makeinfo --no-split --html}
     874(@command{makeinfo} is part of the Texinfo distribution).
    762875
    763876@item dist
     
    9331046Programs to build binary packages work by extracting the
    9341047pre-installation and post-installation commands.  Here is one way of
    935 extracting the pre-installation commands:
    936 
    937 @smallexample
    938 make -n install -o all \
     1048extracting the pre-installation commands (the @option{-s} option to
     1049@command{make} is needed to silence messages about entering
     1050subdirectories):
     1051
     1052@smallexample
     1053make -s -n install -o all \
    9391054      PRE_INSTALL=pre-install \
    9401055      POST_INSTALL=post-install \
     
    9471062
    9481063@smallexample
    949 $0 ~ /^\t[ \t]*(normal_install|post_install)[ \t]*$/ @{on = 0@}
     1064$0 ~ /^(normal-install|post-install)[ \t]*$/ @{on = 0@}
    9501065on @{print $0@}
    951 $0 ~ /^\t[ \t]*pre_install[ \t]*$/ @{on = 1@}
    952 @end smallexample
    953 
    954 The resulting file of pre-installation commands is executed as a shell
    955 script as part of installing the binary package.
     1066$0 ~ /^pre-install[ \t]*$/ @{on = 1@}
     1067@end smallexample
Note: See TracChangeset for help on using the changeset viewer.