fixed path of METIS lib.
[charm.git] / src / scripts / Makefile
1 #############################################################################"
2 #
3 # This one Makefile serves all of converse and charm.  It includes
4 # rules for building:
5 #
6 #     * The CONVERSE libraries
7 #     * Charm++ runtime
8 #     * ITC++ Translator
9 #     * Languages
10 #     * Documentation
11 #
12 # This Makefile is common to all machines.  This works because the charmc
13 # is smart enough to "conceal" the differences between machines.  charmc
14 # gets its smarts by reading the conv-mach.sh configuration file.
15 #
16 # If you wish to compile with debugging, optimization, or some other charm
17 # option, you can do so by setting OPTS.  For example, if you need a lot
18 # of debugging information, you could type:
19 #
20 #     make charm++ OPTS="-g -save -verbose"
21 #
22 ###############################################################################
23
24 SHELL=/bin/sh
25 L=../lib
26 INC=../include
27
28 all: charm++ bluegene LIBS AMPI f90charm TSM SM PVM doc
29
30 charm++: basics
31         $(MAKE) charm-target
32
33 bgampi: bluegene AMPI
34
35 TSM: converse $(L)/libtsm.a
36
37 SM: converse $(L)/libsm.a
38
39 PVM: converse $(L)/libpvmc.a
40
41 AMR: charm++ LIBS
42         cd libs/ck-libs/amr; make all OPTS='$(OPTS)'
43
44 FEM: charm++
45         $(MAKE) CONVLIBS
46         $(MAKE) FEMC LIBS FEMF
47
48 FEMC: charm++ LIBS
49
50 FEMF: FEMC
51
52 MBLOCK: AMPI MBLOCKC MBLOCKF
53
54 MBLOCKC: charm++ LIBS
55
56 MBLOCKF: MBLOCKC
57
58 AMPI:  charm++
59         $(MAKE) CONVLIBS
60         $(MAKE) AMPIC AMPIF
61
62 AMPIC: charm++ LIBS
63
64 AMPIF: AMPIC
65
66 f90charm: charm++ $(L)/libf90charm.a
67
68 default_libs: multicast
69
70 multicast:
71         cd libs/ck-libs/multicast && $(MAKE)
72
73 translators: charmxi conv-cpm
74
75 pose:  charm++
76         cd libs/ck-libs/pose && $(MAKE)
77
78 msa:
79         cd libs/ck-libs/multiphaseSharedArrays && $(MAKE)
80
81 jade: charm++ msa
82 #       make the lib, include
83         cd langs/jade && $(MAKE)
84
85 fftlib: charm++
86         cd libs/ck-libs/fftlib && $(MAKE)
87
88 # This should be done offline, since the user does not need to compile
89 # parser files, etc.  All they need is the libjade + include files,
90 # antlr.jar, jade.jar, and a few scripts which the jade target takes
91 # care of.
92 jadeall: jade
93 #       make parser.g -> .java files
94         cd langs/jade && $(MAKE) p
95 #       make the jade.jar file
96         cd ../java/charm/jade && $(MAKE)
97
98 LIBS: CONVLIBS CHARMLIBS
99         cd libs; $(MAKE) otherlibs
100
101 test-all: test
102
103 test: test-charm test-AMPI test-fem
104         @echo "--- All tests passed ---"
105
106 test-converse: converse
107         cd ../pgms ; $(MAKE) test-converse  OPTS='$(OPTS)'
108
109 test-charm: charm++ METIS
110         cd ../pgms ; $(MAKE) test-charm  OPTS='$(OPTS)'
111
112 test-AMPI: AMPI
113         cd ../pgms ; $(MAKE) test-AMPI  OPTS='$(OPTS)'
114
115 test-fem: FEM
116         cd ../pgms ; $(MAKE) test-fem  OPTS='$(OPTS)'
117
118 ps-doc: basics
119         cd ../doc ; make ps
120
121 pdf-doc: basics
122         cd ../doc ; make pdf
123
124 html-doc: basics
125         cd ../doc ; make html
126
127 doc: basics
128         cd ../doc ; make doc
129
130 CHARMC=../bin/charmc $(CHARMOPTS) $(OPTS)
131
132 SEQCHARMC=../bin/charmc -seq $(CHARMOPTS)
133
134 NATIVECHARMC=../bin/charmc -host $(CHARMOPTS)
135
136 CHARMXI=../bin/charmc -intrinsic $(OPTS)
137
138 DEPENDFILE = Make.depends
139
140 include $(DEPENDFILE)
141
142 ###############################################################################
143 #
144 # The basics (bin, lib, include, headers, charmc, conv-mach.sh)
145 #
146 ###############################################################################
147
148 CVHEADERS=cpthreads.h converse.h conv-trace.h conv-random.h conv-qd.h \
149       queueing.h conv-cpath.h conv-cpm.h persistent.h\
150       trace.h trace-bluegene.h trace-projections.h charm-api.h \
151       conv-ccs.h ccs-client.c ccs-client.h \
152       ccs-server.h ccs-auth.c ccs-auth.h \
153       memory-isomalloc.h debug-conv.h debug-charm.h conv-autoconfig.h \
154       conv-common.h conv-config.sh conv-config.h conv-mach.h conv-mach.sh \
155       blue.h blue-conv.h bgconverse.h \
156         convcomlibstrategy.h 3dgridrouter.h de.h hypercubetopology.h    \
157         routerstrategy.h comlib.h dummyconversestrategy.h  treerouter.h \
158         convcomlibmanager.h graphrouter.h petable.h gridrouter.h router.h \
159         pipebroadcastconverse.h
160
161 # The .c files are there to be #included by clients whole
162 # This is a bit unusual, but makes client linking simpler.
163 UTILHEADERS=pup.h pupf.h pup_c.h pup_stl.h pup_toNetwork.h pup_toNetwork4.h pup_paged.h pup_cmialloc.h\
164         ckimage.h ckdll.h ckhashtable.h ckbitvector.h cklists.h \
165         ckstatistics.h ckvector3d.h conv-lists.h RTH.h ckcomplex.h \
166         sockRoutines.h sockRoutines.c
167
168 CKHEADERS=ck.h ckstream.h envelope.h init.h qd.h charm.h charm++.h \
169           ckfutures.h \
170           ckcallback.h CkCallback.decl.h ckcallback-ccs.h       \
171           ckarrayreductionmgr.h cknodegroupreduction.h cksection.h \
172           ckarray.h cklocation.h ckreduction.h ckcheckpoint.h ckmemcheckpoint.h\
173           ckobjQ.h readonly.h charisma.h ComlibArrayListener.h ComlibStrategy.h\
174           $(UTILHEADERS) \
175           tempo.h waitqd.h LBDatabase.h lbdb.h \
176           LBDBManager.h LBComm.h LBOM.h LBObj.h LBMachineUtil.h \
177           Refiner.h RefinerComm.h ObjGraph.h heap.h elements.h CommLBHeap.h \
178           BaseLB.h CentralLB.h CentralLBMsg.h RandCentLB.h RecBisectBfLB.h \
179           RefineLB.h RefineCommLB.h OrbLB.h GreedyLB.h GreedyCommLB.h \
180           Comm1LB.h manager.h MetisLB.h NborBaseLB.h topology.h \
181           NeighborLB.h NeighborCommLB.h NeighborLBMsg.h WSLB.h GreedyRefLB.h RandRefLB.h \
182           BlueGene.h middle.h middle-conv.h middle-blue.h \
183           CkMarshall.decl.h CkArray.decl.h CkLocation.decl.h    \
184           CkReduction.decl.h CkArrayReductionMgr.decl.h\
185           tempo.decl.h waitqd.decl.h \
186           CkFutures.decl.h CkCheckpoint.decl.h CkMemCheckpoint.decl.h \
187           LBDatabase.decl.h CentralLB.decl.h ComboCentLB.decl.h NullLB.decl.h \
188           RandCentLB.decl.h RecBisectBfLB.decl.h BaseLB.decl.h \
189           MetisLB.decl.h DummyLB.decl.h RefineLB.decl.h RefineCommLB.decl.h  \
190           OrbLB.decl.h GreedyLB.decl.h NborBaseLB.decl.h NeighborLB.decl.h NeighborCommLB.decl.h\
191           WSLB.decl.h GreedyRefLB.decl.h RandRefLB.decl.h \
192           GreedyCommLB.decl.h Comm1LB.decl.h EveryLB.decl.h \
193           charisma.decl.h TraceSummary.decl.h BlueGene.decl.h \
194           comlib.decl.h ComlibManager.h DummyStrategy.h \
195           DirectMulticastStrategy.h RingMulticastStrategy.h     \
196           EachToManyMulticastStrategy.h MsgPacker.h StreamingStrategy.h \
197           NodeMulticast.h PipeBroadcastStrategy.h MeshStreamingStrategy.h \
198           PrioStreaming.h MPIStrategy.h MsgPacker.h StreamingStrategy.h \
199           BroadcastStrategy.h ComlibSectionInfo.h $(CVHEADERS)
200
201 ALLHEADERS=$(CKHEADERS) \
202     simplemsg.h sm.h pvmc.h pvm3.h sdag.h \
203         graph.h bitvecset.h Set.h LBSimulation.h  \
204         $(BLUE_HEADERS)
205
206 basics: headers
207         touch basics
208
209 # Headers is used only for the dependencies
210 headers: dirs+sources
211         $(MAKE) headerlinks
212
213 conv-autoconfig.h: configure
214         ./configure
215
216 headerlinks: dirs+sources Makefile $(ALLHEADERS)
217         @echo "Soft-linking headers..."
218         -@for hdr in $(ALLHEADERS) ; do test ! -f "../include/$$hdr" && ./system_ln "../tmp/$$hdr" ../include ; done
219         touch headerlinks
220
221 dirs+sources:
222         rm -f .gdir
223         (cd .. ; basename "`pwd`" | sed -e 's@-.*@@')   > .gdir
224         pwd
225         find . -type l -exec rm {} \;
226         rm -rf QuickThreads
227         rm -rf libs
228         rm -rf ../bin ; mkdir ../bin
229         rm -rf ../lib ; mkdir ../lib
230         rm -rf ../lib_so ; mkdir ../lib_so; touch ../lib_so/.charmso
231         rm -rf ../pgms
232         rm -rf ../doc ; ln -s ../doc ../doc
233         ../../src/scripts/gatherflat ../../src/scripts .
234         ./gatherflat ../../src/conv-core        .
235         ./gatherflat ../../src/conv-ldb         .
236         ./gatherflat ../../src/conv-ccs         .
237         ./gatherflat ../../src/conv-perf        .
238         ./gatherflat ../../src/ck-core          .
239         ./gatherflat ../../src/util             .
240         ./gatherflat ../../src/ck-perf          .
241         ./gatherflat ../../src/ck-ldb           .
242         ./gatherflat ../../src/ck-com           .
243         ./gatherflat ../../src/conv-com           .
244         ./gatherflat ../../src/langs/simplemsg  .
245         ./gatherflat ../../src/langs/pvmc       .
246         ./gatherflat ../../src/langs/bluegene   .
247         ./gatherflat ../../src/langs/f90charm   .
248         ./gatherflat ../../src/xlat-i           .
249         ./gatherflat ../../src/xlatcpm          .
250         ./gathertree ../../src/QuickThreads QuickThreads
251         ./gathertree ../../src/libs libs
252         ./gathertree ../../src/arch/util      .
253         ./gathertree ../../src/langs langs
254         ./gathertree ../../src/langs/jade langs/jade
255         ./gathertree ../../src/arch/common           .
256         ./gathertree ../../src/arch/`cat .gdir`      .
257         ./gatherflat ../../src/arch/`cat .vdir`      .
258         ./gathertree ../../pgms ../pgms
259         rm -f ../bin/dep.pl ; cp dep.pl ../bin/
260         chmod +x charmc
261         -./system_ln  ../tmp/charmc ../bin/
262         -./system_ln ../../java/bin charmjavabin
263         -./system_ln ../../java/bin ../bin/charmjavabin
264         -./system_ln charmjavabin/* ../bin/
265         -./system_ln ../java ..
266         rm -f .gdir
267         rm -rf ../include ; mkdir ../include
268         -./system_ln  ../tmp/conv-*.*h ../include
269         -./system_ln  ../tmp/cc-*.*h ../include
270         if [ ! -f conv-common.h ] ; then ( touch conv-common.h ) ; fi
271         touch dirs+sources
272
273 ###############################################################################
274 #
275 # Converse Libraries
276 #
277 ###############################################################################
278 CLBLIBS=$(L)/libldb-rand.o $(L)/libldb-spray.o $(L)/libldb-neighbor.o $(L)/libldb-none.o $(L)/libldb-test.o $(L)/libldb-bluegene.o
279 TRACELIBS=$(L)/libtrace-projections.a  $(L)/libtrace-summary.a \
280           $(L)/libtrace-counter.a $(L)/libtrace-bluegene.a \
281           $(L)/libtrace-projector.a $(L)/libtrace-all.a $(L)/libtrace-converse.a \
282           $(L)/libtrace-recordreplay.a  $(L)/libtracef_f.a
283 MEMLIBS=$(L)/libmemory-default.o $(L)/libmemory-os.o $(L)/libmemory-gnu.o \
284           $(L)/libmemory-gnuold.o $(L)/libmemory-verbose.o      \
285           $(L)/libmemory-paranoid.o \
286           $(L)/libmemory-leak.o $(L)/libmemory-isomalloc.o
287 THREADLIBS=$(L)/libthreads-default.o $(L)/libthreads-qt.o       \
288           $(L)/libthreads-context.o $(L)/libthreads-uJcontext.o \
289           $(L)/libthreads-pthreads.o $(L)/libthreads-fibers.o
290
291 CVLIBS=$(L)/libconv-core.a \
292         $(L)/libconv-cplus-y.a $(L)/libconv-cplus-n.a \
293         $(L)/libconv-util.a $(L)/libconv-utilf.a \
294         $(CLBLIBS) $(TRACELIBS) $(MEMLIBS) $(THREADLIBS) \
295         $(L)/libccs-client.a
296
297 LIBCONV_CORE= convcore.o conv-conds.o queueing.o msgmgr.o \
298         cpm.o cpthreads.o futures.o cldb.o topology.o random.o \
299         debug-conv.o generate.o edgelist.o conv-ccs.o ccs-builtins.o \
300         traceCore.o traceCoreCommon.o \
301         converseProjections.o machineProjections.o \
302         quiescence.o isomalloc.o conv-counter.o \
303         global-nop.o
304
305 #############################################
306 #
307 #Comlib Core objects
308 #
309 #############################################
310 #These go into libconv-util.a and are always linked
311 CONVERSE_COM_CORE_OBJS = convcomlibstrategy.o
312
313 #These go into libck.a
314 COMLIB_CORE_OBJS = ComlibStrategy.o ComlibArrayListener.o
315 ##############################################
316
317 LIBCONV_UTIL=pup_util.o pup_toNetwork.o pup_toNetwork4.o                \
318         pup_xlater.o pup_c.o pup_paged.o pup_cmialloc.o                 \
319         ckimage.o ckdll.o ckhashtable.o sockRoutines.o                  \
320         conv-lists.o RTH.o persist-comm.o $(CONVERSE_COM_CORE_OBJS) \
321         ckbitvector.o
322
323 LIBCONV_UTILF=pup_f.o
324
325 converse: basics
326         $(MAKE) QuickThreads/libqt.a
327         $(MAKE) converse-target
328
329 converse-target:  $(CVLIBS) fmain-ok charmrun-target swapglobal-target conv-cpm
330
331 charmrun-target: sockRoutines.c sockRoutines.h ccs-server.c ccs-server.h sockRoutines-seq.o
332         if [ -d charmrun ] ; then ( cd charmrun ; $(MAKE) OPTS='$(OPTS)' ) ; fi
333         if [ -f charmrun ] ; then ( cp charmrun ../bin ) ; fi
334
335 fmain-ok: fmain.f90
336         -@$(CHARMC) -c fmain.f90
337         -@cp fmain.o ../lib
338         -@touch fmain-ok
339
340 QuickThreads/libqt.a:  $(CVHEADERS)
341         cd QuickThreads;./configure
342         rm -f QuickThreads/libqt.a
343         cd QuickThreads ; $(MAKE) qt  OPTS='$(OPTS)'
344         cp QuickThreads/libqt.a ../lib/libckqt.a
345         -(CHARMINC=.; . ./conv-config.sh; \
346           test -d ../lib_so && \
347           cp QuickThreads/libqt.$$CMK_SHARED_SUF ../lib_so && \
348           cp QuickThreads/libqt.$$CMK_SHARED_SUF ../lib_so/libckqt.$$CMK_SHARED_SUF)
349
350 METIS:  charm++
351         cd libs/ck-libs/parmetis/METISLib; $(MAKE) OPTS='$(OPTS)'
352
353 CONVLIBS: converse
354         cd libs; $(MAKE) convlibs OPTS='$(OPTS)'
355
356 $(L)/libconv-core.a: $(LIBCONV_CORE)
357         $(CHARMC) -o $@ $(LIBCONV_CORE)
358
359 $(L)/libconv-cplus-y.a: $(L)/libconv-cplus-n.a
360
361 $(L)/libconv-cplus-n.a: machine.c $(CVHEADERS)
362         @-test -f $(INC)/mpi.h && mv -f $(INC)/mpi.h $(INC)/mpi.BAK || true
363         $(CHARMC) -o $(L)/libconv-cplus-y.a -DFOR_CPLUS=1 machine.c
364         $(CHARMC) -o $(L)/libconv-cplus-n.a -DFOR_CPLUS=0 machine.c
365         @-test -f $(INC)/mpi.BAK && mv -f $(INC)/mpi.BAK $(INC)/mpi.h || true
366
367 $(L)/libconv-util.a: $(LIBCONV_UTIL)
368         $(CHARMC) -o $@ $(LIBCONV_UTIL)
369
370 $(L)/libconv-utilf.a: $(LIBCONV_UTILF)
371         -$(CHARMC) -o $@ $(LIBCONV_UTILF) || touch $@
372
373 $(L)/libccs-client.a: ccs-client.o
374         $(CHARMC) -o $@ ccs-client.o
375
376 ccs-client.o: ccs-client.c $(CVHEADERS)
377         $(CHARMC) ccs-client.c
378
379 sockRoutines.o: sockRoutines.c $(CVHEADERS) $(UTILHEADERS)
380         $(CHARMC) -DCMK_USE_CONVERSE=1 sockRoutines.c
381
382 sockRoutines-seq.o: sockRoutines.c $(CVHEADERS) $(UTILHEADERS)
383         $(SEQCHARMC) -o sockRoutines-seq.o sockRoutines.c
384
385 pup_util.o: pup_util.C $(CVHEADERS) $(UTILHEADERS)
386         $(CHARMC) -o pup_util.o pup_util.C
387
388 pup_toNetwork.o: pup_toNetwork.C $(CVHEADERS) $(UTILHEADERS)
389         $(CHARMC) -o pup_toNetwork.o pup_toNetwork.C
390
391 pup_toNetwork4.o: pup_toNetwork4.C $(CVHEADERS) $(UTILHEADERS)
392         $(CHARMC) -o pup_toNetwork4.o pup_toNetwork4.C
393
394 pup_xlater.o: pup_xlater.C $(CVHEADERS) $(UTILHEADERS)
395         $(CHARMC) -o pup_xlater.o pup_xlater.C
396
397 pup_c.o: pup_c.C $(CVHEADERS) $(UTILHEADERS)
398         $(CHARMC) -o pup_c.o pup_c.C
399
400 pup_paged.o: pup_paged.C $(CVHEADERS) $(UTILHEADERS)
401         $(CHARMC) -o pup_paged.o pup_paged.C
402
403 pup_f.o: pup_f.f90 $(CVHEADERS)
404         -$(CHARMC) -c pup_f.f90 && $(CHARMC) -cpmod ../include pupmod.M || touch pup_f.o
405
406 pup_cmialloc.o: pup_cmialloc.C $(CVHEADERS) $(UTILHEADERS)
407         $(CHARMC) -o pup_cmialloc.o pup_cmialloc.C
408
409 ckhashtable.o: ckhashtable.C ckhashtable.h $(CVHEADERS)
410         $(CHARMC) -o ckhashtable.o ckhashtable.C
411
412 ckbitvector.o: ckbitvector.C ckbitvector.h $(CVHEADERS)
413         $(CHARMC) -o ckbitvector.o ckbitvector.C
414
415 ckdll.o: ckdll.C ckdll.h $(CVHEADERS)
416         $(CHARMC) -o ckdll.o ckdll.C
417
418 ckimage.o: ckimage.C ckimage.h $(CVHEADERS)
419         $(CHARMC) -o ckimage.o ckimage.C
420
421 RTH.o: RTH.C RTH.h $(CVHEADERS)
422         $(CHARMC) -o RTH.o RTH.C
423
424 persist-comm.o: persist-comm.c persist_impl.h $(CVHEADERS)
425         $(CHARMC) -o persist-comm.o persist-comm.c
426
427 conv-lists.o: conv-lists.C $(UTILHEADERS) $(CVHEADERS)
428         $(CHARMC) -o conv-lists.o conv-lists.C
429
430 ## Converse load balancers (seed balancers, -balance)
431 $(L)/libldb-none.o: cldb.none.c $(CVHEADERS)
432         $(CHARMC) -o $@ cldb.none.c
433
434 $(L)/libldb-rand.o: cldb.rand.c cldb.h $(CVHEADERS)
435         $(CHARMC) -o $@ cldb.rand.c
436
437 $(L)/libldb-neighbor.o: cldb.neighbor.c cldb.neighbor.h graph.h $(CVHEADERS)
438         $(CHARMC) -o $@ cldb.neighbor.c
439
440 $(L)/libldb-spray.o: cldb.spray.c $(CVHEADERS)
441         $(CHARMC) -o $@ cldb.spray.c
442
443 $(L)/libldb-test.o: cldb.test.c $(CVHEADERS)
444         $(CHARMC) -o $@ cldb.test.c
445
446 $(L)/libldb-bluegene.o: cldb.bluegene.c $(CVHEADERS)
447         $(CHARMC) -o $@ cldb.bluegene.c
448
449 ## Memory allocation libraries (-memory)
450 MEM_DEPS=memory.c memory-gnu.c memory-gnuold.c converse.h conv-mach.h $(CVHEADERS)
451 $(L)/libmemory-default.o: $(MEM_DEPS)
452         $(CHARMC) -o $@ -DCMK_MEMORY_BUILD_DEFAULT memory.c
453
454 $(L)/libmemory-os.o: $(MEM_DEPS)
455         $(CHARMC) -o $@ -DCMK_MEMORY_BUILD_OS memory.c
456
457 # If the system doesn't have sbrk, these compilations may fail.
458 #  This is OK, but then we can't use "-memory gnu" or friends.
459 $(L)/libmemory-gnu.o: $(MEM_DEPS)
460         -$(CHARMC) -o $@ -DCMK_MEMORY_BUILD_GNU memory.c || touch $@
461
462 $(L)/libmemory-gnuold.o: $(MEM_DEPS)
463         -$(CHARMC) -o $@ -DCMK_MEMORY_BUILD_GNUOLD memory.c || touch $@
464
465 $(L)/libmemory-verbose.o: memory-verbose.c $(MEM_DEPS)
466         -$(CHARMC) -o $@ -DCMK_MEMORY_BUILD_VERBOSE memory.c || touch $@
467
468 $(L)/libmemory-paranoid.o: memory-paranoid.c $(MEM_DEPS)
469         -$(CHARMC) -o $@ -DCMK_MEMORY_BUILD_PARANOID memory.c || touch $@
470
471 $(L)/libmemory-leak.o: memory-leak.c $(MEM_DEPS)
472         -$(CHARMC) -o $@ -DCMK_MEMORY_BUILD_LEAK memory.c || touch $@
473
474 $(L)/libmemory-cache.o: memory-cache.c $(MEM_DEPS)
475         -$(CHARMC) -o $@ -DCMK_MEMORY_BUILD_CACHE memory.c || touch $@
476
477 $(L)/libmemory-isomalloc.o: memory-isomalloc.c $(MEM_DEPS)
478         -$(CHARMC) -o $@ -DCMK_MEMORY_BUILD_ISOMALLOC memory.c || touch $@
479
480 ## Thread libraries (-thread)
481 $(L)/libthreads-default.o: threads.c $(CVHEADERS)
482         $(CHARMC) -o $@ -DCMK_THREADS_BUILD_DEFAULT=1 -IQuickThreads threads.c
483
484 $(L)/libthreads-qt.o: threads.c $(CVHEADERS)
485         $(CHARMC) -o $@ -DCMK_THREADS_BUILD_QT=1 -IQuickThreads threads.c
486
487 $(L)/libthreads-context.o: threads.c $(CVHEADERS)
488         -$(CHARMC) -o $@ -DCMK_THREADS_BUILD_CONTEXT=1 -IQuickThreads threads.c || touch $@
489
490 $(L)/libthreads-uJcontext.o: threads.c uJcontext.c $(CVHEADERS)
491         -$(CHARMC) -o $@ -DCMK_THREADS_BUILD_JCONTEXT=1 -IQuickThreads -I. threads.c || touch $@
492
493 $(L)/libthreads-pthreads.o: threads.c $(CVHEADERS)
494         -$(CHARMC) -o $@ -DCMK_THREADS_BUILD_PTHREADS=1 -IQuickThreads threads.c || touch $@
495
496 $(L)/libthreads-fibers.o: threads.c $(CVHEADERS)
497         -$(CHARMC) -o $@ -DCMK_THREADS_BUILD_FIBERS=1 -IQuickThreads threads.c 2> /dev/null || touch $@
498
499 ## Global swapping (-swapglobal)
500 swapglobal-target: $(L)/libglobal-swap.o
501
502 $(L)/libglobal-swap.o: global-elfgot.C $(CVHEADERS)
503         -$(CHARMC) -c global-elfgot.C -o $@ || touch $@
504
505
506 ###############################################################################
507 #
508 # Charm Libraries
509 #
510 ###############################################################################
511
512 CK_LIBS_CORE=$(L)/libck.a
513
514 LIBCK_CORE=trace-common.o tracef.o init.o register.o qd.o ck.o main.o   \
515            msgalloc.o ckfutures.o debug-message.o debug-charm.o ckcallback.o \
516            cklocation.o ckarray.o ckreduction.o ckarrayreductionmgr.o\
517            tempo.o waitqd.o LBDatabase.o lbdb.o charisma.o ckobjQ.o     \
518            ckcheckpoint.o ckmemcheckpoint.o\
519            LBDBManager.o LBComm.o LBObj.o LBMachineUtil.o \
520            BaseLB.o CentralLB.o CentralPredictor.o NborBaseLB.o WSLB.o \
521            ObjGraph.o graph.o  \
522            Refiner.o RefinerComm.o bitvecset.o Set.o heap.o CommLBHeap.o \
523            NullLB.o LBSimulation.o $(COMLIB_CORE_OBJS) \
524            charmProjections.o
525
526 charm-target: converse $(L)/libck.a loadbalancers default_libs comlib_objs
527
528 CHARMLIBS: charm++
529         cd libs; $(MAKE) charmlibs OPTS='$(OPTS)'
530
531 $(L)/libck.a: $(LIBCK_CORE)
532         $(CHARMC) -o $@ $(LIBCK_CORE)
533
534 CkFutures.def.h: CkFutures.decl.h
535
536 CkFutures.decl.h: ckfutures.ci charmxi
537         $(CHARMXI) ckfutures.ci
538
539 tempo.def.h: tempo.decl.h
540
541 tempo.decl.h: tempo.ci charmxi
542         $(CHARMXI) tempo.ci
543
544 waitqd.def.h: waitqd.decl.h
545
546 waitqd.decl.h: waitqd.ci charmxi
547         $(CHARMXI) waitqd.ci
548
549 LBDatabase.def.h: LBDatabase.decl.h
550
551 LBDatabase.decl.h: LBDatabase.ci charmxi
552         $(CHARMXI) LBDatabase.ci
553
554 NullLB.def.h: NullLB.decl.h
555
556 NullLB.decl.h: NullLB.ci charmxi
557         $(CHARMXI) NullLB.ci
558
559 BaseLB.def.h: BaseLB.decl.h
560
561 BaseLB.decl.h: BaseLB.ci charmxi
562         $(CHARMXI) BaseLB.ci
563
564 TraceSummary.def.h: TraceSummary.decl.h
565
566 TraceSummary.decl.h: trace-summary.ci charmxi
567         $(CHARMXI) trace-summary.ci
568
569 CkReduction.def.h: CkReduction.decl.h
570
571 CkReduction.decl.h: ckreduction.ci charmxi
572         $(CHARMXI) ckreduction.ci
573
574 CkCheckpoint.def.h: CkCheckpoint.decl.h
575
576 CkCheckpoint.decl.h: ckcheckpoint.ci charmxi
577         $(CHARMXI) ckcheckpoint.ci
578
579 CkMemCheckpoint.def.h: CkMemCheckpoint.decl.h
580
581 CkMemCheckpoint.decl.h: ckmemcheckpoint.ci charmxi
582         $(CHARMXI) ckmemcheckpoint.ci
583
584 CkMarshall.def.h: CkMarshall.decl.h
585
586 CkMarshall.decl.h: ckmarshall.ci charmxi
587         $(CHARMXI) ckmarshall.ci
588
589 CkArrayReductionMgr.def.h: CkArrayReductionMgr.decl.h
590
591 CkArrayReductionMgr.decl.h: ckarrayreductionmgr.ci charmxi
592         $(CHARMXI) ckarrayreductionmgr.ci
593
594 CkArray.def.h: CkArray.decl.h
595
596 CkArray.decl.h : ckarray.ci charmxi
597         $(CHARMXI) ckarray.ci
598
599 CkLocation.def.h: CkLocation.decl.h
600
601 CkLocation.decl.h: cklocation.ci charmxi
602         $(CHARMXI) cklocation.ci
603
604 CkCallback.def.h: CkCallback.decl.h
605
606 CkCallback.decl.h: ckcallback.ci charmxi
607         $(CHARMXI) ckcallback.ci
608
609 charisma.def.h: charisma.decl.h
610
611 charisma.decl.h: charisma.ci charmxi
612         $(CHARMXI) charisma.ci
613
614 ## Charm++ Load balancer (Dynamic load balancer)
615
616 CentralLB.def.h: CentralLB.decl.h
617
618 CentralLB.decl.h: CentralLB.ci charmxi
619         $(CHARMXI) CentralLB.ci
620
621 NborBaseLB.def.h: NborBaseLB.decl.h
622
623 NborBaseLB.decl.h: NborBaseLB.ci charmxi
624         $(CHARMXI) NborBaseLB.ci
625
626
627 ## Tracing libraries (profiling, -tracemode)
628 LIBTRACE_PROJ=trace-projections.o trace-common.o
629 $(L)/libtrace-projections.a: $(LIBTRACE_PROJ)
630         $(CHARMC) -o $@ $(LIBTRACE_PROJ)
631
632 LIBTRACE_SUMM=trace-summary.o trace-common.o
633 $(L)/libtrace-summary.a: $(LIBTRACE_SUMM)
634         $(CHARMC) -o $@ $(LIBTRACE_SUMM)
635
636 LIBTRACE_RECREP=trace-recordreplay.o trace-common.o
637 $(L)/libtrace-recordreplay.a: $(LIBTRACE_RECREP)
638         $(CHARMC) -o $@ $(LIBTRACE_RECREP)
639
640 LIBTRACE_COUNT=trace-counter.o trace-common.o
641 $(L)/libtrace-counter.a: $(LIBTRACE_COUNT)
642         $(CHARMC) -o $@ $(LIBTRACE_COUNT)
643
644 LIBTRACE_BG=trace-bluegene.o trace-common.o
645 $(L)/libtrace-bluegene.a:$(LIBTRACE_BG)
646         $(CHARMC) -o $@ $(LIBTRACE_BG)
647
648 LIBTRACE_ALL=trace-all.o trace-projections.o trace-summary.o trace-recordreplay.o trace-common.o trace-projector.o traceCore.o traceCoreCommon.o charmProjections.o converseProjections.o machineProjections.o
649 $(L)/libtrace-all.a: $(LIBTRACE_ALL)
650         $(CHARMC) -o $@ $(LIBTRACE_ALL)
651
652 LIBTRACE_PROJECTOR=trace-projector.o trace-common.o traceCore.o traceCoreCommon.o charmProjections.o converseProjections.o machineProjections.o
653 $(L)/libtrace-projector.a: $(LIBTRACE_PROJECTOR)
654         $(CHARMC) -o  $@ $(LIBTRACE_PROJECTOR)
655
656 LIBTRACE_CONVERSE=trace-converse.o
657 $(L)/libtrace-converse.a: $(LIBTRACE_CONVERSE)
658         $(CHARMC) -o  $@ $(LIBTRACE_CONVERSE)
659
660 LIBTRACE_FOR=tracef_f.o
661 $(L)/libtracef_f.a: $(LIBTRACE_FOR)
662         -$(CHARMC) -o $@ $(LIBTRACE_FOR) || touch $@
663
664 tracef_f.o: tracef_f.f90
665         -$(CHARMC) -o $@ -c tracef_f.f90 && $(CHARMC) -cpmod ../include tracemod.M  || touch $@
666
667 # used for make depends
668 TRACE_OBJS =  trace-projections.o  trace-summary.o  trace-counter.o     \
669               trace-bluegene.o trace-projector.o trace-converse.o trace-all.o \
670               trace-recordreplay.o
671
672 ###############################################################################
673 #
674 # Dynamic Load Balancers
675 #
676 ###############################################################################
677
678
679 # Automatically generated by script Makefile_lb.sh
680 include Make.lb
681
682 loadbalancers: $(LOADBALANCERS) $(L)/libmoduleEveryLB.a
683
684
685 ######################################################################
686 #
687 #Communication Optimization Library
688 #
689 ######################################################################
690
691 STRATEGY_OBJS = MPIStrategy.o StreamingStrategy.o \
692                 DummyStrategy.o NodeMulticast.o \
693                 EachToManyMulticastStrategy.o ComlibSectionInfo.o \
694                 MsgPacker.o DirectMulticastStrategy.o \
695                 RingMulticastStrategy.o \
696                 PipeBroadcastStrategy.o MeshStreamingStrategy.o \
697                 PrioStreaming.o BroadcastStrategy.o
698
699 CONVERSE_COM_OBJS = gridrouter.o de.o treerouter.o petable.o \
700         3dgridrouter.o graphrouter.o hypercubetopology.o \
701         routerstrategy.o convcomlibmanager.o pipebroadcastconverse.o
702
703 comlib.def.h: comlib.decl.h
704
705 comlib.decl.h : ComlibManager.ci charmxi
706         $(CHARMXI) ComlibManager.ci
707
708 COMLIB_OBJS = ComlibManager.o $(STRATEGY_OBJS) $(CONVERSE_COM_OBJS)
709
710 comlib_objs: $(L)/libmodulecomlib.a
711
712 #for backward compatibility, keep libmodulecommlib.a with double m.
713 $(L)/libmodulecomlib.a: $(COMLIB_OBJS)
714         $(CHARMC) -o $(L)/libmodulecomlib.a $(COMLIB_OBJS)
715         cp $(L)/libmodulecomlib.a $(L)/libmodulecommlib.a
716
717 ###############################################################################
718 #
719 # BlueGene Emulator
720 #
721 ###############################################################################
722
723 bluegene:  basics
724         $(MAKE) bluegene-target
725
726 bluegene-target: charm++ $(L)/libconv-bluegene.a $(L)/libconv-bluegene-logs.a METIS
727
728 # old (Charm++) Blue Gene emulator
729 BlueGene.decl.h BlueGene.def.h : BlueGene.ci charmxi
730         $(CHARMXI) BlueGene.ci
731
732 $(L)/libbluegene.a: BlueGene.C BlueGene.h BlueGene.decl.h BlueGene.def.h
733         $(CHARMC) -c BlueGene.C
734         $(CHARMC) -o $@ BlueGene.o
735
736 # (Converse) Blue Gene emulator
737 BLUE_HEADERS = blue_types.h blue_timing.h blue_defs.h blue_logs.h blue.h blue_impl.h blue_network.h
738 BLUE_OBJS = blue.o blue_node.o blue_proc.o blue_init.o blue_timing.o
739 BLUE_IO_OBJS = blue_IO.o blue_logs.o blue_api.o
740
741 $(L)/libconv-bluegene.a: $(BLUE_OBJS)
742         $(CHARMC) -o $@  $(BLUE_OBJS)
743
744 $(L)/libconv-bluegene-logs.a: $(BLUE_IO_OBJS)
745         $(CHARMC) -o $@  $(BLUE_IO_OBJS)
746
747 ###############################################################################
748 #
749 # The CPM scanner
750 #
751 ###############################################################################
752
753 conv-cpm: conv-cpm.o
754         $(NATIVECHARMC) -language c -o conv-cpm -cp ../bin/ conv-cpm.o
755
756 conv-cpm.o: conv-cpm.c $(CVHEADERS)
757         $(NATIVECHARMC) conv-cpm.c
758
759 ###############################################################################
760 #
761 # The interface translator
762 #
763 ###############################################################################
764
765 XIHEADERS=conv-autoconfig.h xi-symbol.h xi-util.h xi-grammar.tab.h
766 CHARMXIOBJ=xi-main.o xi-symbol.o xi-grammar.tab.o xi-scan.o xi-util.o
767 SDAGOBJ=sdag-globals.o CSdagConstruct.o CEntry.o
768 SDAGHEADERS= CToken.h EToken.h CParsedFile.h \
769         sdag-globals.h CEntry.h
770
771 charmxi: ../bin/charmxi
772
773 ../bin/charmxi: $(CHARMXIOBJ) $(SDAGOBJ)
774         $(NATIVECHARMC) -language c++ -cp ../bin/ -o charmxi $(CHARMXIOBJ) $(SDAGOBJ)
775
776 xi-main.o: xi-main.C $(XIHEADERS) $(SDAGHEADERS)
777         $(NATIVECHARMC) xi-main.C
778
779 xi-symbol.o: xi-symbol.C $(XIHEADERS) $(SDAGHEADERS)
780         $(NATIVECHARMC) xi-symbol.C
781
782 xi-util.o: xi-util.C $(XIHEADERS) $(SDAGHEADERS)
783         $(NATIVECHARMC) xi-util.C
784
785 xi-grammar.tab.o: xi-grammar.tab.C $(XIHEADERS) $(SDAGHEADERS)
786         $(NATIVECHARMC) xi-grammar.tab.C
787
788 xi-scan.o: xi-scan.C $(XIHEADERS) $(SDAGHEADERS)
789         $(NATIVECHARMC) -I. -DYY_NEVER_INTERACTIVE xi-scan.C
790
791 sdag-globals.o: sdag-globals.C $(XIHEADERS) $(SDAGHEADERS)
792         $(NATIVECHARMC) -c sdag-globals.C
793
794 CSdagConstruct.o: CSdagConstruct.C $(XIHEADERS) $(SDAGHEADERS)
795         $(NATIVECHARMC) -c CSdagConstruct.C
796
797 CEntry.o: CEntry.C $(XIHEADERS) $(SDAGHEADERS)
798         $(NATIVECHARMC) -c CEntry.C
799
800 ###############################################################################
801 #
802 # Simple Messaging
803 #
804 ###############################################################################
805
806 $(L)/libtsm.a: converse simplemsg.c simplemsg.h
807         $(CHARMC) -o $@ simplemsg.c
808
809 $(L)/libsm.a: converse sm.c sm.h
810         $(CHARMC) -o $@ sm.c
811
812 ###############################################################################
813 #
814 # PVM
815 #
816 ###############################################################################
817
818 PVMC=pvmc_buf.o pvmc_comm.o pvmc_conv.o pvmc_main.o pvmc_pack.o pvmc_groups.o
819
820 $(L)/libpvmc.a: $(PVMC)
821         $(CHARMC) -o $@ $(PVMC)
822
823 pvmc_buf.o: pvmc_buf.c pvmc.h pvm3.h
824         $(CHARMC) -o $@ pvmc_buf.c
825
826 pvmc_conv.o: pvmc_conv.c pvmc.h pvm3.h
827         $(CHARMC) -o $@ pvmc_conv.c
828
829 pvmc_pack.o: pvmc_pack.c pvmc.h pvm3.h
830         $(CHARMC) -o $@ pvmc_pack.c
831
832 pvmc_comm.o: pvmc_comm.c pvmc.h pvm3.h
833         $(CHARMC) -o $@ pvmc_comm.c
834
835 pvmc_groups.o: pvmc_groups.c pvmc.h pvm3.h
836         $(CHARMC) -o $@ pvmc_groups.c
837
838 pvmc_main.o: pvmc_main.c pvmc.h pvm3.h
839         $(CHARMC) -o $@ pvmc_main.c
840
841 $(L)/libf90charm.a: f90main.ci f90main.h f90main.C charmf.h charmf.C futil.f90
842         $(CHARMC) f90main.ci
843         $(CHARMC) -c -DAMPI_FORTRAN=1 f90main.C
844         $(CHARMC) -c -DAMPI_FORTRAN=1 charmf.C
845         -$(CHARMC) -c futil.f90
846         -$(CHARMC) -o $@ f90main.o charmf.o futil.o
847
848 ###############################################################################
849 #
850 # Make clean
851 #
852 ###############################################################################
853
854 install:
855         -test ! -d $(DESTDIR)/include && mkdir -p $(DESTDIR)/include
856         -test ! -d $(DESTDIR)/lib && mkdir -p $(DESTDIR)/lib
857         -test ! -d $(DESTDIR)/lib_so && mkdir -p $(DESTDIR)/lib_so
858         -test ! -d $(DESTDIR)/bin && mkdir -p $(DESTDIR)/bin
859         cp -f ../include/*   $(DESTDIR)/include
860         cp -f ../lib/*       $(DESTDIR)/lib
861         cp -f ../lib_so/*    $(DESTDIR)/lib_so
862         cp -f ../bin/*       $(DESTDIR)/bin
863
864 clean:
865         rm -f conv-autoconfig.h config.cache
866         rm -f QuickThreads/libqt.a
867         rm -f charmxi conv-cpm
868         rm -f TAGS basics cmk_extras core
869         rm -f core *.a
870         rm -f core *.o
871         rm -f core #*#
872         rm -f core *~
873         if [ -d charmrun ] ; then ( cd charmrun; make clean ) ; fi
874         -( cd doc && make clean )
875         ( cd libs; make clean )
876         ( cd ../pgms; make clean )
877
878 veryclean:
879         rm -rf ../bin
880         rm -rf ../lib
881         rm -rf ../src
882         rm -rf ../pgms
883         rm -rf ../include
884         rm -rf ../doc
885         mv Makefile .Makefile
886         mv Make.depends .Make.depends
887         rm -rf [a-z]* [A-Z]*
888         mv .Make.depends Make.depends
889         rm -rf .[a-z]* .[A-Z]*
890
891
892 config: configure.in
893         autoconf && autoheader
894
895 depends: basics
896         echo "Creating " $(DEPENDFILE) " ...";
897         if [ -f $(DEPENDFILE) ]; then \
898            /bin/cp -f $(DEPENDFILE) $(DEPENDFILE).old; \
899         fi; \
900         echo '#generated by make depends' > $(DEPENDFILE); \
901         processFiles='';        \
902         for i in $(LIBCONV_CORE) $(TRACE_OBJS) $(LIBCK_CORE) $(LB_OBJ) $(BLUE_OBJS) $(BLUE_IO_OBJS) $(CONVERSE_COM_CORE_OBJS) $(COMLIB_OBJS); do \
903               processed='false';        \
904               for f in $$processFiles; do       \
905                 if test $$i = $$f ; then        \
906                   processed=true;  break;       \
907                 fi;     \
908               done;     \
909               test $$processed = 'true'  && continue;   \
910               processFiles="$$processFiles $$i";        \
911               SRCFILE=`basename $$i .o`.C ; \
912               [ ! -f $$SRCFILE ] && SRCFILE=`basename $$i .o`.c ;       \
913               echo "checking dependencies for $$SRCFILE" ; \
914               g++ -MM -Wno-deprecated -I. -I$(INC) $$SRCFILE  >> $(DEPENDFILE); \
915               echo '    $$(CHARMC) -c -I. '$$SRCFILE >> $(DEPENDFILE) ; \
916               echo '' >> $(DEPENDFILE) ; \
917         done;
918