2245 |
-e 's,@@prefix\@@,$(prefix),g' |
-e 's,@@prefix\@@,$(prefix),g' |
2246 |
@end group |
@end group |
2247 |
|
|
|
autoconf autoheader: Makefile |
|
2248 |
@group |
@group |
2249 |
.in: |
autoconf: Makefile autoconf.in |
2250 |
rm -f $@@ $@@.tmp |
rm -f autoconf autoconf.tmp |
2251 |
$(edit) $< >$@@.tmp |
$(edit) $< >autoconf.tmp |
2252 |
chmod +x $@@.tmp |
chmod +x autoconf.tmp |
2253 |
mv $@@.tmp $@@ |
mv autoconf.tmp autoconf |
2254 |
|
@end group |
2255 |
|
|
2256 |
|
@group |
2257 |
|
autoheader: Makefile autoheader.in |
2258 |
|
rm -f autoheader autoheader.tmp |
2259 |
|
$(edit) $< >autoheader.tmp |
2260 |
|
chmod +x autoheader.tmp |
2261 |
|
mv autoheader.tmp autoheader |
2262 |
@end group |
@end group |
2263 |
@end example |
@end example |
2264 |
|
|
2265 |
Five details are noteworthy: |
Some details are noteworthy: |
2266 |
|
|
2267 |
@table @samp |
@table @samp |
2268 |
@item @@datadir\@@ |
@item @@datadir\@@ |
2283 |
values (@code{prefix} etc.) and not only on @code{VERSION} and so forth, |
values (@code{prefix} etc.) and not only on @code{VERSION} and so forth, |
2284 |
the output depends on @file{Makefile}, not @file{configure.ac}. |
the output depends on @file{Makefile}, not @file{configure.ac}. |
2285 |
|
|
2286 |
@item Separated dependency |
@item Separated dependencies and Single Suffix Rules |
2287 |
Don't write |
You can't use them! The above snippet cannot be (portably) rewritten |
2288 |
|
as: |
2289 |
|
|
2290 |
@example |
@example |
2291 |
.in: Makefile |
autoconf autoheader: Makefile |
2292 |
@dots{} |
@group |
2293 |
|
.in: |
2294 |
|
rm -f $@@ $@@.tmp |
2295 |
|
$(edit) $< >$@@.tmp |
2296 |
|
chmod +x $@@.tmp |
2297 |
|
mv $@@.tmp $@@ |
2298 |
|
@end group |
2299 |
@end example |
@end example |
2300 |
|
|
2301 |
@noindent |
@xref{Limitations of Make}, for details. |
|
unless you really mean to create the file @file{.in} from @file{Makefile}. |
|
2302 |
@end table |
@end table |
2303 |
|
|
2304 |
|
|
2408 |
@cindex Configuration Header |
@cindex Configuration Header |
2409 |
@cindex @file{config.h} |
@cindex @file{config.h} |
2410 |
|
|
2411 |
When a package contains more than a few tests that define C preprocessor symbols, the command |
When a package contains more than a few tests that define C preprocessor |
2412 |
lines to pass @option{-D} options to the compiler can get quite long. |
symbols, the command lines to pass @option{-D} options to the compiler |
2413 |
This causes two problems. One is that the @command{make} output is hard to |
can get quite long. This causes two problems. One is that the |
2414 |
visually scan for errors. More seriously, the command lines can exceed |
@command{make} output is hard to visually scan for errors. More |
2415 |
the length limits of some operating systems. As an alternative to |
seriously, the command lines can exceed the length limits of some |
2416 |
passing @option{-D} options to the compiler, @command{configure} scripts can |
operating systems. As an alternative to passing @option{-D} options to |
2417 |
create a C header file containing @samp{#define} directives. The |
the compiler, @command{configure} scripts can create a C header file |
2418 |
@code{AC_CONFIG_HEADERS} macro selects this kind of output. It should |
containing @samp{#define} directives. The @code{AC_CONFIG_HEADERS} |
2419 |
be called right after @code{AC_INIT}. |
macro selects this kind of output. It should be called right after |
2420 |
|
@code{AC_INIT}. |
2421 |
|
|
2422 |
The package should @samp{#include} the configuration header file before |
The package should @samp{#include} the configuration header file before |
2423 |
any other header files, to prevent inconsistencies in declarations (for |
any other header files, to prevent inconsistencies in declarations (for |
10971 |
% @kbd{pmake} # BSD make |
% @kbd{pmake} # BSD make |
10972 |
cp ../bar.x bar.y |
cp ../bar.x bar.y |
10973 |
@end example |
@end example |
|
|
|
10974 |
@end table |
@end table |
10975 |
|
@c end item about VPATH |
10976 |
|
|
10977 |
|
@item Single Suffix Rules and Separated Dependencies |
10978 |
|
@cindex Single Suffix Inference Rule |
10979 |
|
@cindex Rule, Single Suffix Inference |
10980 |
|
A @dfn{Single Suffix Rule} is basically a usual suffix (inference) rule |
10981 |
|
(@samp{.from.to:}), but which @emph{destination} suffix is empty |
10982 |
|
(@samp{.from:}). |
10983 |
|
|
10984 |
|
@cindex Separated Dependencies |
10985 |
|
@dfn{Separated dependencies} simply refers to listing the prerequisite |
10986 |
|
of a target, without defining a rule. Usually one can list on the one |
10987 |
|
hand side, the rules, and on the other hand side, the dependencies. |
10988 |
|
|
10989 |
|
Solaris @command{make} does not support separated dependencies for |
10990 |
|
targets defined by single suffix rules: |
10991 |
|
|
10992 |
|
@example |
10993 |
|
$ @kbd{cat Makefile} |
10994 |
|
.SUFFIXES: .in |
10995 |
|
foo: foo.in |
10996 |
|
.in: |
10997 |
|
cp $< $@ |
10998 |
|
$ @kbd{touch foo.in} |
10999 |
|
$ @kbd{make} |
11000 |
|
$ @kbd{ls} |
11001 |
|
Makefile foo.in |
11002 |
|
@end example |
11003 |
|
|
11004 |
|
@noindent |
11005 |
|
while @acronym{GNU} Make does: |
11006 |
|
|
11007 |
|
@example |
11008 |
|
$ @kbd{gmake} |
11009 |
|
cp foo.in foo |
11010 |
|
$ @kbd{ls} |
11011 |
|
Makefile foo foo.in |
11012 |
|
@end example |
11013 |
|
|
11014 |
|
Note it works without the @samp{foo: foo.in} dependency. |
11015 |
|
|
11016 |
|
@example |
11017 |
|
$ @kbd{cat Makefile} |
11018 |
|
.SUFFIXES: .in |
11019 |
|
.in: |
11020 |
|
cp $< $@ |
11021 |
|
$ @kbd{make foo} |
11022 |
|
cp foo.in foo |
11023 |
|
@end example |
11024 |
|
|
11025 |
|
@noindent |
11026 |
|
and it works with double suffix inference rules: |
11027 |
|
|
11028 |
|
@example |
11029 |
|
$ @kbd{cat Makefile} |
11030 |
|
foo.out: foo.in |
11031 |
|
.SUFFIXES: .in .out |
11032 |
|
.in.out: |
11033 |
|
cp $< $@ |
11034 |
|
$ @kbd{make} |
11035 |
|
cp foo.in foo.out |
11036 |
|
@end example |
11037 |
|
|
11038 |
|
As a result, in such a case, you have to write target rules. |
11039 |
@end table |
@end table |
11040 |
|
|
11041 |
|
|