Logo AND Algorithmique Numérique Distribuée

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