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