[erlang-questions] Erlang and autoconf/make

Pupeno <>
Tue Nov 14 15:24:21 CET 2006


On Tuesday 14 November 2006 05:54, Romain Lenglet wrote:
> I believe that you reused the configure.ac from gtknode,

That's where I copied it from.

> you don't need to check for erl_interface, since you don't have
> C code here. (?)

Yes, it is commented out.

> Therefore, your configure.ac can be reduced to:
>
> AC_INIT(Modules to write servers, 0.0.0, ,
> serlvers)
> AC_COPYRIGHT(Copyright (C) 2006 Jose Pablo Pupeno Fernandez)
>
> dnl Require autoconf version >=2.59c. first one with erlang
> macros
> AC_PREREQ(2.59c)
> dnl Require automake version >=1.9.5.
> AM_INIT_AUTOMAKE(1.9.5)
>
> AC_ERLANG_NEED_ERLC
>
> AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR(AC_PACKAGE_TARNAME,
> AC_PACKAGE_VERSION)
>
> AC_CONFIG_FILES([Makefile src/Makefile])
>
> AC_OUTPUT

No need for 

AC_ERLANG_SUBST_ROOT_DIR
AC_ERLANG_SUBST_LIB_DIR
AC_ERLANG_SUBST_INSTALL_LIB_DIR

?

> 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.

Oh, ok, done. Thanks.

> > and this is the main Makefile.am
> > http://software.pupeno.com/Serlvers/src/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,

It can be 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
> .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
> any.

Ok, thanks.

> 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.

Oh, I see what is missing now.
-- 
Pupeno <> (http://pupeno.com)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20061114/b55191fb/attachment.bin>


More information about the erlang-questions mailing list