annotate man/make-stds.texi @ 195:a2f645c6b9f8 r20-3b24

Import from CVS: tag r20-3b24
author cvs
date Mon, 13 Aug 2007 09:59:05 +0200
parents ac2d302a0011
children 972bbb6d6ca2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 @comment This file is included by both standards.texi and make.texinfo.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 @comment It was broken out of standards.texi on 1/6/93 by roland.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 @node Makefile Conventions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 @chapter Makefile Conventions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 @comment standards.texi does not print an index, but make.texinfo does.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 @cindex makefile, conventions for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 @cindex conventions for makefiles
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 @cindex standards for makefiles
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 @ifinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 node
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 @end ifinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 @iftex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 @ifset CODESTD
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 section
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 @end ifset
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 @ifclear CODESTD
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 chapter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 @end ifclear
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 @end iftex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 describes conventions for writing the Makefiles for GNU programs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 @menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 * Makefile Basics:: General Conventions for Makefiles
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 * Utilities in Makefiles:: Utilities in Makefiles
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 * Command Variables:: Variables for Specifying Commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 * Directory Variables:: Variables for Installation Directories
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 * Standard Targets:: Standard Targets for Users
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 @end menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 @node Makefile Basics
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 @section General Conventions for Makefiles
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 Every Makefile should contain this line:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 SHELL = /bin/sh
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 to avoid trouble on systems where the @code{SHELL} variable might be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 inherited from the environment. (This is never a problem with GNU
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 @code{make}.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 Different @code{make} programs have incompatible suffix lists and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 implicit rules, and this sometimes creates confusion or misbehavior. So
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 it is a good idea to set the suffix list explicitly using only the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 suffixes you need in the particular Makefile, like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 .SUFFIXES:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 .SUFFIXES: .c .o
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 The first line clears out the suffix list, the second introduces all
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 suffixes which may be subject to implicit rules in this Makefile.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 Don't assume that @file{.} is in the path for command execution. When
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 you need to run programs that are a part of your package during the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 make, please make sure that it uses @file{./} if the program is built as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 part of the make or @file{$(srcdir)/} if the file is an unchanging part
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 of the source code. Without one of these prefixes, the current search
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 path is used.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 The distinction between @file{./} and @file{$(srcdir)/} is important
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 when using the @samp{--srcdir} option to @file{configure}. A rule of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 the form:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 foo.1 : foo.man sedscript
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 sed -e sedscript foo.man > foo.1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 will fail when the current directory is not the source directory,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 because @file{foo.man} and @file{sedscript} are not in the current
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 When using GNU @code{make}, relying on @samp{VPATH} to find the source
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 file will work in the case where there is a single dependency file,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 since the @code{make} automatic variable @samp{$<} will represent the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 source file wherever it is. (Many versions of @code{make} set @samp{$<}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 only in implicit rules.) A Makefile target like
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 foo.o : bar.c
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 $(CC) -I. -I$(srcdir) $(CFLAGS) -c bar.c -o foo.o
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 should instead be written as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 foo.o : bar.c
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 $(CC) -I. -I$(srcdir) $(CFLAGS) -c $< -o $@@
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 in order to allow @samp{VPATH} to work correctly. When the target has
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 multiple dependencies, using an explicit @samp{$(srcdir)} is the easiest
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 way to make the rule work well. For example, the target above for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 @file{foo.1} is best written as:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 foo.1 : foo.man sedscript
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 sed -e $(srcdir)/sedscript $(srcdir)/foo.man > $@@
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 Try to make the build and installation targets, at least (and all their
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 subtargets) work correctly with a parallel @code{make}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 @node Utilities in Makefiles
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 @section Utilities in Makefiles
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 Write the Makefile commands (and any shell scripts, such as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 @code{configure}) to run in @code{sh}, not in @code{csh}. Don't use any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 special features of @code{ksh} or @code{bash}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 The @code{configure} script and the Makefile rules for building and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 installation should not use any utilities directly except these:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 cat cmp cp echo egrep expr false grep
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 ln mkdir mv pwd rm rmdir sed test touch true
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 Stick to the generally supported options for these programs. For
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 example, don't use @samp{mkdir -p}, convenient as it may be, because
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 most systems don't support it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 It is a good idea to avoid creating symbolic links in makefiles, since a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 few systems don't support them.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 The Makefile rules for building and installation can also use compilers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 and related programs, but should do so via @code{make} variables so that the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 user can substitute alternatives. Here are some of the programs we
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 mean:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 ar bison cc flex install ld lex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 make makeinfo ranlib texi2dvi yacc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 Use the following @code{make} variables:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 $(AR) $(BISON) $(CC) $(FLEX) $(INSTALL) $(LD) $(LEX)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 $(MAKE) $(MAKEINFO) $(RANLIB) $(TEXI2DVI) $(YACC)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 When you use @code{ranlib}, you should make sure nothing bad happens if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 the system does not have @code{ranlib}. Arrange to ignore an error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 from that command, and print a message before the command to tell the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 user that failure of the @code{ranlib} command does not mean a problem.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 (The Autoconf @samp{AC_PROG_RANLIB} macro can help with this.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 If you use symbolic links, you should implement a fallback for systems
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 that don't have symbolic links.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 It is ok to use other utilities in Makefile portions (or scripts)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 intended only for particular systems where you know those utilities
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 exist.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 @node Command Variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 @section Variables for Specifying Commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 Makefiles should provide variables for overriding certain commands, options,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 and so on.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 In particular, you should run most utility programs via variables.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 Thus, if you use Bison, have a variable named @code{BISON} whose default
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 value is set with @samp{BISON = bison}, and refer to it with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 @code{$(BISON)} whenever you need to use Bison.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 File management utilities such as @code{ln}, @code{rm}, @code{mv}, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 so on, need not be referred to through variables in this way, since users
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 don't need to replace them with other programs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 Each program-name variable should come with an options variable that is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 used to supply options to the program. Append @samp{FLAGS} to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 program-name variable name to get the options variable name---for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 example, @code{BISONFLAGS}. (The name @code{CFLAGS} is an exception to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 this rule, but we keep it because it is standard.) Use @code{CPPFLAGS}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 in any compilation command that runs the preprocessor, and use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 @code{LDFLAGS} in any compilation command that does linking as well as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 in any direct use of @code{ld}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 If there are C compiler options that @emph{must} be used for proper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 compilation of certain files, do not include them in @code{CFLAGS}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 Users expect to be able to specify @code{CFLAGS} freely themselves.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 Instead, arrange to pass the necessary options to the C compiler
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 independently of @code{CFLAGS}, by writing them explicitly in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 compilation commands or by defining an implicit rule, like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 CFLAGS = -g
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 ALL_CFLAGS = -I. $(CFLAGS)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 .c.o:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 Do include the @samp{-g} option in @code{CFLAGS}, because that is not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 @emph{required} for proper compilation. You can consider it a default
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 that is only recommended. If the package is set up so that it is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 compiled with GCC by default, then you might as well include @samp{-O}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 in the default value of @code{CFLAGS} as well.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 Put @code{CFLAGS} last in the compilation command, after other variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 containing compiler options, so the user can use @code{CFLAGS} to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 override the others.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 Every Makefile should define the variable @code{INSTALL}, which is the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 basic command for installing a file into the system.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 Every Makefile should also define the variables @code{INSTALL_PROGRAM}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 and @code{INSTALL_DATA}. (The default for each of these should be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 @code{$(INSTALL)}.) Then it should use those variables as the commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 for actual installation, for executables and nonexecutables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 respectively. Use these variables as follows:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 $(INSTALL_PROGRAM) foo $(bindir)/foo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 $(INSTALL_DATA) libfoo.a $(libdir)/libfoo.a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 Always use a file name, not a directory name, as the second argument of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 the installation commands. Use a separate command for each file to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 installed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 @node Directory Variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 @section Variables for Installation Directories
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 Installation directories should always be named by variables, so it is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 easy to install in a nonstandard place. The standard names for these
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 variables are described below. They are based on a standard filesystem
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 layout; variants of it are used in SVR4, 4.4BSD, Linux, Ultrix v4, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 other modern operating systems.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 These two variables set the root for the installation. All the other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 installation directories should be subdirectories of one of these two,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 and nothing should be directly installed into these two directories.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 @table @samp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 @item prefix
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 A prefix used in constructing the default values of the variables listed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 below. The default value of @code{prefix} should be @file{/usr/local}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 When building the complete GNU system, the prefix will be empty and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 @file{/usr} will be a symbolic link to @file{/}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (If you are using Autoconf, write it as @samp{@@prefix@@}.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 @item exec_prefix
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 A prefix used in constructing the default values of some of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 variables listed below. The default value of @code{exec_prefix} should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 be @code{$(prefix)}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (If you are using Autoconf, write it as @samp{@@exec_prefix@@}.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 Generally, @code{$(exec_prefix)} is used for directories that contain
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 machine-specific files (such as executables and subroutine libraries),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 while @code{$(prefix)} is used directly for other directories.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 Executable programs are installed in one of the following directories.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 @table @samp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 @item bindir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 The directory for installing executable programs that users can run.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 This should normally be @file{/usr/local/bin}, but write it as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 @file{$(exec_prefix)/bin}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 (If you are using Autoconf, write it as @samp{@@bindir@@}.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 @item sbindir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 The directory for installing executable programs that can be run from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 the shell, but are only generally useful to system administrators. This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 should normally be @file{/usr/local/sbin}, but write it as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 @file{$(exec_prefix)/sbin}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (If you are using Autoconf, write it as @samp{@@sbindir@@}.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 @item libexecdir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 @comment This paragraph adjusted to avoid overfull hbox --roland 5jul94
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 The directory for installing executable programs to be run by other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 programs rather than by users. This directory should normally be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 @file{/usr/local/libexec}, but write it as @file{$(exec_prefix)/libexec}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (If you are using Autoconf, write it as @samp{@@libexecdir@@}.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 Data files used by the program during its execution are divided into
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 categories in two ways.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 Some files are normally modified by programs; others are never normally
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 modified (though users may edit some of these).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 Some files are architecture-independent and can be shared by all
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 machines at a site; some are architecture-dependent and can be shared
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 only by machines of the same kind and operating system; others may never
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 be shared between two machines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 This makes for six different possibilities. However, we want to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 discourage the use of architecture-dependent files, aside from object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 files and libraries. It is much cleaner to make other data files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 architecture-independent, and it is generally not hard.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 Therefore, here are the variables Makefiles should use to specify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 directories:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 @table @samp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 @item datadir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 The directory for installing read-only architecture independent data
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 files. This should normally be @file{/usr/local/share}, but write it as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 @file{$(prefix)/share}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (If you are using Autoconf, write it as @samp{@@datadir@@}.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 As a special exception, see @file{$(infodir)}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 and @file{$(includedir)} below.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 @item sysconfdir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 The directory for installing read-only data files that pertain to a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 single machine--that is to say, files for configuring a host. Mailer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 and network configuration files, @file{/etc/passwd}, and so forth belong
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 here. All the files in this directory should be ordinary ASCII text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 files. This directory should normally be @file{/usr/local/etc}, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 write it as @file{$(prefix)/etc}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 (If you are using Autoconf, write it as @samp{@@sysconfdir@@}.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 @c rewritten to avoid overfull hbox --tower
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 Do not install executables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 @c here
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 in this directory (they probably
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 belong in @file{$(libexecdir)} or @file{$(sbindir)}). Also do not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 install files that are modified in the normal course of their use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (programs whose purpose is to change the configuration of the system
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 excluded). Those probably belong in @file{$(localstatedir)}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 @item sharedstatedir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 The directory for installing architecture-independent data files which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 the programs modify while they run. This should normally be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 @file{/usr/local/com}, but write it as @file{$(prefix)/com}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (If you are using Autoconf, write it as @samp{@@sharedstatedir@@}.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 @item localstatedir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 The directory for installing data files which the programs modify while
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 they run, and that pertain to one specific machine. Users should never
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 need to modify files in this directory to configure the package's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 operation; put such configuration information in separate files that go
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 in @file{$(datadir)} or @file{$(sysconfdir)}. @file{$(localstatedir)}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 should normally be @file{/usr/local/var}, but write it as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 @file{$(prefix)/var}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (If you are using Autoconf, write it as @samp{@@localstatedir@@}.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 @item libdir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 The directory for object files and libraries of object code. Do not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 install executables here, they probably ought to go in @file{$(libexecdir)}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 instead. The value of @code{libdir} should normally be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 @file{/usr/local/lib}, but write it as @file{$(exec_prefix)/lib}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 (If you are using Autoconf, write it as @samp{@@libdir@@}.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 @item infodir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 The directory for installing the Info files for this package. By
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 default, it should be @file{/usr/local/info}, but it should be written
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 as @file{$(prefix)/info}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (If you are using Autoconf, write it as @samp{@@infodir@@}.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 @item includedir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 @c rewritten to avoid overfull hbox --roland
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 The directory for installing header files to be included by user
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 programs with the C @samp{#include} preprocessor directive. This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 should normally be @file{/usr/local/include}, but write it as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 @file{$(prefix)/include}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (If you are using Autoconf, write it as @samp{@@includedir@@}.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 Most compilers other than GCC do not look for header files in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 @file{/usr/local/include}. So installing the header files this way is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 only useful with GCC. Sometimes this is not a problem because some
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 libraries are only really intended to work with GCC. But some libraries
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 are intended to work with other compilers. They should install their
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 header files in two places, one specified by @code{includedir} and one
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 specified by @code{oldincludedir}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 @item oldincludedir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 The directory for installing @samp{#include} header files for use with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 compilers other than GCC. This should normally be @file{/usr/include}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 (If you are using Autoconf, you can write it as @samp{@@oldincludedir@@}.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 The Makefile commands should check whether the value of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 @code{oldincludedir} is empty. If it is, they should not try to use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 it; they should cancel the second installation of the header files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 A package should not replace an existing header in this directory unless
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 the header came from the same package. Thus, if your Foo package
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 provides a header file @file{foo.h}, then it should install the header
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 file in the @code{oldincludedir} directory if either (1) there is no
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 @file{foo.h} there or (2) the @file{foo.h} that exists came from the Foo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 package.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 To tell whether @file{foo.h} came from the Foo package, put a magic
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 string in the file---part of a comment---and @code{grep} for that string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 Unix-style man pages are installed in one of the following:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 @table @samp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 @item mandir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 The top-level directory for installing the man pages (if any) for this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 package. It will normally be @file{/usr/local/man}, but you should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 write it as @file{$(prefix)/man}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 (If you are using Autoconf, write it as @samp{@@mandir@@}.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 @item man1dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 The directory for installing section 1 man pages. Write it as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 @file{$(mandir)/man1}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 @item man2dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 The directory for installing section 2 man pages. Write it as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 @file{$(mandir)/man2}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 @item @dots{}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 @strong{Don't make the primary documentation for any GNU software be a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 man page. Write a manual in Texinfo instead. Man pages are just for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 the sake of people running GNU software on Unix, which is a secondary
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 application only.}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 @item manext
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 The file name extension for the installed man page. This should contain
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 a period followed by the appropriate digit; it should normally be @samp{.1}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 @item man1ext
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 The file name extension for installed section 1 man pages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 @item man2ext
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 The file name extension for installed section 2 man pages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 @item @dots{}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 Use these names instead of @samp{manext} if the package needs to install man
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 pages in more than one section of the manual.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 And finally, you should set the following variable:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 @table @samp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 @item srcdir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 The directory for the sources being compiled. The value of this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 variable is normally inserted by the @code{configure} shell script.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 (If you are using Autconf, use @samp{srcdir = @@srcdir@@}.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 For example:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 @c I have changed some of the comments here slightly to fix an overfull
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 @c hbox, so the make manual can format correctly. --roland
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 # Common prefix for installation directories.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 # NOTE: This directory must exist when you start the install.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 prefix = /usr/local
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 exec_prefix = $(prefix)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 # Where to put the executable for the command `gcc'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 bindir = $(exec_prefix)/bin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 # Where to put the directories used by the compiler.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 libexecdir = $(exec_prefix)/libexec
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 # Where to put the Info files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 infodir = $(prefix)/info
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 If your program installs a large number of files into one of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 standard user-specified directories, it might be useful to group them
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 into a subdirectory particular to that program. If you do this, you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 should write the @code{install} rule to create these subdirectories.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 Do not expect the user to include the subdirectory name in the value of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 any of the variables listed above. The idea of having a uniform set of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 variable names for installation directories is to enable the user to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 specify the exact same values for several different GNU packages. In
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 order for this to be useful, all the packages must be designed so that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 they will work sensibly when the user does so.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 @node Standard Targets
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 @section Standard Targets for Users
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 All GNU programs should have the following targets in their Makefiles:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 @table @samp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 @item all
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 Compile the entire program. This should be the default target. This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 target need not rebuild any documentation files; Info files should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 normally be included in the distribution, and DVI files should be made
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 only when explicitly asked for.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 By default, the Make rules should compile and link with @samp{-g}, so
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 that executable programs have debugging symbols. Users who don't mind
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 being helpless can strip the executables later if they wish.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 @item install
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 Compile the program and copy the executables, libraries, and so on to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 the file names where they should reside for actual use. If there is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 simple test to verify that a program is properly installed, this target
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 should run that test.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 Do not strip executables when installing them. Devil-may-care users can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 use the @code{install-strip} target to do that.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 If possible, write the @code{install} target rule so that it does not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 modify anything in the directory where the program was built, provided
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 @samp{make all} has just been done. This is convenient for building the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 program under one user name and installing it under another.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 The commands should create all the directories in which files are to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 installed, if they don't already exist. This includes the directories
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 specified as the values of the variables @code{prefix} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 @code{exec_prefix}, as well as all subdirectories that are needed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 One way to do this is by means of an @code{installdirs} target
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 as described below.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 Use @samp{-} before any command for installing a man page, so that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 @code{make} will ignore any errors. This is in case there are systems
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 that don't have the Unix man page documentation system installed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 The way to install Info files is to copy them into @file{$(infodir)}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 with @code{$(INSTALL_DATA)} (@pxref{Command Variables}), and then run
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 the @code{install-info} program if it is present. @code{install-info}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 is a program that edits the Info @file{dir} file to add or update the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 menu entry for the given Info file; it is part of the Texinfo package.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 Here is a sample rule to install an Info file:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 @comment This example has been carefully formatted for the Make manual.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 @comment Please do not reformat it without talking to roland@gnu.ai.mit.edu.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 $(infodir)/foo.info: foo.info
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 # There may be a newer info file in . than in srcdir.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 -if test -f foo.info; then d=.; \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 else d=$(srcdir); fi; \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 $(INSTALL_DATA) $$d/foo.info $@@; \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 # Run install-info only if it exists.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 # Use `if' instead of just prepending `-' to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 # line so we notice real errors from install-info.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 # We use `$(SHELL) -c' because some shells do not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 # fail gracefully when there is an unknown command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 if $(SHELL) -c 'install-info --version' \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 >/dev/null 2>&1; then \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 install-info --dir-file=$(infodir)/dir \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 $(infodir)/foo.info; \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 else true; fi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 @item uninstall
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 Delete all the installed files that the @samp{install} target would
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 create (but not the noninstalled files such as @samp{make all} would
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 create).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 This rule should not modify the directories where compilation is done,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 only the directories where files are installed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 @item install-strip
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 Like @code{install}, but strip the executable files while installing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 them. The definition of this target can be very simple:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 install-strip:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 install
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 Normally we do not recommend stripping an executable unless you are sure
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 the program has no bugs. However, it can be reasonable to install a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 stripped executable for actual execution while saving the unstripped
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 executable elsewhere in case there is a bug.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 @comment The gratuitous blank line here is to make the table look better
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 @comment in the printed Make manual. Please leave it in.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 @item clean
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 Delete all files from the current directory that are normally created by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 building the program. Don't delete the files that record the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 configuration. Also preserve files that could be made by building, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 normally aren't because the distribution comes with them.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 Delete @file{.dvi} files here if they are not part of the distribution.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 @item distclean
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 Delete all files from the current directory that are created by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 configuring or building the program. If you have unpacked the source
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 and built the program without creating any other files, @samp{make
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 distclean} should leave only the files that were in the distribution.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 @item mostlyclean
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 Like @samp{clean}, but may refrain from deleting a few files that people
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 normally don't want to recompile. For example, the @samp{mostlyclean}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 target for GCC does not delete @file{libgcc.a}, because recompiling it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 is rarely necessary and takes a lot of time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 @item maintainer-clean
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 Delete almost everything from the current directory that can be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 reconstructed with this Makefile. This typically includes everything
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 deleted by @code{distclean}, plus more: C source files produced by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 Bison, tags tables, Info files, and so on.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 The reason we say ``almost everything'' is that running the command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 @samp{make maintainer-clean} should not delete @file{configure} even if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 @file{configure} can be remade using a rule in the Makefile. More generally,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 @samp{make maintainer-clean} should not delete anything that needs to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 exist in order to run @file{configure} and then begin to build the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 program. This is the only exception; @code{maintainer-clean} should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 delete everything else that can be rebuilt.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 The @samp{maintainer-clean} target is intended to be used by a maintainer of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 the package, not by ordinary users. You may need special tools to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 reconstruct some of the files that @samp{make maintainer-clean} deletes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 Since these files are normally included in the distribution, we don't
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 take care to make them easy to reconstruct. If you find you need to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 unpack the full distribution again, don't blame us.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 To help make users aware of this, the commands for the special
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 @code{maintainer-clean} target should start with these two:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 @@echo 'This command is intended for maintainers to use; it'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 @@echo 'deletes files that may need special tools to rebuild.'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 @item TAGS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 Update a tags table for this program.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 @c ADR: how?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 @item info
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 Generate any Info files needed. The best way to write the rules is as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 follows:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 info: foo.info
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 foo.info: foo.texi chap1.texi chap2.texi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 $(MAKEINFO) $(srcdir)/foo.texi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 You must define the variable @code{MAKEINFO} in the Makefile. It should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 run the @code{makeinfo} program, which is part of the Texinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 distribution.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 @item dvi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 Generate DVI files for all Texinfo documentation.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 For example:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 dvi: foo.dvi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 foo.dvi: foo.texi chap1.texi chap2.texi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 $(TEXI2DVI) $(srcdir)/foo.texi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 You must define the variable @code{TEXI2DVI} in the Makefile. It should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 run the program @code{texi2dvi}, which is part of the Texinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 distribution.@footnote{@code{texi2dvi} uses @TeX{} to do the real work
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 of formatting. @TeX{} is not distributed with Texinfo.} Alternatively,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 write just the dependencies, and allow GNU @code{make} to provide the command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 @item dist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 Create a distribution tar file for this program. The tar file should be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 set up so that the file names in the tar file start with a subdirectory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 name which is the name of the package it is a distribution for. This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 name can include the version number.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 For example, the distribution tar file of GCC version 1.40 unpacks into
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 a subdirectory named @file{gcc-1.40}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 The easiest way to do this is to create a subdirectory appropriately
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 named, use @code{ln} or @code{cp} to install the proper files in it, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 then @code{tar} that subdirectory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
672 Compress the tar file with @code{gzip}. For example, the actual
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 distribution file for GCC version 1.40 is called @file{gcc-1.40.tar.gz}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 The @code{dist} target should explicitly depend on all non-source files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 that are in the distribution, to make sure they are up to date in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 distribution.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 @ifset CODESTD
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 @xref{Releases, , Making Releases}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 @end ifset
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 @ifclear CODESTD
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 @xref{Releases, , Making Releases, standards, GNU Coding Standards}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 @end ifclear
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 @item check
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 Perform self-tests (if any). The user must build the program before
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 running the tests, but need not install the program; you should write
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 the self-tests so that they work when the program is built but not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 installed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 The following targets are suggested as conventional names, for programs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 in which they are useful.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 @table @code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 @item installcheck
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 Perform installation tests (if any). The user must build and install
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 the program before running the tests. You should not assume that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 @file{$(bindir)} is in the search path.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 @item installdirs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 It's useful to add a target named @samp{installdirs} to create the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 directories where files are installed, and their parent directories.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 There is a script called @file{mkinstalldirs} which is convenient for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 this; you can find it in the Texinfo package.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 @c It's in /gd/gnu/lib/mkinstalldirs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 You can use a rule like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 @comment This has been carefully formatted to look decent in the Make manual.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 @comment Please be sure not to make it extend any further to the right.--roland
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 # Make sure all installation directories (e.g. $(bindir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 # actually exist by making them if necessary.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 installdirs: mkinstalldirs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 $(srcdir)/mkinstalldirs $(bindir) $(datadir) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 $(libdir) $(infodir) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 $(mandir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 This rule should not modify the directories where compilation is done.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 It should do nothing but create installation directories.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 @end table