() Ralf Wildenhues <ralf.wildenh...@gmx.de> () Sun, 15 Aug 2010 23:32:44 +0200
Yes, with a general example, please. I am unsure what "general example" means, precisely, so the patch below simply uses the one in The GNU Make Manual. Is that ok? _____________________________________________________
>From 7b70f8b27057c5b9a0f621dcfd5064c5d90947dd Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen <t...@gnuvola.org> Date: Mon, 16 Aug 2010 02:14:56 +0200 Subject: [PATCH] Document a common conversion for GNU make pattern rules. * doc/automake.texi (Multiple Outputs): Expand on GNU make pattern rules; explain how to convert a common case to use old-fashioned suffix rules; add simple example, xref. --- ChangeLog | 7 +++++++ doc/automake.texi | 30 +++++++++++++++++++++++++----- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9ba4851..ca59933 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-08-16 Thien-Thi Nguyen <t...@gnuvola.org> (tiny change) + + Document a common conversion for GNU make pattern rules. + * doc/automake.texi (Multiple Outputs): Expand on GNU make + pattern rules; explain how to convert a common case to use + old-fashioned suffix rules; add simple example, xref. + 2010-08-12 Peter Rosin <p...@lysator.liu.se> Enable the use of "link -lib" as the wrapped archiver. diff --git a/doc/automake.texi b/doc/automake.texi index bbb74d3..f95f5cd 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -11525,11 +11525,31 @@ @node Multiple Outputs @c $$ For completeness it should be noted that GNU @command{make} is able to -express rules with multiple output files using pattern rules -(@pxref{Pattern Examples, , Pattern Rule Examples, make, The GNU Make -Manual}). We do not discuss pattern rules here because they are not -portable, but they can be convenient in packages that assume GNU -...@command{make}. +express rules with multiple output files using pattern rules. +Although pattern rules are not portable, they can be +convenient in packages that assume GNU @command{make}. +...@xref{pattern Examples, , Pattern Rule Examples, make, The GNU Make +Manual}. + +In the common case where the @samp{%} in the pattern rule is used to +match the stem of a filename, and the prerequisite and target differ +only in the filename extension, you can use the old fashioned suffix +rule instead. For example: + +...@example +# pattern rule, not portable +%.o : %.c + $(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@@ $< + +# old fashioned suffix rule, portable +.c.o: + $(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@@ $< +...@end example + +Take care, when converting from pattern rule syntax to suffix rule +syntax, to place the prerequisite extension @file{.c} before that +of the target extension @file{.o}. +...@xref{suffix Rules, , Old-Fashioned Suffix Rule, make, The GNU Make Manual}. @node Hard-Coded Install Paths -- 1.6.3.2