Mercurial > hg > xemacs-beta
comparison man/make-stds.texi @ 462:0784d089fdc9 r21-2-46
Import from CVS: tag r21-2-46
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:44:37 +0200 |
parents | abe6d1db359e |
children | 4a83dda7ae93 |
comparison
equal
deleted
inserted
replaced
461:120ed4009e51 | 462:0784d089fdc9 |
---|---|
79 sed -e sedscript foo.man > foo.1 | 79 sed -e sedscript foo.man > foo.1 |
80 @end smallexample | 80 @end smallexample |
81 | 81 |
82 @noindent | 82 @noindent |
83 will fail when the build directory is not the source directory, because | 83 will fail when the build directory is not the source directory, because |
84 @file{foo.man} and @file{sedscript} are in the the source directory. | 84 @file{foo.man} and @file{sedscript} are in the source directory. |
85 | 85 |
86 When using GNU @code{make}, relying on @samp{VPATH} to find the source | 86 When using GNU @code{make}, relying on @samp{VPATH} to find the source |
87 file will work in the case where there is a single dependency file, | 87 file will work in the case where there is a single dependency file, |
88 since the @code{make} automatic variable @samp{$<} will represent the | 88 since the @code{make} automatic variable @samp{$<} will represent the |
89 source file wherever it is. (Many versions of @code{make} set @samp{$<} | 89 source file wherever it is. (Many versions of @code{make} set @samp{$<} |
247 | 247 |
248 Every Makefile should define the variable @code{INSTALL}, which is the | 248 Every Makefile should define the variable @code{INSTALL}, which is the |
249 basic command for installing a file into the system. | 249 basic command for installing a file into the system. |
250 | 250 |
251 Every Makefile should also define the variables @code{INSTALL_PROGRAM} | 251 Every Makefile should also define the variables @code{INSTALL_PROGRAM} |
252 and @code{INSTALL_DATA}. (The default for each of these should be | 252 and @code{INSTALL_DATA}. (The default for @code{INSTALL_PROGRAM} should |
253 @code{$(INSTALL)}.) Then it should use those variables as the commands | 253 be @code{$(INSTALL)}; the default for @code{INSTALL_DATA} should be |
254 for actual installation, for executables and nonexecutables | 254 @code{$@{INSTALL@} -m 644}.) Then it should use those variables as the |
255 commands for actual installation, for executables and nonexecutables | |
255 respectively. Use these variables as follows: | 256 respectively. Use these variables as follows: |
256 | 257 |
257 @example | 258 @example |
258 $(INSTALL_PROGRAM) foo $(bindir)/foo | 259 $(INSTALL_PROGRAM) foo $(bindir)/foo |
259 $(INSTALL_DATA) libfoo.a $(libdir)/libfoo.a | 260 $(INSTALL_DATA) libfoo.a $(libdir)/libfoo.a |
280 @section Variables for Installation Directories | 281 @section Variables for Installation Directories |
281 | 282 |
282 Installation directories should always be named by variables, so it is | 283 Installation directories should always be named by variables, so it is |
283 easy to install in a nonstandard place. The standard names for these | 284 easy to install in a nonstandard place. The standard names for these |
284 variables are described below. They are based on a standard filesystem | 285 variables are described below. They are based on a standard filesystem |
285 layout; variants of it are used in SVR4, 4.4BSD, Linux, Ultrix v4, and | 286 layout; variants of it are used in SVR4, 4.4BSD, GNU/Linux, Ultrix v4, |
286 other modern operating systems. | 287 and other modern operating systems. |
287 | 288 |
288 These two variables set the root for the installation. All the other | 289 These two variables set the root for the installation. All the other |
289 installation directories should be subdirectories of one of these two, | 290 installation directories should be subdirectories of one of these two, |
290 and nothing should be directly installed into these two directories. | 291 and nothing should be directly installed into these two directories. |
291 | 292 |
292 @table @samp | 293 @table @code |
293 @item prefix | 294 @item prefix |
295 @vindex prefix | |
294 A prefix used in constructing the default values of the variables listed | 296 A prefix used in constructing the default values of the variables listed |
295 below. The default value of @code{prefix} should be @file{/usr/local}. | 297 below. The default value of @code{prefix} should be @file{/usr/local}. |
296 When building the complete GNU system, the prefix will be empty and | 298 When building the complete GNU system, the prefix will be empty and |
297 @file{/usr} will be a symbolic link to @file{/}. | 299 @file{/usr} will be a symbolic link to @file{/}. |
298 (If you are using Autoconf, write it as @samp{@@prefix@@}.) | 300 (If you are using Autoconf, write it as @samp{@@prefix@@}.) |
299 | 301 |
300 Running @samp{make install} with a different value of @code{prefix} | 302 Running @samp{make install} with a different value of @code{prefix} from |
301 from the one used to build the program should @var{not} recompile | 303 the one used to build the program should @emph{not} recompile the |
302 the program. | 304 program. |
303 | 305 |
304 @item exec_prefix | 306 @item exec_prefix |
307 @vindex exec_prefix | |
305 A prefix used in constructing the default values of some of the | 308 A prefix used in constructing the default values of some of the |
306 variables listed below. The default value of @code{exec_prefix} should | 309 variables listed below. The default value of @code{exec_prefix} should |
307 be @code{$(prefix)}. | 310 be @code{$(prefix)}. |
308 (If you are using Autoconf, write it as @samp{@@exec_prefix@@}.) | 311 (If you are using Autoconf, write it as @samp{@@exec_prefix@@}.) |
309 | 312 |
310 Generally, @code{$(exec_prefix)} is used for directories that contain | 313 Generally, @code{$(exec_prefix)} is used for directories that contain |
311 machine-specific files (such as executables and subroutine libraries), | 314 machine-specific files (such as executables and subroutine libraries), |
312 while @code{$(prefix)} is used directly for other directories. | 315 while @code{$(prefix)} is used directly for other directories. |
313 | 316 |
314 Running @samp{make install} with a different value of @code{exec_prefix} | 317 Running @samp{make install} with a different value of @code{exec_prefix} |
315 from the one used to build the program should @var{not} recompile the | 318 from the one used to build the program should @emph{not} recompile the |
316 program. | 319 program. |
317 @end table | 320 @end table |
318 | 321 |
319 Executable programs are installed in one of the following directories. | 322 Executable programs are installed in one of the following directories. |
320 | 323 |
321 @table @samp | 324 @table @code |
322 @item bindir | 325 @item bindir |
326 @vindex bindir | |
323 The directory for installing executable programs that users can run. | 327 The directory for installing executable programs that users can run. |
324 This should normally be @file{/usr/local/bin}, but write it as | 328 This should normally be @file{/usr/local/bin}, but write it as |
325 @file{$(exec_prefix)/bin}. | 329 @file{$(exec_prefix)/bin}. |
326 (If you are using Autoconf, write it as @samp{@@bindir@@}.) | 330 (If you are using Autoconf, write it as @samp{@@bindir@@}.) |
327 | 331 |
328 @item sbindir | 332 @item sbindir |
333 @vindex sbindir | |
329 The directory for installing executable programs that can be run from | 334 The directory for installing executable programs that can be run from |
330 the shell, but are only generally useful to system administrators. This | 335 the shell, but are only generally useful to system administrators. This |
331 should normally be @file{/usr/local/sbin}, but write it as | 336 should normally be @file{/usr/local/sbin}, but write it as |
332 @file{$(exec_prefix)/sbin}. | 337 @file{$(exec_prefix)/sbin}. |
333 (If you are using Autoconf, write it as @samp{@@sbindir@@}.) | 338 (If you are using Autoconf, write it as @samp{@@sbindir@@}.) |
334 | 339 |
335 @item libexecdir | 340 @item libexecdir |
341 @vindex libexecdir | |
336 @comment This paragraph adjusted to avoid overfull hbox --roland 5jul94 | 342 @comment This paragraph adjusted to avoid overfull hbox --roland 5jul94 |
337 The directory for installing executable programs to be run by other | 343 The directory for installing executable programs to be run by other |
338 programs rather than by users. This directory should normally be | 344 programs rather than by users. This directory should normally be |
339 @file{/usr/local/libexec}, but write it as @file{$(exec_prefix)/libexec}. | 345 @file{/usr/local/libexec}, but write it as @file{$(exec_prefix)/libexec}. |
340 (If you are using Autoconf, write it as @samp{@@libexecdir@@}.) | 346 (If you are using Autoconf, write it as @samp{@@libexecdir@@}.) |
505 | 511 |
506 @table @samp | 512 @table @samp |
507 @item srcdir | 513 @item srcdir |
508 The directory for the sources being compiled. The value of this | 514 The directory for the sources being compiled. The value of this |
509 variable is normally inserted by the @code{configure} shell script. | 515 variable is normally inserted by the @code{configure} shell script. |
510 (If you are using Autoconf, use @samp{srcdir = @@srcdir@@}.) | 516 (If you are using Autconf, use @samp{srcdir = @@srcdir@@}.) |
511 @end table | 517 @end table |
512 | 518 |
513 For example: | 519 For example: |
514 | 520 |
515 @smallexample | 521 @smallexample |
623 The uninstallation commands are divided into three categories, just like | 629 The uninstallation commands are divided into three categories, just like |
624 the installation commands. @xref{Install Command Categories}. | 630 the installation commands. @xref{Install Command Categories}. |
625 | 631 |
626 @item install-strip | 632 @item install-strip |
627 Like @code{install}, but strip the executable files while installing | 633 Like @code{install}, but strip the executable files while installing |
628 them. In many cases, the definition of this target can be very simple: | 634 them. In simple cases, this target can use the @code{install} target in |
635 a simple way: | |
629 | 636 |
630 @smallexample | 637 @smallexample |
631 install-strip: | 638 install-strip: |
632 $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' \ | 639 $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' \ |
633 install | 640 install |
634 @end smallexample | 641 @end smallexample |
642 | |
643 But if the package installs scripts as well as real executables, the | |
644 @code{install-strip} target can't just refer to the @code{install} | |
645 target; it has to strip the executables but not the scripts. | |
646 | |
647 @code{install-strip} should not strip the executables in the build | |
648 directory which are being copied for installation. It should only strip | |
649 the copies that are installed. | |
635 | 650 |
636 Normally we do not recommend stripping an executable unless you are sure | 651 Normally we do not recommend stripping an executable unless you are sure |
637 the program has no bugs. However, it can be reasonable to install a | 652 the program has no bugs. However, it can be reasonable to install a |
638 stripped executable for actual execution while saving the unstripped | 653 stripped executable for actual execution while saving the unstripped |
639 executable elsewhere in case there is a bug. | 654 executable elsewhere in case there is a bug. |
745 | 760 |
746 The easiest way to do this is to create a subdirectory appropriately | 761 The easiest way to do this is to create a subdirectory appropriately |
747 named, use @code{ln} or @code{cp} to install the proper files in it, and | 762 named, use @code{ln} or @code{cp} to install the proper files in it, and |
748 then @code{tar} that subdirectory. | 763 then @code{tar} that subdirectory. |
749 | 764 |
750 Compress the tar file file with @code{gzip}. For example, the actual | 765 Compress the tar file with @code{gzip}. For example, the actual |
751 distribution file for GCC version 1.40 is called @file{gcc-1.40.tar.gz}. | 766 distribution file for GCC version 1.40 is called @file{gcc-1.40.tar.gz}. |
752 | 767 |
753 The @code{dist} target should explicitly depend on all non-source files | 768 The @code{dist} target should explicitly depend on all non-source files |
754 that are in the distribution, to make sure they are up to date in the | 769 that are in the distribution, to make sure they are up to date in the |
755 distribution. | 770 distribution. |
793 $(srcdir)/mkinstalldirs $(bindir) $(datadir) \ | 808 $(srcdir)/mkinstalldirs $(bindir) $(datadir) \ |
794 $(libdir) $(infodir) \ | 809 $(libdir) $(infodir) \ |
795 $(mandir) | 810 $(mandir) |
796 @end smallexample | 811 @end smallexample |
797 | 812 |
813 @noindent | |
814 or, if you wish to support @env{DESTDIR}, | |
815 | |
816 @smallexample | |
817 # Make sure all installation directories (e.g. $(bindir)) | |
818 # actually exist by making them if necessary. | |
819 installdirs: mkinstalldirs | |
820 $(srcdir)/mkinstalldirs \ | |
821 $(DESTDIR)$(bindir) $(DESTDIR)$(datadir) \ | |
822 $(DESTDIR)$(libdir) $(DESTDIR)$(infodir) \ | |
823 $(DESTDIR)$(mandir) | |
824 @end smallexample | |
825 | |
798 This rule should not modify the directories where compilation is done. | 826 This rule should not modify the directories where compilation is done. |
799 It should do nothing but create installation directories. | 827 It should do nothing but create installation directories. |
800 @end table | 828 @end table |
801 | 829 |
802 @node Install Command Categories | 830 @node Install Command Categories |