1 | #! /bin/bash |
---|
2 | |
---|
3 | # copyright John Maddock 2003 |
---|
4 | # Distributed under the Boost Software License, Version 1.0. |
---|
5 | # (See accompanying file LICENSE_1_0.txt or copy at |
---|
6 | # http://www.boost.org/LICENSE_1_0.txt. |
---|
7 | |
---|
8 | libname="" |
---|
9 | src="" |
---|
10 | header="" |
---|
11 | all_dep="" |
---|
12 | |
---|
13 | # current makefile: |
---|
14 | out="" |
---|
15 | # temporary file: |
---|
16 | tout="" |
---|
17 | # install target temp file: |
---|
18 | iout="" |
---|
19 | # debug flag: |
---|
20 | debug="no" |
---|
21 | # compile options: |
---|
22 | opts="" |
---|
23 | # main output sub-directory: |
---|
24 | subdir="" |
---|
25 | # vcl flag: |
---|
26 | use_vcl="yes" |
---|
27 | |
---|
28 | ####################################################################### |
---|
29 | # |
---|
30 | # section for Sun Forte 6.1 (5.1 compiler) |
---|
31 | # |
---|
32 | ####################################################################### |
---|
33 | |
---|
34 | function sun_gen_lib() |
---|
35 | { |
---|
36 | all_dep="$all_dep $subdir/$libname $subdir/$libname.a" |
---|
37 | |
---|
38 | # |
---|
39 | # set up section comments: |
---|
40 | cat >> $tout << EOF |
---|
41 | ######################################################## |
---|
42 | # |
---|
43 | # section for $libname.a |
---|
44 | # |
---|
45 | ######################################################## |
---|
46 | EOF |
---|
47 | # |
---|
48 | # process source files: |
---|
49 | all_obj="" |
---|
50 | all_lib_obj="" |
---|
51 | for file in $src |
---|
52 | do |
---|
53 | obj=`echo "$file" | sed 's/.*src\/\(.*\)cpp/\1o/g'` |
---|
54 | obj="$subdir/$libname/$obj" |
---|
55 | all_obj="$all_obj $obj" |
---|
56 | all_lib_obj="$all_lib_obj $obj" |
---|
57 | echo "$obj: $file \$(ALL_HEADER)" >> $tout |
---|
58 | echo " CC -c \$(INCLUDES) $opts \$(CXXFLAGS) -o $obj $file" >> $tout |
---|
59 | echo "" >> $tout |
---|
60 | done |
---|
61 | # |
---|
62 | # now for the directories for this library: |
---|
63 | echo "$subdir/$libname : " >> $tout |
---|
64 | echo " mkdir -p $subdir/$libname" >> $tout |
---|
65 | echo "" >> $tout |
---|
66 | # |
---|
67 | # now for the clean options for this library: |
---|
68 | all_clean="$all_clean $libname""_clean" |
---|
69 | echo "$libname"_clean : >> $tout |
---|
70 | echo " rm -f $subdir/$libname/"'*.o' >> $tout |
---|
71 | echo " rm -fr $subdir/$libname/\$(SUNWS_CACHE_NAME)" >> $tout |
---|
72 | echo "" >> $tout |
---|
73 | # |
---|
74 | # now for the main target for this library: |
---|
75 | echo $subdir/$libname.a : $all_obj >> $tout |
---|
76 | echo " CC -xar \$(CXXFLAGS) \$(LDFLAGS) -o $subdir/$libname.a $all_lib_obj" >> $tout |
---|
77 | echo "" >> $tout |
---|
78 | } |
---|
79 | |
---|
80 | function sun_gen_dll() |
---|
81 | { |
---|
82 | all_dep="$all_dep $subdir/shared_$libname $subdir/$libname.so" |
---|
83 | # |
---|
84 | # set up section comments: |
---|
85 | cat >> $tout << EOF |
---|
86 | ######################################################## |
---|
87 | # |
---|
88 | # section for $libname.so |
---|
89 | # |
---|
90 | ######################################################## |
---|
91 | EOF |
---|
92 | # |
---|
93 | # process source files: |
---|
94 | all_obj="" |
---|
95 | for file in $src |
---|
96 | do |
---|
97 | obj=`echo "$file" | sed 's/.*src\/\(.*\)cpp/\1o/g'` |
---|
98 | obj="$subdir/shared_$libname/$obj" |
---|
99 | all_obj="$all_obj $obj" |
---|
100 | echo "$obj: $file \$(ALL_HEADER)" >> $tout |
---|
101 | echo " CC -c \$(INCLUDES) $opts \$(CXXFLAGS) -o $obj $file" >> $tout |
---|
102 | echo "" >> $tout |
---|
103 | done |
---|
104 | # |
---|
105 | # now for the directories for this library: |
---|
106 | echo "$subdir/shared_$libname :" >> $tout |
---|
107 | echo " mkdir -p $subdir/shared_$libname" >> $tout |
---|
108 | echo "" >> $tout |
---|
109 | # |
---|
110 | # now for the clean options for this library: |
---|
111 | all_clean="$all_clean $libname""_clean_shared" |
---|
112 | echo "$libname"_clean_shared : >> $tout |
---|
113 | echo " rm -f $subdir/shared_$libname/"'*.o' >> $tout |
---|
114 | echo " rm -fr $subdir/shared_$libname/\$(SUNWS_CACHE_NAME)" >> $tout |
---|
115 | echo "" >> $tout |
---|
116 | # |
---|
117 | # now for the main target for this library: |
---|
118 | echo $subdir/$libname.so : $all_obj >> $tout |
---|
119 | echo " CC $opts -G -o $subdir/$libname.so \$(LDFLAGS) $all_obj \$(LIBS)" >> $tout |
---|
120 | echo "" >> $tout |
---|
121 | } |
---|
122 | |
---|
123 | |
---|
124 | |
---|
125 | function sun_gen() |
---|
126 | { |
---|
127 | tout="temp" |
---|
128 | iout="temp_install" |
---|
129 | all_dep="$subdir" |
---|
130 | all_clean="" |
---|
131 | echo > $out |
---|
132 | echo > $tout |
---|
133 | rm -f $iout |
---|
134 | |
---|
135 | libname="libboost_regex\$(LIBSUFFIX)" |
---|
136 | opts="-O2 -I../../../" |
---|
137 | sun_gen_lib |
---|
138 | |
---|
139 | libname="libboost_regex_mt\$(LIBSUFFIX)" |
---|
140 | opts="-O2 -mt -I../../../" |
---|
141 | sun_gen_lib |
---|
142 | |
---|
143 | libname="libboost_regex\$(LIBSUFFIX)" |
---|
144 | opts="-KPIC -O2 -I../../../" |
---|
145 | sun_gen_dll |
---|
146 | |
---|
147 | libname="libboost_regex_mt\$(LIBSUFFIX)" |
---|
148 | opts="-KPIC -O2 -mt -I../../../" |
---|
149 | sun_gen_dll |
---|
150 | |
---|
151 | |
---|
152 | cat > $out << EOF |
---|
153 | # copyright John Maddock 2006 |
---|
154 | # Distributed under the Boost Software License, Version 1.0. |
---|
155 | # (See accompanying file LICENSE_1_0.txt or copy at |
---|
156 | # http://www.boost.org/LICENSE_1_0.txt. |
---|
157 | # |
---|
158 | # auto generated makefile for Sun Forte 6.1 |
---|
159 | # |
---|
160 | # usage: |
---|
161 | # make |
---|
162 | # brings libraries up to date |
---|
163 | # make clean |
---|
164 | # removes all temporary files. |
---|
165 | |
---|
166 | # |
---|
167 | # Add additional compiler options here: |
---|
168 | # |
---|
169 | CXXFLAGS= |
---|
170 | # |
---|
171 | # Add additional include directories here: |
---|
172 | # |
---|
173 | INCLUDES= |
---|
174 | # |
---|
175 | # add additional linker flags here: |
---|
176 | # |
---|
177 | LDFLAGS= |
---|
178 | # |
---|
179 | # add additional libraries to link to here: |
---|
180 | # |
---|
181 | LIBS= |
---|
182 | # |
---|
183 | # lib suffix string: |
---|
184 | # |
---|
185 | LIBSUFFIX= |
---|
186 | # |
---|
187 | # template cache path: |
---|
188 | # |
---|
189 | SUNWS_CACHE_NAME=SunWS_cache |
---|
190 | |
---|
191 | |
---|
192 | EOF |
---|
193 | echo "" >> $out |
---|
194 | echo "ALL_HEADER=$header" >> $out |
---|
195 | echo "" >> $out |
---|
196 | echo "all : $all_dep" >> $out |
---|
197 | echo >> $out |
---|
198 | echo "clean : $all_clean" >> $out |
---|
199 | echo >> $out |
---|
200 | echo "install : all" >> $out |
---|
201 | # cat $iout >> $out |
---|
202 | echo >> $out |
---|
203 | echo $subdir : >> $out |
---|
204 | echo " mkdir -p $subdir" >> $out |
---|
205 | echo "" >> $out |
---|
206 | |
---|
207 | cat $tout >> $out |
---|
208 | } |
---|
209 | |
---|
210 | . common.sh |
---|
211 | |
---|
212 | # |
---|
213 | # generate Sun 6.1 makefile: |
---|
214 | out="sunpro.mak" |
---|
215 | subdir="sunpro" |
---|
216 | sun_gen |
---|
217 | |
---|
218 | |
---|
219 | # |
---|
220 | # remove tmep files; |
---|
221 | rm -f $tout $iout |
---|
222 | |
---|
223 | |
---|
224 | |
---|
225 | |
---|