[erlang-questions] Erlang and autoconf/make
Tue Nov 14 06:54:31 CET 2006
> I am slowly trying to turn my SCons-based projects into
> autoconf/make-based projects. In a sense it is a step
> backwards, but if choosing a more mainstream building system
> makes my lib easier to use better (and I'll have to maintain
> one less application, that is, I won't have to maintain
> I am open to any suggestion about something that I might be
> doing wrong or not totally right. This is my configure.in
> it is really small,
And you can make it smaller!
I believe that you reused the configure.ac from gtknode, which is
good, but you don't need as much as in gtknode. For instance,
you don't need to check for erl_interface, since you don't have
C code here. (?)
Therefore, your configure.ac can be reduced to:
AC_INIT(Modules to write servers, 0.0.0, pupeno@REDACTED,
AC_COPYRIGHT(Copyright (C) 2006 Jose Pablo Pupeno Fernandez)
dnl Require autoconf version >=2.59c. first one with erlang
dnl Require automake version >=1.9.5.
Oh, and please call your file configure.ac instead of
configure.in. This has been the new convention for a while.
Since we require Autoconf version >= 2.59c, we are sure that the
Autoconf that will be used supports that convention.
> and this is the main Makefile.am
> And in that last one is where I am worried. I have to list the
> sources and the beam files, is that needed ? I have to also
> put the .app among the (automatically generated) beam files,
> is that needed as well ? I mean, isn't there a better way ?
If your .app file is not generated, and is therefore a "source
file", then it must be explicitly included in the distributed
files (EXTRA_DIST), like the .erl files, and it must *not* be
included in the files to clean (CLEANFILES).
However, since your .app file must be installed in a directory
different from .../src/, you can't add your .app files into the
erlsrc_DATA variable, so you must define new erlapp* variables:
erlsrcdir = $(ERLANG_INSTALL_LIB_DIR_serlvers)/src
erlsrc_DATA = dns_msg.erl gen_chargen.erl gen_daytime.erl
gen_dns.erl gen_echo.erl gen_time.erl launcher.erl
EXTRA_DIST = $(erlsrc_DATA)
erlbeamdir = $(ERLANG_INSTALL_LIB_DIR_serlvers)/ebin
erlbeam_DATA = dns_msg.beam gen_chargen.beam gen_daytime.beam
gen_dns.beam gen_echo.beam gen_time.beam launcher.beam
CLEANFILES = $(erlbeam_DATA)
erlappdir = $(erlbeamdir)
erlapp_DATA = serlvers.app
EXTRA_DIST += $(erlapp_DATA)
SUFFIXES = .erl .beam
$(ERLC) $(ERLCFLAGS) -b beam $<
And likewise, you should define a series of variables for every
other kind of source or generated files (.rel, etc.) if you have
Now, your files are nice and clean! (^_^)
> Something closer to what I've done with SCons ? Thank you.
Sorry, I don't know much about SCons.
But the files above seem to do the same as yours.
Hopefully, Ruslan Babayev may add support for Erlang in Automake,
to help writing Makefile.am files. Until then, we will have to
explicitly write separate sets of variables for different kinds
of files, in Makefile.am files, as shown above.
Pr. Chiba Shigeru Group
Dept. of Mathematical and Computing Sciences
Tokyo Institute of Technology
More information about the erlang-questions