Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Another try to get the make dist working with or without supernovae
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 2 Dec 2009 15:49:30 +0000 (15:49 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 2 Dec 2009 15:49:30 +0000 (15:49 +0000)
This was not a bug of automake, but a feature: it seeks every files
  which may be needed by a if/endif branch and makes sure they are in
  the archive. Adding an extra variable didn't solve the issue since
  automake follows variable definitions.
Declaring supernovae files as BUILT_SOURCE was uneffective (still
  trying to add them to the archive) and counter productive (automake
  tried to build them even in non-supernovae mode)
So the solution is to prevent automake from derivating the DIST files
  from the lib_*_la_SOURCES. For that, I use nodist_lib_*_la_SOURCES
  and take care of the EXTRA_DIST files manually.

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6862 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/Makefile.am

index 0202a4e..9f35fe3 100644 (file)
@@ -383,12 +383,20 @@ endif
 
 ##
 ## Compile the libs
-CLEANFILES=
-  
+CLEANFILES=supernovae_sg.c supernovae_gras.c supernovae_smpi.c
+BUILT_SOURCES=
+
+# Cannot let automake autocompute the content of dist from
+#  lib*_la_SOURCES variables since it would include supernovae files,
+#  which are only generated sometimes, not always.
+# So, use nodist_lib*_la_SOURCES variables and add stuff to EXTRA_DIST manually
+
+EXTRA_DIST+=$(simgrid_sources) $(gras_sources)
 
 if SUPERNOVAE_MODE
 simgrid_fragile_sources=gras/DataDesc/ddt_parse.yy.c surf/surfxml_parse.c xbt/graphxml_parse.c simdag/sd_daxloader.c
 gras_fragile_sources=gras/DataDesc/ddt_parse.yy.c xbt/graphxml_parse.c
+BUILT_SOURCES+=supernovae_sg.c supernovae_gras.c supernovae_smpi.c
 
 supernovae_sg.c: Makefile.am
        ./mk_supernovae.sh supernovae_sg.c $(filter-out $(simgrid_fragile_sources),$(simgrid_sources))
@@ -396,19 +404,14 @@ supernovae_gras.c: Makefile.am
        ./mk_supernovae.sh supernovae_gras.c $(filter-out $(gras_fragile_sources),$(gras_sources))
 supernovae_smpi.c: Makefile.am
        ./mk_supernovae.sh supernovae_smpi.c $(filter-out $(smpi_fragile_sources),$(smpi_sources))
-CLEANFILES+=supernovae_sg.c supernovae_gras.c supernovae_smpi.c
 
-simgrid_sources_to_use =  supernovae_sg.c $(simgrid_fragile_sources)
-gras_sources_to_use = supernovae_gras.c $(gras_fragile_sources)
+nodist_libsimgrid_la_SOURCES =  supernovae_sg.c $(simgrid_fragile_sources)
+nodist_libgras_la_SOURCES = supernovae_gras.c $(gras_fragile_sources)
 else
-simgrid_sources_to_use = $(simgrid_sources)
-gras_sources_to_use = $(gras_sources)
+nodist_libsimgrid_la_SOURCES = $(simgrid_sources)
+nodist_libgras_la_SOURCES = $(gras_sources)
 endif
 
-# Automake 11 has a bug if the 2 next variables are defined twice in #if branches. 
-# The dist target uses the first definition, regardless of whether it is the used branch or not
-libsimgrid_la_SOURCES = $(simgrid_sources_to_use)
-libgras_la_SOURCES = $(gras_sources_to_use)
 
 if GRAMINE_MODE
 else 
@@ -435,7 +438,7 @@ TEST_UNITS= @builddir@/cunit_unit.c   @builddir@/ex_unit.c         \
            @builddir@/xbt_str_unit.c @builddir@/xbt_strbuff_unit.c @builddir@/xbt_sha_unit.c\
             @builddir@/config_unit.c  @builddir@/xbt_synchro_unit.c
 
-BUILT_SOURCES=../include/surf/simgrid_dtd.h surf/simgrid_dtd.c \
+BUILT_SOURCES+=../include/surf/simgrid_dtd.h surf/simgrid_dtd.c \
               ../include/xbt/graphxml.h xbt/graphxml.c \
               simdag/dax_dtd.h simdag/dax_dtd.c \
               gras/DataDesc/ddt_parse.yy.c \