X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=doc%2Fmake-stds.texi;h=cdcbb682ab6c77e0267c3f9c350c9bab71157dd8;hb=a5e49274c570061dcf3d8153138392f5e4a6b8f7;hp=b0a7d8a0fc864ee9cee2a2f35b337a75d65ee433;hpb=f45516e736fc13e04c6fb645cb0f71679ead5b12;p=gnulib.git diff --git a/doc/make-stds.texi b/doc/make-stds.texi index b0a7d8a0f..cdcbb682a 100644 --- a/doc/make-stds.texi +++ b/doc/make-stds.texi @@ -3,7 +3,6 @@ @node Makefile Conventions @chapter Makefile Conventions -@comment standards.texi does not print an index, but make.texinfo does. @cindex makefile, conventions for @cindex conventions for makefiles @cindex standards for makefiles @@ -160,8 +159,8 @@ installation should not use any utilities directly except these: @c mkfifo mknod tee uname @example -awk cat cmp cp diff echo egrep expr false grep install-info -ln ls mkdir mv pwd rm rmdir sed sleep sort tar test touch tr true +awk cat cmp cp diff echo egrep expr false grep install-info ln ls +mkdir mv printf pwd rm rmdir sed sleep sort tar test touch tr true @end example Compression programs such as @code{gzip} can be used in the @@ -294,7 +293,7 @@ $(INSTALL_PROGRAM) foo bar baz $(bindir) @node DESTDIR -@section @code{DESTDIR}: support for staged installs +@section @code{DESTDIR}: Support for Staged Installs @vindex DESTDIR @cindex staged installs @@ -321,7 +320,7 @@ make DESTDIR=/tmp/stage install useful. If your installation step would normally install -@file{/usr/local/bin/foo} and @file{/usr/local/lib/libfoo.a}, then an +@file{/usr/local/bin/foo} and @file{/usr/@/local/@/lib/@/libfoo.a}, then an installation invoked as in the example above would install @file{/tmp/stage/usr/local/bin/foo} and @file{/tmp/stage/usr/local/lib/libfoo.a} instead. @@ -368,6 +367,11 @@ these variables on the system they are being installed onto: use the default settings specified here so that all GNU packages behave identically, allowing the installer to achieve any desired layout. +@cindex directories, creating installation +@cindex installation directories, creating +All installation directories, and their parent directories, should be +created (if necessary) before they are installed into. + These first two variables set the root for the installation. All the other installation directories should be subdirectories of one of these two, and nothing should be directly installed into these two @@ -474,9 +478,11 @@ the same place as @samp{datarootdir}, but we use the two separate variables so that you can move these program-specific files without altering the location for Info files, man pages, etc. +@c raggedright (not until next Texinfo release) This should normally be @file{/usr/local/share}, but write it as @file{$(datarootdir)}. (If you are using Autoconf, write it as @samp{@@datadir@@}.) +@c end raggedright The definition of @samp{datadir} is the same for all packages, so you should install your data in a subdirectory thereof. Most packages @@ -521,7 +527,6 @@ need @samp{libdir} or @samp{lispdir}. @table @samp @item includedir -@c rewritten to avoid overfull hbox --roland The directory for installing header files to be included by user programs with the C @samp{#include} preprocessor directive. This should normally be @file{/usr/local/include}, but write it as @@ -710,8 +715,9 @@ documentation format) files should be made only when explicitly asked for. By default, the Make rules should compile and link with @samp{-g}, so -that executable programs have debugging symbols. Users who don't mind -being helpless can strip the executables later if they wish. +that executable programs have debugging symbols. Otherwise, you are +essentially helpless in the face of a crash, and it is often far from +easy to reproduce with a fresh build. @item install Compile the program and copy the executables, libraries, and so on to @@ -719,8 +725,11 @@ the file names where they should reside for actual use. If there is a simple test to verify that a program is properly installed, this target should run that test. -Do not strip executables when installing them. Devil-may-care users can -use the @code{install-strip} target to do that. +Do not strip executables when installing them. This helps eventual +debugging that may be needed later, and nowadays disk space is cheap +and dynamic loaders typically ensure debug sections are not loaded during +normal execution. Users that need stripped binaries may invoke the +@code{install-strip} target to do that. If possible, write the @code{install} target rule so that it does not modify anything in the directory where the program was built, provided @@ -743,26 +752,31 @@ with @code{$(INSTALL_DATA)} (@pxref{Command Variables}), and then run the @code{install-info} program if it is present. @code{install-info} is a program that edits the Info @file{dir} file to add or update the menu entry for the given Info file; it is part of the Texinfo package. -Here is a sample rule to install an Info file: + +Here is a sample rule to install an Info file that also tries to +handle some additional situations, such as @code{install-info} not +being present. @comment This example has been carefully formatted for the Make manual. @comment Please do not reformat it without talking to bug-make@gnu.org. @smallexample -$(DESTDIR)$(infodir)/foo.info: foo.info - $(POST_INSTALL) -# There may be a newer info file in . than in srcdir. - -if test -f foo.info; then d=.; \ - else d=$(srcdir); fi; \ - $(INSTALL_DATA) $$d/foo.info $(DESTDIR)$@@; \ +do-install-info: foo.info installdirs + $(NORMAL_INSTALL) +# Prefer an info file in . to one in srcdir. + if test -f foo.info; then d=.; \ + else d="$(srcdir)"; fi; \ + $(INSTALL_DATA) $$d/foo.info \ + "$(DESTDIR)$(infodir)/foo.info" # Run install-info only if it exists. # Use `if' instead of just prepending `-' to the # line so we notice real errors from install-info. -# We use `$(SHELL) -c' because some shells do not +# Use `$(SHELL) -c' because some shells do not # fail gracefully when there is an unknown command. + $(POST_INSTALL) if $(SHELL) -c 'install-info --version' \ >/dev/null 2>&1; then \ - install-info --dir-file=$(DESTDIR)$(infodir)/dir \ - $(DESTDIR)$(infodir)/foo.info; \ + install-info --dir-file="$(DESTDIR)$(infodir)/dir" \ + "$(DESTDIR)$(infodir)/foo.info"; \ else true; fi @end smallexample @@ -827,10 +841,7 @@ the program has no bugs. However, it can be reasonable to install a stripped executable for actual execution while saving the unstripped executable elsewhere in case there is a bug. -@comment The gratuitous blank line here is to make the table look better -@comment in the printed Make manual. Please leave it in. @item clean - Delete all files in the current directory that are normally created by building the program. Also delete files in other directories if they are created by this makefile. However, don't delete the files that @@ -933,11 +944,12 @@ foo.dvi: foo.texi chap1.texi chap2.texi @end smallexample @noindent -You must define the variable @code{TEXI2DVI} in the Makefile. It should -run the program @code{texi2dvi}, which is part of the Texinfo -distribution.@footnote{@code{texi2dvi} uses @TeX{} to do the real work -of formatting. @TeX{} is not distributed with Texinfo.} Alternatively, -write just the dependencies, and allow GNU @code{make} to provide the command. +You must define the variable @code{TEXI2DVI} in the Makefile. It +should run the program @code{texi2dvi}, which is part of the Texinfo +distribution. (@code{texi2dvi} uses @TeX{} to do the real work of +formatting. @TeX{} is not distributed with Texinfo.) Alternatively, +write only the dependencies, and allow GNU @code{make} to provide the +command. Here's another example, this one for generating HTML from Texinfo: @@ -1000,8 +1012,7 @@ the program before running the tests. You should not assume that It's useful to add a target named @samp{installdirs} to create the directories where files are installed, and their parent directories. There is a script called @file{mkinstalldirs} which is convenient for -this; you can find it in the Texinfo package. -@c It's in /gd/gnu/lib/mkinstalldirs. +this; you can find it in the Gnulib package. You can use a rule like this: @comment This has been carefully formatted to look decent in the Make manual. @@ -1016,7 +1027,7 @@ installdirs: mkinstalldirs @end smallexample @noindent -or, if you wish to support @env{DESTDIR}, +or, if you wish to support @env{DESTDIR} (strongly encouraged), @smallexample # Make sure all installation directories (e.g. $(bindir))