[erlang-questions] Erlang and autoconf/make
Romain Lenglet
rlenglet@REDACTED
Thu Nov 16 05:39:18 CET 2006
Richard A. O'Keefe wrote:
> Romain Lenglet wrote:
> > But I believed that pattern rules were a GNU Make'ism?
>
> Pupeno <pupeno@REDACTED> asked:
> Can any BSDer confirm this ?
>
> I don't run BSD on any of my machines.
I have installed NetBSD make (pmake) on Debian (package pmake):
it supports pattern rules.
I have also found a FreeBSD 6.1 box here: its make does *NOT*
support pattern rules.
And by the way, even when using implicit rules, the syntax:
SUFFIXES = .erl .beam
is *NOT* supported by FreeBSD make.
One must use:
.SUFFIXES: .erl .beam
This syntax is supported by GNU make, pmake and FreeBSD make.
Therefore, I strongly suggest to not use pattern rules, and to
use implicit rules instead, such as:
.SUFFIXES: .erl .beam .rel .script .boot
.erl.beam:
$(ERLC) $(ERLCFLAGS) -b beam $<
.rel.script:
$(ERLC) $(ERLCFLAGS) -b beam $<
.rel.boot:
$(ERLC) $(ERLCFLAGS) -b beam $<
> However, I *can* tell you that
> (1) On Alpha OSF V5.1, the manual page for 'make' mentions %
> in only two contexts: the shell prompt for sample commands
> and various NLS escapes in MANPATH.
> (2) I have an on-line copy of the Single Unix Specification,
> Version 3. The description of 'make' says "There are two types
> of rule: 1. Inference rules, which have one target name with
> at least one period ('.') and no slash ('/')
> 2. Target rules, which can have more than one target name."
> No pattern rules. In fact the rationale at the end says
> "Consideration was given to adding emtarules to the
> POSIX make. This would make %.o: %.c the same as .c.o:. This
> is quite useful and available from some vendors, but it would
> cause too many changes to this make to support,. It would
> have introduced rule chaining and new substitution rules.
> However, the rules for target names have been set to reserve
> the '%' and '"' characters. These are traditionally used to
> implement metarules and quoting of target names, respectively.
> Implementors are strongly encouraged to use these characters
> only for these purposes."
Thanks for the information!
> If the Automake people didn't do their design with a copy of
> the SUS (or POSIX.2 or SVID or ...) in front of them, I will
> be very surprised.
Yes, Automake generates Makefiles that are portable and can be
interpreted by any make.
It lets one write some GNU-specific extensions, like pattern
rules, or the use of $< and $@ in explicit rules, but that is
the coder's responsibility then if the Makefile is not portable.
The only GNU-specific extension supported by Automake is the +=
affectations of variables, cf. the Automake manual:
-8<-------
Note that most GNU make extensions are not recognized by
Automake. Using such extensions in a Makefile.am will lead to
errors or confusing behavior.
A special exception is that the GNU make append operator, +=, is
supported. This operator appends its right hand argument to the
variable specified on the left. Automake will translate the
operator into an ordinary = operator; += will thus work with any
make program.
-8<-------
Regards,
--
Romain LENGLET
More information about the erlang-questions
mailing list