+###
+### Declare the library content
+###
+
+lib_LTLIBRARIES= libsimgrid.la libgras.la libsmpi.la
+
+libgras_la_SOURCES= $(XBT_SRC) $(GRAS_COMMON_SRC) $(GRAS_RL_SRC) $(AMOK_SRC)
+libgras_la_LDFLAGS = -no-undefined $(VERSION_INFO) @GRAS_DEP@ @LD_DYNAMIC_FLAGS@ -lm
+
+libsimgrid_la_SOURCES = $(XBT_SRC) $(SURF_SRC) $(GTNETS_USED) \
+ $(SIMIX_SRC) $(CTX_SRC) \
+ $(MSG_SRC) $(SIMDAG_SRC) \
+ $(GRAS_COMMON_SRC) $(GRAS_SG_SRC) $(AMOK_SRC)
+libsimgrid_la_LDFLAGS = -no-undefined $(VERSION_INFO) @SIMGRID_DEP@ @LD_DYNAMIC_FLAGS@ -lm
+# -Wl,--entry -Wl,simgrid_version
+
+# Please do not add -no-undefined to libsmpi_la_LDFLAGS:
+# smpi_simulated_main is indeed defined in user code, and undef in the
+# library (no idea why it works under linux, but it fails under windows)
+libsmpi_la_LIBADD = libsimgrid.la
+libsmpi_la_SOURCES = $(SMPI_SRC)
+libsmpi_la_LDFLAGS = $(VERSION_INFO) @SMPI_DEP@ @LD_DYNAMIC_FLAGS@ -lm
+
+# Windows users (at least, MSVC ones) need a def file.
+if IS_WINDOWS
+libgras_la_LDFLAGS += -Wl,--output-def,libgras.def
+libsimgrid_la_LDFLAGS += -Wl,--output-def,libsimgrid.def
+libsmpi_la_LDFLAGS += -Wl,--output-def,libsmpi.def
+endif
+
+##
+## Java cruft
+
+EXTRA_DIST+=$(JMSG_JAVA_SRC)
+
+if HAVE_JAVA
+libsimgrid_la_SOURCES += $(JMSG_C_SRC) # add the binding support to the library
+
+clean-local:
+ -rm -rf .classes simgrid.jar
+
+jardir = $(prefix)/jar
+jar_DATA = simgrid.jar
+
+simgrid.jar: $(JMSG_JAVA_SRC) $(srcdir)/surf/simgrid.dtd
+ [ -e .classes ] || mkdir .classes
+ $(JAVAC) -d .classes $(foreach file,$(JMSG_JAVA_SRC),$(srcdir)/$(file))
+ [ -e .classes/surf ] || mkdir .classes/surf
+ cp $(srcdir)/surf/simgrid.dtd .classes/surf
+ $(JAR) cvf simgrid.jar -C .classes .
+else
+EXTRA_DIST+=$(JMSG_C_SRC) $(JMSG_JAVA_SRC) $(MSG_SRC)
+endif
+
+if GRAMINE_MODE
+else