⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 make-stds.texi

📁 基于4个mips核的noc设计
💻 TEXI
📖 第 1 页 / 共 3 页
字号:
commands and @dfn{post-installation} commands.  @xref{Install CommandCategories}.@item uninstallDelete all the installed files---the copies that the @samp{install}target creates.This rule should not modify the directories where compilation is done,only the directories where files are installed.The uninstallation commands are divided into three categories, just likethe installation commands.  @xref{Install Command Categories}.@item install-stripLike @code{install}, but strip the executable files while installingthem.  In many cases, the definition of this target can be very simple:@smallexampleinstall-strip:        $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' \                install@end smallexampleNormally we do not recommend stripping an executable unless you are surethe program has no bugs.  However, it can be reasonable to install astripped executable for actual execution while saving the unstrippedexecutable 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 cleanDelete all files from the current directory that are normally created bybuilding the program.  Don't delete the files that record theconfiguration.  Also preserve files that could be made by building, butnormally aren't because the distribution comes with them.Delete @file{.dvi} files here if they are not part of the distribution.@item distcleanDelete all files from the current directory that are created byconfiguring or building the program.  If you have unpacked the sourceand built the program without creating any other files, @samp{makedistclean} should leave only the files that were in the distribution.@item mostlycleanLike @samp{clean}, but may refrain from deleting a few files that peoplenormally don't want to recompile.  For example, the @samp{mostlyclean}target for GCC does not delete @file{libgcc.a}, because recompiling itis rarely necessary and takes a lot of time.@item maintainer-cleanDelete almost everything from the current directory that can bereconstructed with this Makefile.  This typically includes everythingdeleted by @code{distclean}, plus more: C source files produced byBison, tags tables, Info files, and so on.The reason we say ``almost everything'' is that running the command@samp{make maintainer-clean} should not delete @file{configure} even if@file{configure} can be remade using a rule in the Makefile.  More generally,@samp{make maintainer-clean} should not delete anything that needs toexist in order to run @file{configure} and then begin to build theprogram.  This is the only exception; @code{maintainer-clean} shoulddelete everything else that can be rebuilt.The @samp{maintainer-clean} target is intended to be used by a maintainer ofthe package, not by ordinary users.  You may need special tools toreconstruct some of the files that @samp{make maintainer-clean} deletes.Since these files are normally included in the distribution, we don'ttake care to make them easy to reconstruct.  If you find you need tounpack the full distribution again, don't blame us.To help make users aware of this, the commands for the special@code{maintainer-clean} target should start with these two:@smallexample@@echo 'This command is intended for maintainers to use; it'@@echo 'deletes files that may need special tools to rebuild.'@end smallexample@item TAGSUpdate a tags table for this program.@c ADR: how?@item infoGenerate any Info files needed.  The best way to write the rules is asfollows:@smallexampleinfo: foo.infofoo.info: foo.texi chap1.texi chap2.texi        $(MAKEINFO) $(srcdir)/foo.texi@end smallexample@noindentYou must define the variable @code{MAKEINFO} in the Makefile.  It shouldrun the @code{makeinfo} program, which is part of the Texinfodistribution.Normally a GNU distribution comes with Info files, and that means theInfo files are present in the source directory.  Therefore, the Makerule for an info file should update it in the source directory.  Whenusers build the package, ordinarily Make will not update the Info filesbecause they will already be up to date.@item dviGenerate DVI files for all Texinfo documentation.For example:@smallexampledvi: foo.dvifoo.dvi: foo.texi chap1.texi chap2.texi        $(TEXI2DVI) $(srcdir)/foo.texi@end smallexample@noindentYou must define the variable @code{TEXI2DVI} in the Makefile.  It shouldrun the program @code{texi2dvi}, which is part of the Texinfodistribution.@footnote{@code{texi2dvi} uses @TeX{} to do the real workof formatting. @TeX{} is not distributed with Texinfo.}  Alternatively,write just the dependencies, and allow GNU @code{make} to provide the command.@item distCreate a distribution tar file for this program.  The tar file should beset up so that the file names in the tar file start with a subdirectoryname which is the name of the package it is a distribution for.  Thisname can include the version number.For example, the distribution tar file of GCC version 1.40 unpacks intoa subdirectory named @file{gcc-1.40}.The easiest way to do this is to create a subdirectory appropriatelynamed, use @code{ln} or @code{cp} to install the proper files in it, andthen @code{tar} that subdirectory.Compress the tar file file with @code{gzip}.  For example, the actualdistribution file for GCC version 1.40 is called @file{gcc-1.40.tar.gz}.The @code{dist} target should explicitly depend on all non-source filesthat are in the distribution, to make sure they are up to date in thedistribution.@ifset CODESTD@xref{Releases, , Making Releases}.@end ifset@ifclear CODESTD@xref{Releases, , Making Releases, standards, GNU Coding Standards}.@end ifclear@item checkPerform self-tests (if any).  The user must build the program beforerunning the tests, but need not install the program; you should writethe self-tests so that they work when the program is built but notinstalled.@end tableThe following targets are suggested as conventional names, for programsin which they are useful.@table @code@item installcheckPerform installation tests (if any).  The user must build and installthe program before running the tests.  You should not assume that@file{$(bindir)} is in the search path.@item installdirsIt's useful to add a target named @samp{installdirs} to create thedirectories where files are installed, and their parent directories.There is a script called @file{mkinstalldirs} which is convenient forthis; you can find it in the Texinfo package.@c It's in /gd/gnu/lib/mkinstalldirs.You can use a rule like this:@comment This has been carefully formatted to look decent in the Make manual.@comment Please be sure not to make it extend any further to the right.--roland@smallexample# Make sure all installation directories (e.g. $(bindir))# actually exist by making them if necessary.installdirs: mkinstalldirs        $(srcdir)/mkinstalldirs $(bindir) $(datadir) \                                $(libdir) $(infodir) \                                $(mandir)@end smallexampleThis rule should not modify the directories where compilation is done.It should do nothing but create installation directories.@end table@node Install Command Categories@section Install Command Categories@cindex pre-installation commands@cindex post-installation commandsWhen writing the @code{install} target, you must classify all thecommands into three categories: normal ones, @dfn{pre-installation}commands and @dfn{post-installation} commands.Normal commands move files into their proper places, and set theirmodes.  They may not alter any files except the ones that come entirelyfrom the package they belong to.Pre-installation and post-installation commands may alter other files;in particular, they can edit global configuration files or data bases.Pre-installation commands are typically executed before the normalcommands, and post-installation commands are typically run after thenormal commands.The most common use for a post-installation command is to run@code{install-info}.  This cannot be done with a normal command, sinceit alters a file (the Info directory) which does not come entirely andsolely from the package being installed.  It is a post-installationcommand because it needs to be done after the normal command whichinstalls the package's Info files.Most programs don't need any pre-installation commands, but we have thefeature just in case it is needed.To classify the commands in the @code{install} rule into these threecategories, insert @dfn{category lines} among them.  A category linespecifies the category for the commands that follow.A category line consists of a tab and a reference to a special Makevariable, plus an optional comment at the end.  There are threevariables you can use, one for each category; the variable namespecifies the category.  Category lines are no-ops in ordinary executionbecause these three Make variables are normally undefined (and you@emph{should not} define them in the makefile).Here are the three possible category lines, each with a comment thatexplains what it means:@smallexample        $(PRE_INSTALL)     # @r{Pre-install commands follow.}        $(POST_INSTALL)    # @r{Post-install commands follow.}        $(NORMAL_INSTALL)  # @r{Normal commands follow.}@end smallexampleIf you don't use a category line at the beginning of the @code{install}rule, all the commands are classified as normal until the first categoryline.  If you don't use any category lines, all the commands areclassified as normal.These are the category lines for @code{uninstall}:@smallexample        $(PRE_UNINSTALL)     # @r{Pre-uninstall commands follow.}        $(POST_UNINSTALL)    # @r{Post-uninstall commands follow.}        $(NORMAL_UNINSTALL)  # @r{Normal commands follow.}@end smallexampleTypically, a pre-uninstall command would be used for deleting entriesfrom the Info directory.If the @code{install} or @code{uninstall} target has any dependencieswhich act as subroutines of installation, then you should start@emph{each} dependency's commands with a category line, and start themain target's commands with a category line also.  This way, you canensure that each command is placed in the right category regardless ofwhich of the dependencies actually run.Pre-installation and post-installation commands should not run anyprograms except for these:@example[ basename bash cat chgrp chmod chown cmp cp dd diff echoegrep expand expr false fgrep find getopt grep gunzip gziphostname install install-info kill ldconfig ln ls md5summkdir mkfifo mknod mv printenv pwd rm rmdir sed sort teetest touch true uname xargs yes@end example@cindex binary packagesThe reason for distinguishing the commands in this way is for the sakeof making binary packages.  Typically a binary package contains all theexecutables and other files that need to be installed, and has its ownmethod of installing them---so it does not need to run the normalinstallation commands.  But installing the binary package does need toexecute the pre-installation and post-installation commands.Programs to build binary packages work by extracting thepre-installation and post-installation commands.  Here is one way ofextracting the pre-installation commands:@smallexamplemake -n install -o all \      PRE_INSTALL=pre-install \      POST_INSTALL=post-install \      NORMAL_INSTALL=normal-install \  | gawk -f pre-install.awk@end smallexample@noindentwhere the file @file{pre-install.awk} could contain this:@smallexample$0 ~ /^\t[ \t]*(normal_install|post_install)[ \t]*$/ @{on = 0@}on @{print $0@}$0 ~ /^\t[ \t]*pre_install[ \t]*$/ @{on = 1@}@end smallexampleThe resulting file of pre-installation commands is executed as a shellscript as part of installing the binary package.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -