2232 |
Similarly you should not rely on @code{AC_OUTPUT_FILES} to replace |
Similarly you should not rely on @code{AC_OUTPUT_FILES} to replace |
2233 |
@code{datadir} and friends in your shell scripts and other files, rather |
@code{datadir} and friends in your shell scripts and other files, rather |
2234 |
let @command{make} manage their replacement. For instance Autoconf |
let @command{make} manage their replacement. For instance Autoconf |
2235 |
ships templates of its shell scripts ending with @samp{.sh}, and uses |
ships templates of its shell scripts ending with @samp{.in}, and uses a |
2236 |
this Makefile snippet: |
Makefile snippet similar to: |
2237 |
|
|
2238 |
@example |
@example |
2239 |
.sh: |
@group |
2240 |
|
edit = sed \ |
2241 |
|
-e 's,@@datadir\@@,$(pkgdatadir),g' \ |
2242 |
|
-e 's,@@prefix\@@,$(prefix),g' |
2243 |
|
@end group |
2244 |
|
|
2245 |
|
autoconf autoheader: Makefile |
2246 |
|
@group |
2247 |
|
.in: |
2248 |
rm -f $@@ $@@.tmp |
rm -f $@@ $@@.tmp |
2249 |
sed 's,@@datadir\@@,$(pkgdatadir),g' $< >$@@.tmp |
$(edit) $< >$@@.tmp |
2250 |
chmod +x $@@.tmp |
chmod +x $@@.tmp |
2251 |
mv $@@.tmp $@@ |
mv $@@.tmp $@@ |
2252 |
|
@end group |
2253 |
@end example |
@end example |
2254 |
|
|
2255 |
Three things are noteworthy: |
Five details are noteworthy: |
2256 |
|
|
2257 |
@table @samp |
@table @samp |
2258 |
@item @@datadir\@@ |
@item @@datadir\@@ |
2267 |
Don't use @samp{/} in the sed expression(s) since most probably the |
Don't use @samp{/} in the sed expression(s) since most probably the |
2268 |
variables you use, such as @samp{$(pkgdatadir)}, will contain |
variables you use, such as @samp{$(pkgdatadir)}, will contain |
2269 |
some. |
some. |
2270 |
|
|
2271 |
|
@item Dependency on @file{Makefile} |
2272 |
|
Since @code{edit} uses values that depend on the configuration specific |
2273 |
|
values (@code{prefix} etc.) and not only on @code{VERSION} and so forth, |
2274 |
|
the output depends on @file{Makefile}, not @file{configure.ac}. |
2275 |
|
|
2276 |
|
@item Separated dependency |
2277 |
|
Don't write |
2278 |
|
|
2279 |
|
@example |
2280 |
|
.in: Makefile |
2281 |
|
@dots{} |
2282 |
|
@end example |
2283 |
|
|
2284 |
|
@noindent |
2285 |
|
unless you really mean to create the file @file{.in} from @file{Makefile}. |
2286 |
@end table |
@end table |
2287 |
|
|
2288 |
|
|