Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
baca6a5d3b2ee24521e787b9a21064ff4def96ca
[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 endif
167
168 GTNETS_SRC= \
169   surf/gtnets/gtnets_simulator.cc \
170   surf/gtnets/gtnets_topology.cc  \
171   surf/gtnets/gtnets_interface.cc \
172   surf/network_gtnets.c
173
174 # Separated because we don't want it in libsimgrid4java
175 CTX_SRC= xbt/context.c
176 JCTX_SRC= java/jxbt_context.c java/jxbt_context.h
177
178 SIMIX_SRC= \
179   simix/smx_global.c \
180   simix/smx_deployment.c \
181   simix/smx_config.c \
182   simix/smx_environment.c \
183   simix/smx_host.c \
184   simix/smx_process.c \
185   simix/smx_action.c \
186   simix/smx_synchro.c
187
188 SMPI_SRC= \
189   smpi/smpi_base.c \
190   smpi/smpi_mpi.c
191
192 MSG_SRC=  msg/msg_config.c \
193   msg/task.c msg/host.c msg/m_process.c msg/gos.c \
194   msg/global.c msg/environment.c msg/deployment.c 
195
196 JMSG_C_SRC = \
197   java/jxbt_utilities.c     java/jxbt_utilities.h      \
198   java/jmsg.c               java/jmsg.h                \
199   java/jmsg_channel.c       java/jmsg_channel.h        \
200   java/jmsg_host.c          java/jmsg_host.h           \
201   java/jmsg_parallel_task.c java/jmsg_parallel_task.h  \
202   java/jmsg_process.c       java/jmsg_process.h        \
203   java/jmsg_task.c          java/jmsg_task.h
204
205 JMSG_JAVA_SRC = \
206   java/simgrid/msg/MsgException.java                 \
207   java/simgrid/msg/JniException.java                 \
208   java/simgrid/msg/NativeException.java              \
209   java/simgrid/msg/HostNotFoundException.java        \
210   java/simgrid/msg/ProcessNotFoundException.java     \
211   \
212   java/simgrid/msg/Process.java                      \
213   java/simgrid/msg/ApplicationHandler.java           \
214   java/simgrid/msg/Channel.java                      \
215   java/simgrid/msg/Host.java                         \
216   java/simgrid/msg/Msg.java                          \
217   java/simgrid/msg/Task.java                         \
218   java/simgrid/msg/ParallelTask.java                 
219
220 SIMDAG_SRC= simdag/sd_global.c simdag/sd_link.c simdag/sd_task.c simdag/sd_workstation.c
221
222 GRAS_COMMON_SRC= \
223   gras/gras.c  \
224   gras/Transport/transport.c          gras/Transport/transport_private.h  \
225   gras/Msg/gras_msg_mod.c             gras/Msg/gras_msg_types.c           \
226   gras/Msg/gras_msg_exchange.c        gras/Msg/gras_msg_listener.c        \
227   gras/Msg/rpc.c                      gras/Msg/timer.c                    \
228   gras/Msg/msg_interface.h            gras/Msg/msg_private.h              \
229   \
230   gras/Virtu/process.c gras/Virtu/gras_module.c  \
231   \
232   gras/DataDesc/ddt_create.c          \
233   gras/DataDesc/ddt_convert.c         gras/DataDesc/ddt_exchange.c     \
234   gras/DataDesc/cbps.c                gras/DataDesc/datadesc.c         \
235   gras/DataDesc/datadesc_interface.h  gras/DataDesc/datadesc_private.h \
236   gras/DataDesc/ddt_parse.c           gras/DataDesc/ddt_parse.yy.c         gras/DataDesc/ddt_parse.yy.h
237
238 GRAS_RL_SRC= \
239   gras/rl_stubs.c                     xbt/xbt_os_thread.c                    \
240   \
241   gras/Transport/rl_transport.c          \
242   gras/Transport/transport_plugin_file.c   gras/Transport/transport_plugin_tcp.c  \
243   \
244   gras/Virtu/rl_emul.c \
245   gras/Virtu/rl_process.c \
246   gras/Virtu/rl_dns.c\
247   \
248   gras/Msg/rl_msg.c
249
250 GRAS_RL_SRC+=$(XBT_RL_SRC)
251
252 GRAS_SG_SRC= gras/Transport/sg_transport.c  gras/Transport/transport_plugin_sg.c        \
253   \
254   gras/Virtu/sg_emul.c \
255   gras/Virtu/sg_process.c   \
256   gras/Virtu/sg_dns.c\
257   \
258   gras/Msg/sg_msg.c
259
260 GRAS_SG_SRC+=$(XBT_SG_SRC)
261
262 AMOK_SRC= \
263   amok/amok_base.c \
264   amok/Bandwidth/bandwidth.c amok/Bandwidth/saturate.c \
265   amok/PeerManagement/peermanagement.c
266
267 ##############################
268 # Deal with optional modules #
269 ##############################
270
271 if HAVE_GTNETS
272   GTNETS_USED=$(GTNETS_SRC)
273 else
274   GTNETS_USED=
275   EXTRA_DIST+=$(GTNETS_SRC)
276 endif
277
278 if HAVE_SDP
279   SDP_SRC= surf/sdp.c
280 else 
281   SDP_SRC=
282   EXTRA_DIST+=surf/sdp.c
283 endif
284
285 ###
286 ### Declare the library content
287 ###
288
289 lib_LTLIBRARIES= libsimgrid.la libgras.la libsmpi.la
290
291 libgras_la_SOURCES=  $(XBT_SRC) $(GRAS_COMMON_SRC) $(GRAS_RL_SRC) $(AMOK_SRC)
292 libgras_la_LDFLAGS = -no-undefined $(VERSION_INFO) @GRAS_DEP@ @LD_DYNAMIC_FLAGS@ -lm 
293
294 libsimgrid_la_SOURCES = $(XBT_SRC) $(SURF_SRC) $(GTNETS_USED) $(SDP_SRC) \
295                         $(SIMIX_SRC) $(CTX_SRC) \
296                         $(MSG_SRC) $(SIMDAG_SRC) \
297                         $(GRAS_COMMON_SRC) $(GRAS_SG_SRC) $(AMOK_SRC)
298 libsimgrid_la_LDFLAGS = -no-undefined $(VERSION_INFO) @SIMGRID_DEP@ @LD_DYNAMIC_FLAGS@ -lm
299
300 libsmpi_la_LIBADD = libsimgrid.la
301 libsmpi_la_SOURCES = $(SMPI_SRC)
302 libsmpi_la_LDFLAGS = -no-undefined $(VERSION_INFO) @LD_DYNAMIC_FLAGS@ -lm
303
304 ##
305 ## Java cruft
306
307 if HAVE_JAVA
308 lib_LTLIBRARIES += libsimgrid4java.la
309
310 libsimgrid4java_la_SOURCES = $(XBT_SRC) $(SURF_SRC) $(GTNETS_USED) $(SDP_SRC) \
311                              $(SIMIX_SRC) $(JCTX_SRC) \
312                              $(JMSG_C_SRC) $(MSG_SRC) \
313                              $(GRAS_COMMON_SRC) $(GRAS_SG_SRC) $(AMOK_SRC)
314 libsimgrid4java_la_LDFLAGS = -no-undefined $(VERSION_INFO) @SIMGRID_DEP@ @LD_DYNAMIC_FLAGS@ -lm
315 libsimgrid4java_la_GCJFLAGS = -fjni
316
317 clean-local:
318         -rm -rf .classes
319
320 jardir = $(prefix)/jar 
321 jar_DATA =  simgrid.jar
322
323 simgrid.jar: $(JMSG_JAVA_SRC)
324         [ -e .classes ] || mkdir .classes
325         $(JAVAC) -sourcepath java -d .classes $(JMSG_JAVA_SRC)
326         $(JAR) cvf simgrid.jar -C .classes .;
327 else
328 EXTRA_DIST += $(JCTX_SRC) $(JMSG_C_SRC) $(MSG_SRC)
329 endif
330
331 if GRAMINE_MODE
332 else 
333 ###
334 ### Testing infrastructure
335 ###
336
337 # Test files must be added both to the TEST_CFILES and TEST_UNITS because
338 # if I compute TEST_UNITS from TEST_CFILES, automake fails to note that they
339 # are generated. Sorry about that.
340
341 # If you add a test unit, you should regenerate simgrid_units_main.c from scratch:
342 # make clean-units ; make testall
343
344 # Suites and tests run in the given order.
345
346 noinst_PROGRAMS=testall
347 TEST_CFILES=xbt/cunit.c  xbt/ex.c          \
348             xbt/dynar.c xbt/dict.c xbt/set.c xbt/swag.c \
349             xbt/xbt_str.c                      \
350             xbt/config.c 
351 TEST_UNITS= ./cunit_unit.c ./ex_unit.c         \
352             ./dynar_unit.c ./dict_unit.c ./set_unit.c ./swag_unit.c \
353             ./xbt_str_unit.c \
354             ./config_unit.c 
355
356 BUILT_SOURCES=../include/surf/surfxml.h surf/surfxml.c \
357               ../include/xbt/graphxml.h xbt/graphxml.c \
358               gras/DataDesc/ddt_parse.yy.c \
359               $(TEST_UNITS) simgrid_units_main.c
360
361 testall_SOURCES= $(TEST_UNITS) simgrid_units_main.c
362 testall_LDADD=libgras.la
363 TESTS=testall
364 TESTS_ENVIRONMENT=$(SG_TEST_EXENV)
365
366 EXTRA_DIST+=$(testall_SOURCES)
367
368 if MAINTAINER_MODE
369 ./cunit_unit.c: xbt/cunit.c
370         @top_srcdir@/tools/sg_unit_extractor.pl $^
371 ./ex_unit.c: xbt/ex.c
372         @top_srcdir@/tools/sg_unit_extractor.pl $^
373 ./xbt_str_unit.c: xbt/xbt_str.c
374         @top_srcdir@/tools/sg_unit_extractor.pl $^
375 ./dynar_unit.c: xbt/dynar.c
376         @top_srcdir@/tools/sg_unit_extractor.pl $^
377 ./dict_unit.c: xbt/dict.c
378         @top_srcdir@/tools/sg_unit_extractor.pl $^
379 ./set_unit.c: xbt/set.c
380         @top_srcdir@/tools/sg_unit_extractor.pl $^
381 ./swag_unit.c: xbt/swag.c
382         @top_srcdir@/tools/sg_unit_extractor.pl $^
383 ./config_unit.c: xbt/config.c
384         @top_srcdir@/tools/sg_unit_extractor.pl $^
385
386 simgrid_units_main.c: $(TEST_UNITS)
387         @top_srcdir@/tools/sg_unit_extractor.pl xbt/cunit.c
388
389 clean-units:
390         rm -f simgrid_units_main.c *_unit.c
391
392 else
393
394 $(TEST_UNITS) simgrid_units_main.c clean-units: 
395         @echo "ERROR: Test units not generated."
396         @echo "ERROR: If you are using a CVS checkout, configure with the --enable-maintainer-mode flag"
397         @echo "ERROR: If not, please report the bug to the simgrid-devel mailing list."
398         @exit 1
399
400 endif
401
402 ###
403 ### Regenerate what needs to with flex & flexml
404 ###
405
406
407 gras/DataDesc/ddt_parse.yy.c: gras/DataDesc/ddt_parse.yy.l
408         set -e;@LEX@ -o$@ -Pgras_ddt_parse_ --noline $^
409
410 if MAINTAINER_MODE
411 surf/surfxml.c: surf/surfxml.l
412         set -e;mkdir -p `dirname $@`; @LEX@ -o$@ -Psurf_parse_ --noline $^
413 xbt/graphxml.c: xbt/graphxml.l
414         set -e;mkdir -p `dirname $@`; @LEX@ -o$@ -Pxbt_graph_parse_ --noline $^
415
416 if HAVE_FLEXML
417 surf/surfxml.l: $(srcdir)/surf/surfxml.dtd
418         set -e; mkdir -p surf; flexml -b 1000000 -P surfxml --sysid=surfxml.dtd -S $@ -L $^
419 $(top_srcdir)/include/surf/surfxml.h: $(srcdir)/surf/surfxml.dtd
420         set -e;                flexml            -P surfxml --sysid=surfxml.dtd -H $@ -L $^
421
422 xbt/graphxml.l: $(srcdir)/xbt/graphxml.dtd
423         set -e; flexml -b 1000000 -P graphxml --sysid=graphxml.dtd -S $@ -L $^
424 $(top_srcdir)/include/xbt/graphxml.h: $(srcdir)/xbt/graphxml.dtd
425         set -e; flexml            -P graphxml --sysid=graphxml.dtd -H $@ -L $^
426 else
427
428 $(top_srcdir)/include/surf/surfxml.h surf/surfxml.l: $(top_srcdir)/src/surf/surfxml.dtd
429         @echo "ERROR: src/surf/surfxml.dtd was modified, but the flexml program was not detected"
430         @echo "ERROR: Please install it, or if you didn't modify this file, try this:"
431         @echo "ERROR:   touch include/surf/surfxml.h src/surf/surfxml.l"
432         @exit 1
433 $(top_srcdir)/include/xbt/graphxml.h xbt/graphxml.l: $(top_srcdir)/src/xbt/graphxml.dtd
434         @echo "ERROR: src/xbt/graphxml.dtd was modified, but the flexml program was not detected"
435         @echo "ERROR: Please install it, or if you didn't modify this file, try this:"
436         @echo "ERROR:   touch include/xbt/graphxml.h src/xbt/graphxml.l"
437         @exit 1
438 endif
439 endif
440 endif
441
442 include $(top_srcdir)/acmacro/dist-files.mk