e59e977e3ad320fa56b009d910974c9e12cab3b6
[charm.git] / src / ck-ldb / Makefile_lb.sh
1 #!/bin/sh
2 UNCOMMON_LDBS="TempAwareGreedyLB MetisLB ScotchLB TeamLB WSLB"
3 COMMON_LDBS="BlockLB CommLB DummyLB GreedyAgentLB GreedyCommLB GreedyLB NeighborCommLB NeighborLB OrbLB PhasebyArrayLB RandCentLB RecBipartLB RefineLB RefineCommLB RotateLB TreeMatchLB"
4 OTHER_LDBS="ComboCentLB GraphPartLB GraphBFTLB GridCommLB GridCommRefineLB GridHybridLB GridHybridSeedLB GridMetisLB HbmLB HybridLB RefineKLB RefineTopoLB TopoCentLB TopoLB"
5 ALL_LDBS="$COMMON_LDBS $OTHER_LDBS"
6
7 out="Make.lb"
8
9 echo "# Automatically generated by script Makefile_lb.sh" > $out
10 echo "ALL_LDBS=\\" >> $out
11 for bal in $ALL_LDBS 
12 do 
13         echo "   \$(L)/libmodule$bal.a \\" >> $out 
14 done
15 echo "   manager.o" >> $out
16 echo >> $out
17
18 for bal in $ALL_LDBS $UNCOMMON_LDBS
19 do 
20         dep=""
21         [ -r libmodule$bal.dep ] && dep="cp -f libmodule$bal.dep "'$'"(L)/"
22         manager=""
23         [ $bal = 'GreedyCommLB' ] && manager="manager.o"
24         [ $bal = 'GridCommLB' ] && manager="manager.o"
25         [ $bal = 'GridCommRefineLB' ] && manager="manager.o"
26         [ $bal = 'GridHybridLB' ] && manager="manager.o"
27         [ $bal = 'GridHybridSeedLB' ] && manager="manager.o"
28         [ $bal = 'TreeMatchLB' ] && manager="tm_tree.o tm_bucket.o tm_timings.o tm_mapping.o"
29         cat >> $out << EOB 
30
31 \$(L)/libmodule$bal.a: $bal.o $manager
32         \$(CHARMC) -o \$(L)/libmodule$bal.a $bal.o $manager
33         $dep
34 LBHEADERS += $bal.h $bal.decl.h
35
36 EOB
37 done
38
39 echo "// AUTOMATICALLY GENERATED FILE" > EveryLB.ci
40 echo "" >> EveryLB.ci
41 echo "module EveryLB {" >> EveryLB.ci
42 for bal in $ALL_LDBS
43 do
44         echo "  extern module $bal;" >> EveryLB.ci
45 done
46 echo "" >> EveryLB.ci
47 echo "  initnode void initEveryLB(void);" >> EveryLB.ci
48 echo "};" >> EveryLB.ci
49
50 echo "// AUTOMATICALLY GENERATED FILE" > CommonLBs.ci
51 echo "" >> CommonLBs.ci
52 echo "module CommonLBs {" >> CommonLBs.ci
53 for bal in $COMMON_LDBS
54 do
55         echo "  extern module $bal;" >> CommonLBs.ci
56 done
57 echo "" >> CommonLBs.ci
58 echo "  initnode void initCommonLBs(void);" >> CommonLBs.ci
59 echo "};" >> CommonLBs.ci
60
61 echo "# used for make depends" >> $out
62 echo "ALL_LB_OBJS=EveryLB.o \\" >> $out
63 echo "    CommonLBs.o \\" >> $out
64 for bal in $ALL_LDBS $UNCOMMON_LDBS
65 do
66         echo "    $bal.o \\" >> $out
67 done
68 echo "    manager.o  \\" >> $out
69 echo "    tm_tree.o  \\" >> $out
70 echo "    tm_timings.o  \\" >> $out
71 echo "    tm_bucket.o \\" >> $out
72 echo "    tm_mapping.o" >> $out
73
74 echo "# EveryLB dependecies" >> $out
75 echo "EVERYLB_DEPS=EveryLB.o \\" >> $out
76 for bal in $ALL_LDBS
77 do
78         echo "    $bal.o \\" >> $out
79 done
80 echo "    manager.o \\" >> $out
81 echo "    tm_tree.o  \\" >> $out
82 echo "    tm_timings.o  \\" >> $out
83 echo "    tm_bucket.o \\" >> $out
84 echo "    tm_mapping.o" >> $out
85
86 echo "# CommonLBs dependencies" >> $out
87 echo "COMMONLBS_DEPS=CommonLBs.o \\" >> $out
88 for bal in $COMMON_LDBS
89 do
90         echo "    $bal.o \\" >> $out
91 done
92 echo "    manager.o" \\>> $out
93 echo "    tm_tree.o  \\" >> $out
94 echo "    tm_timings.o  \\" >> $out
95 echo "    tm_bucket.o \\" >> $out
96 echo "    tm_mapping.o" >> $out
97
98 cat >> $out <<EOB
99
100 \$(L)/libmoduleEveryLB.a: \$(EVERYLB_DEPS)
101         \$(CHARMC) -o \$(L)/libmoduleEveryLB.a \$(EVERYLB_DEPS)
102
103 \$(L)/libmoduleCommonLBs.a: \$(COMMONLBS_DEPS)
104         \$(CHARMC) -o \$(L)/libmoduleCommonLBs.a \$(COMMONLBS_DEPS)
105 EOB