All GNU programs should have the following targets in their Makefiles:
install-striptarget to do that. If possible, write the
installtarget rule so that it does not modify anything in the directory where the program was built, provided `make all' has just been done. This is convenient for building the program under one user name and installing it under another. The commands should create all the directories in which files are to be installed, if they don't already exist. This includes the directories specified as the values of the variables
exec_prefix, as well as all subdirectories that are needed. One way to do this is by means of an
installdirstarget as described below. Use `-' before any command for installing a man page, so that
makewill ignore any errors. This is in case there are systems that don't have the Unix man page documentation system installed. The way to install Info files is to copy them into `$(infodir)' with
$(INSTALL_DATA)(see section Variables for Specifying Commands), and then run the
install-infoprogram if it is present.
install-infois a program that edits the Info `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:
$(infodir)/foo.info: foo.info # 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 $@; \ # 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 # fail gracefully when there is an unknown command. if $(SHELL) -c 'install-info --version' \ >/dev/null 2>&1; then \ install-info --dir-file=$(infodir)/dir \ $(infodir)/foo.info; \ else true; fi
install, but strip the executable files while installing them. The definition of this target can be very simple:
install-strip: $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' \ installNormally we do not recommend stripping an executable unless you are sure 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.
distclean, plus more: C source files produced by Bison, tags tables, Info files, and so on. The reason we say "almost everything" is that running the command `make maintainer-clean' should not delete `configure' even if `configure' can be remade using a rule in the Makefile. More generally, `make maintainer-clean' should not delete anything that needs to exist in order to run `configure' and then begin to build the program. This is the only exception;
maintainer-cleanshould delete everything else that can be rebuilt. The `maintainer-clean' target is intended to be used by a maintainer of the package, not by ordinary users. You may need special tools to reconstruct some of the files that `make maintainer-clean' deletes. Since these files are normally included in the distribution, we don't take care to make them easy to reconstruct. If you find you need to unpack the full distribution again, don't blame us. To help make users aware of this, the commands for the special
maintainer-cleantarget should start with these two:
@echo 'This command is intended for maintainers to use; it' @echo 'deletes files that may need special tools to rebuild.'
info: foo.info foo.info: foo.texi chap1.texi chap2.texi $(MAKEINFO) $(srcdir)/foo.texiYou must define the variable
MAKEINFOin the Makefile. It should run the
makeinfoprogram, which is part of the Texinfo distribution.
dvi: foo.dvi foo.dvi: foo.texi chap1.texi chap2.texi $(TEXI2DVI) $(srcdir)/foo.texiYou must define the variable
TEXI2DVIin the Makefile. It should run the program
texi2dvi, which is part of the Texinfo distribution.(1) Alternatively, write just the dependencies, and allow GNU
maketo provide the command.
cpto install the proper files in it, and then
tarthat subdirectory. Compress the tar file file with
gzip. For example, the actual distribution file for GCC version 1.40 is called `gcc-1.40.tar.gz'. The
disttarget should explicitly depend on all non-source files that are in the distribution, to make sure they are up to date in the distribution. See section `Making Releases' in GNU Coding Standards.
The following targets are suggested as conventional names, for programs in which they are useful.
# Make sure all installation directories (e.g. $(bindir)) # actually exist by making them if necessary. installdirs: mkinstalldirs $(srcdir)/mkinstalldirs $(bindir) $(datadir) \ $(libdir) $(infodir) \ $(mandir)This rule should not modify the directories where compilation is done. It should do nothing but create installation directories.
Go to the first, previous, next, last section, table of contents.