Logo AND Algorithmique Numérique Distribuée

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