Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
0c3ab348783a32b30fba80fedb77596519041dc3
[simgrid.git] / src / Makefile.am
1 #AM_CPPFLAGS=
2 AM_CFLAGS= -g
3 #AM_CFLAGS= -DNDEBUG 
4
5 # -DNLOG   cuts absolutely all logs at compilation time.
6 # -DNDEBUG cuts asserts and logs at "trace" and "debug" levels.
7
8 # -g -ffast-math -funroll-loops -O3 -fno-strict-aliasing
9 # Those should be added by configure when using gcc
10 # fast-math is nasty when using IEEE floating point semantic
11 # strict-aliasing breaks my type-punning bad habit.
12
13
14 MAINTAINERCLEANFILES=Makefile.in
15 INCLUDES= -I$(top_srcdir)/include -I$(top_srcdir)/src/include
16 EXTRA_DIST= \
17         \
18         portable.h \
19         \
20         xbt/mallocator_private.h \
21         xbt/dynar_private.h \
22         xbt/dict_private.h \
23         xbt/heap_private.h \
24         xbt/fifo_private.h \
25         xbt/graph_private.h \
26         xbt/graphxml_parse.c \
27         xbt/graphxml.l \
28         xbt/graphxml.c \
29         xbt/graphxml.dtd \
30         xbt/context_private.h \
31         xbt/ex_interface.h \
32         \
33         surf/maxmin_private.h \
34         surf/trace_mgr_private.h \
35         surf/surf_private.h \
36         surf/cpu_private.h \
37         surf/workstation_private.h \
38         surf/surf_timer_private.h \
39         surf/surfxml_parse.c \
40         surf/surfxml.l \
41         surf/surfxml.c \
42         surf/surfxml.dtd \
43         surf/network_private.h \
44         surf/network_dassf_private.h \
45         surf/workstation_KCCFLN05_private.h \
46         \
47         include/surf/maxmin.h \
48         include/surf/trace_mgr.h \
49         include/surf/surf.h \
50         include/surf/surfxml_parse_private.h \
51         \
52         include/xbt/xbt_os_time.h \
53         include/xbt/xbt_os_thread.h \
54         include/xbt/context.h \
55         \
56         msg/private.h \
57         \
58         simdag/private.h \
59         \
60         gras/DataDesc/ddt_parse.yy.l \
61         gras/Virtu/virtu_interface.h \
62         amok/Bandwidth/bandwidth_private.h \
63         amok/amok_modinter.h
64         \
65         include/simix/simix.h include/simix/datatypes.h \
66         simix/msg_simix_private.h \
67         \
68         smpi/private.h smpi/smpi.h
69
70 #LIBRARY_VERSION= 0:0:0
71 #                 | | |
72 #          +------+ | +---+
73 #          |        |     |
74 #       current:revision:age
75 #          |        |     |
76 #          |        |     +- Increment if interfaces have been added
77 #          |        |        Set to zero if interfaces have been removed or
78 #          |        |        changed
79 #          |        +- Increment if source code has changed
80 #          |           Set to zero if current is incremented
81 #          +- Increment if interfaces have been added, removed or changed
82
83 VERSION_INFO= -version-info 2:0:0
84 # from `info libtool "Updating version info"` 
85 # and  `info libtool "Release numbers"` 
86 #
87 # A) For stable library (interface wise), you should use --version-info:
88 #
89 # - Begin with C:R:A = 0:0:0 (ie here, VERSION_INFO= -version-info 0:0:0)
90 # - Do not update it before public release (keep numbers small)
91 #
92 # ----------------------------------------------------------------------+
93 # +   Interface     |  code of existing  | Interface | New version info |
94 # | removal/change? | interface changed? | addition? |                  |
95 # +-----------------+--------------------+-----------+------------------+
96 # |      yes        |   must be yes ;)   |           |  C++ : 0   : 0   |
97 # |      no         |        yes         |    yes    |  C   : R++ : A++ |
98 # |      no         |        yes         |    no     |  C   : R++ : A   |
99 # |      no         |        no          |    yes    |  C   : R   : A++ |
100 # |      no         |        no          |    no     |  C   : R   : A   |
101 # +-----------------+--------------------+-----------+------------------+
102 #
103 # B) For rapidely changing library, you should go for the -release flag
104 #
105 #  It modifies the library name, and you thus cannot say that a library
106 #   using this trick is ready for a "stable" release (say, in Debian).
107
108
109 ################################################
110 # Declaration of the different modules content #
111 ################################################
112
113 XBT_SRC=\
114   \
115   xbt/snprintf.c    xbt/xbt_str.c                                            \
116   xbt/ex.c                                                                   \
117   \
118   xbt_modinter.h    gras_modinter.h                                          \
119   xbt/xbt_virtu.c                                                            \
120   \
121   xbt/xbt_os_time.c                                                          \
122   xbt/asserts.c                                                              \
123   xbt/log.c                    xbt/xbt_log_appender_file.c                   \
124   xbt/xbt_log_layout_simple.c  xbt/xbt_log_layout_format.c                   \
125   xbt/mallocator.c                                                           \
126   xbt/dynar.c                                                                \
127   xbt/dict.c        xbt/dict_elm.c               xbt/dict_cursor.c           \
128   xbt/dict_multi.c                                                           \
129   xbt/heap.c                                                                 \
130   xbt/fifo.c                                                                 \
131   xbt/swag.c                                                                 \
132   xbt/graph.c                                                                \
133   xbt/set.c                                                                  \
134   xbt/xbt_matrix.c                                                           \
135   \
136   xbt/xbt_queue.c                                                            \
137   \
138   xbt/xbt_peer.c                                                             \
139   \
140   xbt/xbt_main.c                                                             \
141   \
142   xbt/config.c                                                               \
143   xbt/cunit.c                                                                \
144   xbt/graphxml_parse.c
145
146 XBT_RL_SRC = \
147   xbt/xbt_rl_synchro.c          \
148   xbt/xbt_rl_time.c
149 XBT_SG_SRC = \
150   xbt/xbt_sg_synchro.c          \
151   xbt/xbt_sg_time.c     
152
153 SURF_SRC= \
154   surf/maxmin.c                                                              \
155   surf/lagrange.c                                                            \
156   surf/trace_mgr.c                                                           \
157   surf/surf.c                                                                \
158   surf/surfxml_parse.c                                                       \
159   surf/cpu.c   surf/network.c   surf/workstation.c                           \
160   surf/surf_timer.c                                                          \
161   surf/network_dassf.c                                                       \
162   surf/workstation_KCCFLN05.c
163
164 if CONTEXT_THREADS
165   SURF_SRC += xbt/xbt_os_thread.c
166 else  
167   SURF_SRC += xbt/xbt_os_thread_stubs.c
168 endif
169
170 GTNETS_SRC= \
171   surf/gtnets/gtnets_simulator.cc \
172   surf/gtnets/gtnets_topology.cc  \
173   surf/gtnets/gtnets_interface.cc \
174   surf/network_gtnets.c
175
176 # Separated because we don't want it in libsimgrid4java
177 CTX_SRC= xbt/context.c
178 JCTX_SRC= java/jxbt_context.c java/jxbt_context.h
179
180 SIMIX_SRC= \
181   simix/smx_global.c \
182   simix/smx_deployment.c \
183   simix/smx_config.c \
184   simix/smx_environment.c \
185   simix/smx_host.c \
186   simix/smx_process.c \
187   simix/smx_action.c \
188   simix/smx_synchro.c
189
190 SMPI_SRC= \
191   smpi/smpi_base.c \
192   smpi/smpi_mpi.c
193
194 MSG_SRC=  msg/msg_config.c \
195   msg/task.c msg/host.c msg/m_process.c msg/gos.c \
196   msg/global.c msg/environment.c msg/deployment.c 
197
198 JMSG_C_SRC = \
199   java/jxbt_utilities.c     java/jxbt_utilities.h      \
200   java/jmsg.c               java/jmsg.h                \
201   java/jmsg_channel.c       java/jmsg_channel.h        \
202   java/jmsg_host.c          java/jmsg_host.h           \
203   java/jmsg_parallel_task.c java/jmsg_parallel_task.h  \
204   java/jmsg_process.c       java/jmsg_process.h        \
205   java/jmsg_task.c          java/jmsg_task.h
206
207 JMSG_JAVA_SRC = \
208   java/simgrid/msg/MsgException.java                 \
209   java/simgrid/msg/JniException.java                 \
210   java/simgrid/msg/NativeException.java              \
211   java/simgrid/msg/HostNotFoundException.java        \
212   java/simgrid/msg/ProcessNotFoundException.java     \
213   \
214   java/simgrid/msg/Process.java                      \
215   java/simgrid/msg/ApplicationHandler.java           \
216   java/simgrid/msg/Channel.java                      \
217   java/simgrid/msg/Host.java                         \
218   java/simgrid/msg/Msg.java                          \
219   java/simgrid/msg/Task.java                         \
220   java/simgrid/msg/ParallelTask.java                 
221
222 SIMDAG_SRC= simdag/sd_global.c simdag/sd_link.c simdag/sd_task.c simdag/sd_workstation.c
223
224 GRAS_COMMON_SRC= \
225   gras/gras.c  \
226   gras/Transport/transport.c          gras/Transport/transport_private.h  \
227   gras/Msg/gras_msg_mod.c             gras/Msg/gras_msg_types.c           \
228   gras/Msg/gras_msg_exchange.c        gras/Msg/gras_msg_listener.c        \
229   gras/Msg/rpc.c                      gras/Msg/timer.c                    \
230   gras/Msg/msg_interface.h            gras/Msg/msg_private.h              \
231   \
232   gras/Virtu/process.c gras/Virtu/gras_module.c  \
233   \
234   gras/DataDesc/ddt_create.c          \
235   gras/DataDesc/ddt_convert.c         gras/DataDesc/ddt_exchange.c     \
236   gras/DataDesc/cbps.c                gras/DataDesc/datadesc.c         \
237   gras/DataDesc/datadesc_interface.h  gras/DataDesc/datadesc_private.h \
238   gras/DataDesc/ddt_parse.c           gras/DataDesc/ddt_parse.yy.c         gras/DataDesc/ddt_parse.yy.h
239
240 GRAS_RL_SRC= \
241   gras/rl_stubs.c                     xbt/xbt_os_thread.c                    \
242   \
243   gras/Transport/rl_transport.c          \
244   gras/Transport/transport_plugin_file.c   gras/Transport/transport_plugin_tcp.c  \
245   \
246   gras/Virtu/rl_emul.c \
247   gras/Virtu/rl_process.c \
248   gras/Virtu/rl_dns.c\
249   \
250   gras/Msg/rl_msg.c
251
252 GRAS_RL_SRC+=$(XBT_RL_SRC)
253
254 GRAS_SG_SRC= gras/Transport/sg_transport.c  gras/Transport/transport_plugin_sg.c        \
255   \
256   gras/Virtu/sg_emul.c \
257   gras/Virtu/sg_process.c   \
258   gras/Virtu/sg_dns.c\
259   \
260   gras/Msg/sg_msg.c
261
262 GRAS_SG_SRC+=$(XBT_SG_SRC)
263
264 AMOK_SRC= \
265   amok/amok_base.c \
266   amok/Bandwidth/bandwidth.c amok/Bandwidth/saturate.c \
267   amok/PeerManagement/peermanagement.c
268
269 ##############################
270 # Deal with optional modules #
271 ##############################
272
273 if HAVE_GTNETS
274   GTNETS_USED=$(GTNETS_SRC)
275 else
276   GTNETS_USED=
277   EXTRA_DIST+=$(GTNETS_SRC)
278 endif
279
280 if HAVE_SDP
281   SDP_SRC= surf/sdp.c
282 else 
283   SDP_SRC=
284   EXTRA_DIST+=surf/sdp.c
285 endif
286
287 ###
288 ### Declare the library content
289 ###
290
291 lib_LTLIBRARIES= libsimgrid.la libgras.la libsmpi.la
292
293 libgras_la_SOURCES=  $(XBT_SRC) $(GRAS_COMMON_SRC) $(GRAS_RL_SRC) $(AMOK_SRC)
294 libgras_la_LDFLAGS = -no-undefined $(VERSION_INFO) @GRAS_DEP@ @LD_DYNAMIC_FLAGS@ -lm 
295
296 libsimgrid_la_SOURCES = $(XBT_SRC) $(SURF_SRC) $(GTNETS_USED) $(SDP_SRC) \
297                         $(SIMIX_SRC) $(CTX_SRC) \
298                         $(MSG_SRC) $(SIMDAG_SRC) \
299                         $(GRAS_COMMON_SRC) $(GRAS_SG_SRC) $(AMOK_SRC)
300 libsimgrid_la_LDFLAGS = -no-undefined $(VERSION_INFO) @SIMGRID_DEP@ @LD_DYNAMIC_FLAGS@ -lm
301
302 # Please do not add -no-undefined to libsmpi_la_LDFLAGS:
303 # smpi_simulated_main is indeed defined in user code, and undef in the
304 # library (no idea why it works under linux, but it fails under windows)
305 libsmpi_la_LIBADD = libsimgrid.la
306 libsmpi_la_SOURCES = $(SMPI_SRC)
307 libsmpi_la_LDFLAGS = $(VERSION_INFO) @LD_DYNAMIC_FLAGS@ -lm
308
309
310 ##
311 ## Java cruft
312
313 if HAVE_JAVA
314 lib_LTLIBRARIES += libsimgrid4java.la
315
316 libsimgrid4java_la_SOURCES = $(XBT_SRC) $(SURF_SRC) $(GTNETS_USED) $(SDP_SRC) \
317                              $(SIMIX_SRC) $(JCTX_SRC) \
318                              $(JMSG_C_SRC) $(MSG_SRC) \
319                              $(GRAS_COMMON_SRC) $(GRAS_SG_SRC) $(AMOK_SRC)
320 libsimgrid4java_la_LDFLAGS = -no-undefined $(VERSION_INFO) @SIMGRID_DEP@ @LD_DYNAMIC_FLAGS@ -lm
321 libsimgrid4java_la_GCJFLAGS = -fjni
322
323 clean-local:
324         -rm -rf .classes
325
326 jardir = $(prefix)/jar 
327 jar_DATA =  simgrid.jar
328
329 simgrid.jar: $(JMSG_JAVA_SRC)
330         [ -e .classes ] || mkdir .classes
331         $(JAVAC) -sourcepath java -d .classes $(JMSG_JAVA_SRC)
332         $(JAR) cvf simgrid.jar -C .classes .;
333 else
334 EXTRA_DIST += $(JCTX_SRC) $(JMSG_C_SRC) $(MSG_SRC)
335 endif
336
337 if GRAMINE_MODE
338 else 
339 ###
340 ### Testing infrastructure
341 ###
342
343 # Test files must be added both to the TEST_CFILES and TEST_UNITS because
344 # if I compute TEST_UNITS from TEST_CFILES, automake fails to note that they
345 # are generated. Sorry about that.
346
347 # If you add a test unit, you should regenerate simgrid_units_main.c from scratch:
348 # make clean-units ; make testall
349
350 # Suites and tests run in the given order.
351
352 noinst_PROGRAMS=testall
353 TEST_CFILES=xbt/cunit.c  xbt/ex.c          \
354             xbt/dynar.c xbt/dict.c xbt/set.c xbt/swag.c \
355             xbt/xbt_str.c                      \
356             xbt/config.c 
357 TEST_UNITS= @builddir@/cunit_unit.c @builddir@/ex_unit.c         \
358             @builddir@/dynar_unit.c @builddir@/dict_unit.c @builddir@/set_unit.c @builddir@/swag_unit.c \
359             @builddir@/xbt_str_unit.c \
360             @builddir@/config_unit.c 
361 CLEANFILES=$(TEST_UNITS)
362
363 BUILT_SOURCES=../include/surf/surfxml.h surf/surfxml.c \
364               ../include/xbt/graphxml.h xbt/graphxml.c \
365               gras/DataDesc/ddt_parse.yy.c \
366               $(TEST_UNITS) @builddir@/simgrid_units_main.c
367
368 testall_SOURCES= $(TEST_UNITS) @builddir@/simgrid_units_main.c
369 testall_LDADD=libgras.la
370 TESTS=testall
371 TESTS_ENVIRONMENT=$(SG_TEST_EXENV)
372
373 EXTRA_DIST+=$(testall_SOURCES)
374
375 if MAINTAINER_MODE
376 @builddir@/cunit_unit.c: xbt/cunit.c
377         @top_srcdir@/tools/sg_unit_extractor.pl $^
378 @builddir@/ex_unit.c: xbt/ex.c
379         @top_srcdir@/tools/sg_unit_extractor.pl $^
380 @builddir@/xbt_str_unit.c: xbt/xbt_str.c
381         @top_srcdir@/tools/sg_unit_extractor.pl $^
382 @builddir@/dynar_unit.c: xbt/dynar.c
383         @top_srcdir@/tools/sg_unit_extractor.pl $^
384 @builddir@/dict_unit.c: xbt/dict.c
385         @top_srcdir@/tools/sg_unit_extractor.pl $^
386 @builddir@/set_unit.c: xbt/set.c
387         @top_srcdir@/tools/sg_unit_extractor.pl $^
388 @builddir@/swag_unit.c: xbt/swag.c
389         @top_srcdir@/tools/sg_unit_extractor.pl $^
390 @builddir@/config_unit.c: xbt/config.c
391         @top_srcdir@/tools/sg_unit_extractor.pl $^
392
393 @builddir@/simgrid_units_main.c: $(TEST_UNITS)
394         @top_srcdir@/tools/sg_unit_extractor.pl @srcdir@/xbt/cunit.c
395
396 clean-units:
397         rm -f simgrid_units_main.c *_unit.c @srcdir@/simgrid_units_main.c @srcdir@/*_unit.c
398         for n in $(TEST_UNITS) ; do \
399           dep=`echo $$n|sed -e 's|.c$$|.Po|' -e 's|[^/]*/||' -e 's|^|.deps/|'`; \
400           echo "Removing dependency tracker of $$n ($$dep @srcdir@/$$dep)"; \
401           rm -vf $$dep @srcdir@/$$dep; touch $$dep; \
402         done
403 else
404
405 $(TEST_UNITS) simgrid_units_main.c clean-units: 
406         @echo "ERROR: Test units not generated."
407         @echo "ERROR: If you are using a CVS checkout, configure with the --enable-maintainer-mode flag"
408         @echo "ERROR: If not, please report the bug to the simgrid-devel mailing list."
409         @exit 1
410
411 endif
412
413 ###
414 ### Regenerate what needs to with flex & flexml
415 ###
416
417
418 gras/DataDesc/ddt_parse.yy.c: gras/DataDesc/ddt_parse.yy.l
419         set -e;@LEX@ -o$@ -Pgras_ddt_parse_ --noline $^
420
421 if MAINTAINER_MODE
422 surf/surfxml.c: surf/surfxml.l
423         set -e;mkdir -p `dirname $@`; @LEX@ -o$@ -Psurf_parse_ --noline $^
424 xbt/graphxml.c: xbt/graphxml.l
425         set -e;mkdir -p `dirname $@`; @LEX@ -o$@ -Pxbt_graph_parse_ --noline $^
426
427 if HAVE_FLEXML
428 surf/surfxml.l: $(srcdir)/surf/surfxml.dtd
429         set -e; mkdir -p surf; flexml -b 1000000 -P surfxml --sysid=surfxml.dtd -S $@ -L $^
430 $(top_srcdir)/include/surf/surfxml.h: $(srcdir)/surf/surfxml.dtd
431         set -e;                flexml            -P surfxml --sysid=surfxml.dtd -H $@ -L $^
432
433 xbt/graphxml.l: $(srcdir)/xbt/graphxml.dtd
434         set -e; flexml -b 1000000 -P graphxml --sysid=graphxml.dtd -S $@ -L $^
435 $(top_srcdir)/include/xbt/graphxml.h: $(srcdir)/xbt/graphxml.dtd
436         set -e; flexml            -P graphxml --sysid=graphxml.dtd -H $@ -L $^
437 else
438
439 $(top_srcdir)/include/surf/surfxml.h surf/surfxml.l: $(top_srcdir)/src/surf/surfxml.dtd
440         @echo "ERROR: src/surf/surfxml.dtd was modified, but the flexml program was not detected"
441         @echo "ERROR: Please install it, or if you didn't modify this file, try this:"
442         @echo "ERROR:   touch include/surf/surfxml.h src/surf/surfxml.l"
443         @exit 1
444 $(top_srcdir)/include/xbt/graphxml.h xbt/graphxml.l: $(top_srcdir)/src/xbt/graphxml.dtd
445         @echo "ERROR: src/xbt/graphxml.dtd was modified, but the flexml program was not detected"
446         @echo "ERROR: Please install it, or if you didn't modify this file, try this:"
447         @echo "ERROR:   touch include/xbt/graphxml.h src/xbt/graphxml.l"
448         @exit 1
449 endif
450 endif
451 endif
452
453 include $(top_srcdir)/acmacro/dist-files.mk