+
+if GRAMINE_MODE
+else
+###
+### Testing infrastructure
+###
+
+# Test files must be added both to the TEST_CFILES and TEST_UNITS because
+# if I compute TEST_UNITS from TEST_CFILES, automake fails to note that they
+# are generated. Sorry about that.
+
+# If you add a test unit, you should regenerate simgrid_units_main.c from scratch:
+# make clean-units ; make testall
+
+# Suites and tests run in the given order.
+
+noinst_PROGRAMS=testall
+TEST_CFILES=xbt/cunit.c xbt/ex.c \
+ xbt/dynar.c xbt/dict.c xbt/set.c xbt/swag.c \
+ xbt/xbt_str.c xbt/xbt_sha.c \
+ xbt/config.c
+TEST_UNITS= @builddir@/cunit_unit.c @builddir@/ex_unit.c \
+ @builddir@/dynar_unit.c @builddir@/dict_unit.c @builddir@/set_unit.c @builddir@/swag_unit.c \
+ @builddir@/xbt_str_unit.c @builddir@/xbt_strbuff_unit.c @builddir@/xbt_sha_unit.c\
+ @builddir@/config_unit.c
+
+BUILT_SOURCES=../include/surf/simgrid_dtd.h surf/simgrid_dtd.c \
+ ../include/xbt/graphxml.h xbt/graphxml.c \
+ gras/DataDesc/ddt_parse.yy.c \
+ $(TEST_UNITS) @builddir@/simgrid_units_main.c
+
+testall_SOURCES= $(TEST_UNITS) @builddir@/simgrid_units_main.c
+testall_LDADD=libgras.la
+TESTS=testall
+TESTS_ENVIRONMENT=$(SG_TEST_EXENV)
+
+EXTRA_DIST+=$(testall_SOURCES)
+
+if MAINTAINER_MODE
+CLEANFILES=$(TEST_UNITS)
+
+$(TEST_UNITS): xbt/cunit.c xbt/ex.c xbt/xbt_str.c xbt/xbt_strbuff.c xbt/xbt_sha.c\
+ xbt/dynar.c xbt/dict.c xbt/set.c xbt/swag.c xbt/config.c
+ @top_srcdir@/tools/sg_unit_extractor.pl $^
+
+@builddir@/simgrid_units_main.c: $(TEST_UNITS)
+ @top_srcdir@/tools/sg_unit_extractor.pl @srcdir@/xbt/cunit.c
+
+clean-units:
+ rm -f simgrid_units_main.c *_unit.c @srcdir@/simgrid_units_main.c @srcdir@/*_unit.c
+ for n in $(TEST_UNITS) ; do \
+ dep=`echo $$n|sed -e 's|.c$$|.Po|' -e 's|[^/]*/||' -e 's|^|.deps/|'`; \
+ echo "Removing dependency tracker of $$n ($$dep @srcdir@/$$dep)"; \
+ rm -vf $$dep @srcdir@/$$dep; touch $$dep; \
+ done
+else
+
+if BOTBUILD_MODE
+$(TEST_UNITS) simgrid_units_main.c clean-units:
+ @echo "WARNING: Test units not generated, but touched instead since this is a bot build."
+ touch $@
+else
+$(TEST_UNITS) simgrid_units_main.c clean-units:
+ @echo "ERROR: Test units not generated."
+ @echo "ERROR: If you are using a SVN checkout, configure with the --enable-maintainer-mode flag"
+ @echo "ERROR: If not, please report the bug to the simgrid-devel mailing list."
+ @exit 1
+endif
+endif
+
+###
+### Regenerate what needs to with flex & flexml
+###
+
+
+gras/DataDesc/ddt_parse.yy.c: gras/DataDesc/ddt_parse.yy.l
+ set -e;@LEX@ -o$@ -Pgras_ddt_parse_ --noline $^
+
+if MAINTAINER_MODE
+surf/simgrid_dtd.c: surf/simgrid_dtd.l
+ set -e;mkdir -p `dirname $@`; @LEX@ -o$@ -Psurf_parse_ --noline $^
+ sed 's/#include <unistd.h>/#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__)\n# ifndef __STRICT_ANSI__\n# include <io.h>\n# include <process.h>\n# endif\n#else\n# include <unistd.h>\n#endif/g' -i $@
+xbt/graphxml.c: xbt/graphxml.l
+ set -e;mkdir -p `dirname $@`; @LEX@ -o$@ -Pxbt_graph_parse_ --noline $^
+ sed 's/#include <unistd.h>/#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__)\n# ifndef __STRICT_ANSI__\n# include <io.h>\n# include <process.h>\n# endif\n#else\n# include <unistd.h>\n#endif/g' -i $@
+
+if HAVE_FLEXML
+surf/simgrid_dtd.l: $(srcdir)/surf/simgrid.dtd
+ set -e; mkdir -p surf; flexml --root-tags platform -b 1000000 -P surfxml --sysid=simgrid.dtd -S $@ -L $^
+$(top_srcdir)/include/surf/simgrid_dtd.h: $(srcdir)/surf/simgrid.dtd
+ rm -f $(top_srcdir)/include/surf/simgrid.h
+ set -e; flexml --root-tags platform -P surfxml --sysid=simgrid.dtd -H $@ -L $^
+ if test -e $(top_srcdir)/include/surf/simgrid.h ; then mv $(top_srcdir)/include/surf/simgrid.h $@ ; fi
+ sed 's/extern *\([^ ]*[ \*]*\)/XBT_PUBLIC_DATA(\1) /' -i $@
+ sed 's/XBT_PUBLIC_DATA(\([^)]*\)) *\([^(]*\)(/XBT_PUBLIC(\1) \2(/' -i $@
+
+xbt/graphxml.l: $(srcdir)/xbt/graphxml.dtd
+ set -e; flexml -b 1000000 -P graphxml --sysid=graphxml.dtd -S $@ -L $^
+$(top_srcdir)/include/xbt/graphxml.h: $(srcdir)/xbt/graphxml.dtd
+ set -e; flexml -P graphxml --sysid=graphxml.dtd -H $@ -L $^
+ sed 's/extern *\([^ ]*[ \*]*\)/XBT_PUBLIC_DATA(\1) /' -i $@
+ sed 's/XBT_PUBLIC_DATA(\([^)]*\)) *\([^(]*\)(/XBT_PUBLIC(\1) \2(/' -i $@
+else
+
+$(top_srcdir)/include/surf/simgrid_dtd.h surf/simgrid_dtd.l: $(top_srcdir)/src/surf/simgrid.dtd
+ @echo "ERROR: src/surf/simgrid.dtd was modified, but the flexml program was not detected"
+ @echo "ERROR: Please install it, or if you didn't modify this file, try this:"
+ @echo "ERROR: touch include/surf/simgrid_dtd.h src/surf/simgrid_dtd.l"
+ @exit 1
+$(top_srcdir)/include/xbt/graphxml.h xbt/graphxml.l: $(top_srcdir)/src/xbt/graphxml.dtd
+ @echo "ERROR: src/xbt/graphxml.dtd was modified, but the flexml program was not detected"
+ @echo "ERROR: Please install it, or if you didn't modify this file, try this:"
+ @echo "ERROR: touch include/xbt/graphxml.h src/xbt/graphxml.l"
+ @exit 1
+endif
+endif
+endif
+
+include $(top_srcdir)/acmacro/dist-files.mk