Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/regex/build/gcc_gen.sh @ 12

Last change on this file since 12 was 12, checked in by landauf, 17 years ago

added boost

File size: 5.4 KB
Line 
1#! /bin/bash
2
3libname=""
4src=""
5header=""
6all_dep=""
7
8# current makefile:
9out=""
10# temporary file:
11tout=""
12# install target temp file:
13iout=""
14# debug flag:
15debug="no"
16# compile options:
17opts=""
18# main output sub-directory:
19subdir=""
20# vcl flag:
21use_vcl="yes"
22
23###############################################################
24#
25# gcc generator section:
26#
27###############################################################
28
29gcc_shared="no"
30
31function gcc_gen_lib()
32{
33        if test "$gcc_shared" == "yes"; then
34                obj_dir="$libname""_shared"
35                all_dep="$all_dep $subdir $subdir/$obj_dir ./$subdir/lib$libname.so"
36        else
37                obj_dir="$libname"
38                all_dep="$all_dep $subdir $subdir/$obj_dir ./$subdir/lib$libname.a"
39        fi
40#
41# set up section comments:
42        cat >> $tout << EOF
43########################################################
44#
45# section for lib$libname.a
46#
47########################################################
48EOF
49#
50#       process source files:
51        all_obj=""
52        for file in $src
53        do
54                obj=`echo "$file" | sed 's/.*src\/\(.*\)cpp/\1o/g'`
55                obj="$subdir/$obj_dir/$obj"
56                all_obj="$all_obj $obj"
57                echo "$obj: $file \$(ALL_HEADER)" >> $tout
58                echo "  \$(CXX) \$(INCLUDES) -o $obj $opts \$(CXXFLAGS) \$(ICU_CXXFLAGS) $file" >> $tout
59                echo "" >> $tout
60        done
61#
62#        now for the directories for this library:
63        echo "$subdir/$obj_dir : " >> $tout
64        echo "  mkdir -p $subdir/$obj_dir" >> $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/$obj_dir/*.o" >> $tout
71        echo "" >> $tout
72#
73#        now for the main target for this library:
74          if test "$gcc_shared" == "yes"; then
75                echo ./$subdir/lib$libname.so : $all_obj >> $tout
76                echo "  \$(LINKER) -o $subdir/lib$libname.so \$(LDFLAGS)  \$(ICU_LDFLAGS) $all_obj \$(ICU_LIBS) \$(LIBS)" >> $tout
77        else
78                echo ./$subdir/lib$libname.a : $all_obj >> $tout
79                echo "  ar -r $subdir/lib$libname.a $all_obj" >> $tout
80                echo "  -ar -s $subdir/lib$libname.a" >> $tout
81        fi
82        echo "" >> $tout
83}
84
85function gcc_gen()
86{
87        out="gcc.mak"
88        tout="temp"
89        iout="temp_install"
90        subdir="gcc"
91        all_dep=""
92        all_clean=""
93        echo > $out
94        echo > $tout
95        echo > $iout
96
97        libname="boost_regex-gcc-${boost_version}"
98        opts="\$(C1)"
99        gcc_gen_lib
100        libname="boost_regex-gcc-d-${boost_version}"
101        opts="\$(C2)"
102        gcc_gen_lib
103       
104       
105        cat > $out << EOF
106#
107# auto generated makefile for gcc compiler
108#
109# usage:
110# make
111#   brings libraries up to date
112# make clean
113#   deletes temporary object files (but not archives).
114#
115
116#
117# the following environment variables are recognised:
118# ICU_PATH= Path to ICU installation.
119# CXXFLAGS= extra compiler options - note applies to all build variants
120# INCLUDES= additional include directories
121# LDFLAGS=  additional linker options
122# LIBS=     additional library files
123
124# compiler:
125CXX=g++
126LINKER=g++ -shared
127
128#
129# compiler options for release build:
130#
131C1=-c -O2 -I../../../
132#
133# compiler options for debug build:
134#
135C2=-c -g -I../../../
136
137ifeq "\$(ICU_PATH)" ""
138\$(warning "Building Boost.Regex without ICU / Unicode support:")
139\$(warning "Hint: set ICU_PATH on the nmake command line to point ")
140\$(warning "to your ICU installation if you have one.")
141else
142ICU_CXXFLAGS= -DBOOST_HAS_ICU=1 -I\$(ICU_PATH)/include
143ICU_LDFLAGS= -L\$(ICU_PATH)/lib
144ICU_LIBS= -licui18n -licuuc
145\$(warning "Building Boost.Regex with ICU in \$(ICU_PATH)")
146endif
147
148EOF
149        echo "" >> $out
150        echo "ALL_HEADER=$header" >> $out
151        echo "" >> $out
152        echo "all : $subdir $all_dep" >> $out
153        echo >> $out
154        echo "$subdir :" >> $out
155        echo "  mkdir -p $subdir" >> $out
156        echo >> $out
157        echo "clean : $all_clean" >> $out
158        echo >> $out
159        echo "install : all" >> $out
160        cat $iout >> $out
161        echo >> $out
162        cat $tout >> $out
163}
164
165function gcc_gen_shared()
166{
167        out="gcc-shared.mak"
168        tout="temp"
169        iout="temp_install"
170        subdir="gcc"
171        all_dep=""
172        all_clean=""
173        echo > $out
174        echo > $tout
175        echo > $iout
176
177        libname="boost_regex-gcc-${boost_version}"
178        opts="\$(C1)"
179        gcc_gen_lib
180        libname="boost_regex-gcc-d-${boost_version}"
181        opts="\$(C2)"
182        gcc_gen_lib
183       
184       
185        cat > $out << EOF
186#
187# auto generated makefile for gcc compiler
188#
189# usage:
190# make
191#   brings libraries up to date
192# make clean
193#   deletes temporary object files (but not archives).
194#
195
196#
197# the following environment variables are recognised:
198# ICU_PATH= Path to ICU installation.
199# CXXFLAGS= extra compiler options - note applies to all build variants
200# INCLUDES= additional include directories
201# LDFLAGS=  additional linker options
202# LIBS=     additional library files
203
204# compiler:
205CXX=g++
206LINKER=g++ -shared
207
208#
209# compiler options for release build:
210#
211C1=-c -O2 -I../../../ -fPIC
212#
213# compiler options for debug build:
214#
215C2=-c -g -I../../../ -fPIC
216
217ifeq "\$(ICU_PATH)" ""
218\$(warning "Building Boost.Regex without ICU / Unicode support:")
219\$(warning "Hint: set ICU_PATH on the nmake command line to point ")
220\$(warning "to your ICU installation if you have one.")
221else
222ICU_CXXFLAGS= -DBOOST_HAS_ICU=1 -I\$(ICU_PATH)/include
223ICU_LDFLAGS= -L\$(ICU_PATH)/lib
224ICU_LIBS= -licui18n -licuuc
225\$(warning "Building Boost.Regex with ICU in \$(ICU_PATH)")
226endif
227
228EOF
229        echo "" >> $out
230        echo "ALL_HEADER=$header" >> $out
231        echo "" >> $out
232        echo "all : $subdir $all_dep" >> $out
233        echo >> $out
234        echo "$subdir :" >> $out
235        echo "  mkdir -p $subdir" >> $out
236        echo >> $out
237        echo "clean : $all_clean" >> $out
238        echo >> $out
239        echo "install : all" >> $out
240        cat $iout >> $out
241        echo >> $out
242        cat $tout >> $out
243}
244
245#
246# locate source files:
247#
248. common.sh
249
250#
251# generate gcc makefile:
252gcc_gen
253gcc_shared="yes"
254gcc_gen_shared
255
256
257#
258# remove tmep files;
259rm -f $tout $iout
260
261
262
Note: See TracBrowser for help on using the repository browser.