| 1 | #! /bin/bash | 
|---|
| 2 |  | 
|---|
| 3 | libname="" | 
|---|
| 4 | src="" | 
|---|
| 5 | header="" | 
|---|
| 6 | all_dep="" | 
|---|
| 7 |  | 
|---|
| 8 | # current makefile: | 
|---|
| 9 | out="" | 
|---|
| 10 | # temporary file: | 
|---|
| 11 | tout="" | 
|---|
| 12 | # install target temp file: | 
|---|
| 13 | iout="" | 
|---|
| 14 | # debug flag: | 
|---|
| 15 | debug="no" | 
|---|
| 16 | # compile options: | 
|---|
| 17 | opts="" | 
|---|
| 18 | # main output sub-directory: | 
|---|
| 19 | subdir="" | 
|---|
| 20 |  | 
|---|
| 21 | ####################################################################### | 
|---|
| 22 | # | 
|---|
| 23 | # section for C++ Builder | 
|---|
| 24 | # | 
|---|
| 25 | ####################################################################### | 
|---|
| 26 |  | 
|---|
| 27 | function bcb_gen_lib() | 
|---|
| 28 | { | 
|---|
| 29 | all_dep="$all_dep $subdir\\$libname $subdir\\$libname.lib" | 
|---|
| 30 | echo "  copy $subdir\\$libname.lib \$(BCROOT)\\lib" >> $iout | 
|---|
| 31 | # | 
|---|
| 32 | # set up section comments: | 
|---|
| 33 | cat >> $tout << EOF | 
|---|
| 34 | ######################################################## | 
|---|
| 35 | # | 
|---|
| 36 | # section for $libname.lib | 
|---|
| 37 | # | 
|---|
| 38 | ######################################################## | 
|---|
| 39 | EOF | 
|---|
| 40 | # | 
|---|
| 41 | #       process source files: | 
|---|
| 42 | all_obj="" | 
|---|
| 43 | all_lib_obj="" | 
|---|
| 44 | for file in $src | 
|---|
| 45 | do | 
|---|
| 46 | obj=`echo "$file" | sed 's/.*src\/\(.*\)cpp/\1obj/g'` | 
|---|
| 47 | obj="$subdir\\$libname\\$obj" | 
|---|
| 48 | all_obj="$all_obj $obj" | 
|---|
| 49 | all_lib_obj="$all_lib_obj +\"$obj\"" | 
|---|
| 50 | echo "$obj: $file \$(ALL_HEADER)" >> $tout | 
|---|
| 51 | echo "  bcc32 @&&|" >> $tout | 
|---|
| 52 | echo "-c \$(INCLUDES) $opts \$(CXXFLAGS) -o$obj $file" >> $tout | 
|---|
| 53 | echo "|" >> $tout | 
|---|
| 54 | echo "" >> $tout | 
|---|
| 55 | done | 
|---|
| 56 | # | 
|---|
| 57 | #        now for the directories for this library: | 
|---|
| 58 | echo "$subdir\\$libname : " >> $tout | 
|---|
| 59 | echo "  -@mkdir $subdir\\$libname" >> $tout | 
|---|
| 60 | echo "" >> $tout | 
|---|
| 61 | # | 
|---|
| 62 | #        now for the clean options for this library: | 
|---|
| 63 | all_clean="$all_clean $libname""_clean" | 
|---|
| 64 | echo "$libname"_clean : >> $tout | 
|---|
| 65 | echo "  del $subdir\\$libname\\"'*.obj' >> $tout | 
|---|
| 66 | echo "  del $subdir\\$libname\\"'*.il?' >> $tout | 
|---|
| 67 | echo "  del $subdir\\$libname\\"'*.csm' >> $tout | 
|---|
| 68 | echo "  del $subdir\\$libname\\"'*.tds' >> $tout | 
|---|
| 69 | echo "" >> $tout | 
|---|
| 70 | # | 
|---|
| 71 | #        now for the main target for this library: | 
|---|
| 72 | echo $subdir\\$libname.lib : $all_obj >> $tout | 
|---|
| 73 | echo "  if exist $subdir\\$libname.lib del $subdir\\$libname.lib " >> $tout | 
|---|
| 74 | echo "  tlib @&&|" >> $tout | 
|---|
| 75 | echo "/P128 /C /u /a \$(XSFLAGS) \"$subdir\\$libname.lib\" $all_lib_obj" >> $tout | 
|---|
| 76 | echo "|" >> $tout | 
|---|
| 77 | echo "" >> $tout | 
|---|
| 78 | } | 
|---|
| 79 |  | 
|---|
| 80 | function bcb_gen_dll() | 
|---|
| 81 | { | 
|---|
| 82 | all_dep="$all_dep $subdir\\$libname $subdir\\$libname.lib" | 
|---|
| 83 | echo "  copy $subdir\\$libname.lib \$(BCROOT)\\lib" >> $iout | 
|---|
| 84 | echo "  copy $subdir\\$libname.dll \$(BCROOT)\\bin" >> $iout | 
|---|
| 85 | echo "  copy $subdir\\$libname.tds \$(BCROOT)\\bin" >> $iout | 
|---|
| 86 | # | 
|---|
| 87 | # set up section comments: | 
|---|
| 88 | cat >> $tout << EOF | 
|---|
| 89 | ######################################################## | 
|---|
| 90 | # | 
|---|
| 91 | # section for $libname.lib | 
|---|
| 92 | # | 
|---|
| 93 | ######################################################## | 
|---|
| 94 | EOF | 
|---|
| 95 | # | 
|---|
| 96 | #       process source files: | 
|---|
| 97 | all_obj="" | 
|---|
| 98 | for file in $src | 
|---|
| 99 | do | 
|---|
| 100 | obj=`echo "$file" | sed 's/.*src\/\(.*\)cpp/\1obj/g'` | 
|---|
| 101 | obj="$subdir\\$libname\\$obj" | 
|---|
| 102 | all_obj="$all_obj $obj" | 
|---|
| 103 | echo "$obj: $file \$(ALL_HEADER)" >> $tout | 
|---|
| 104 | echo "  bcc32 @&&|" >> $tout | 
|---|
| 105 | echo "-c \$(INCLUDES) $opts \$(CXXFLAGS) -DBOOST_REGEX_DYN_LINK -o$obj $file" >> $tout | 
|---|
| 106 | echo "|" >> $tout | 
|---|
| 107 | echo "" >> $tout | 
|---|
| 108 | done | 
|---|
| 109 | # | 
|---|
| 110 | #        now for the directories for this library: | 
|---|
| 111 | echo "$subdir\\$libname :" >> $tout | 
|---|
| 112 | echo "  -@mkdir $subdir\\$libname" >> $tout | 
|---|
| 113 | echo "" >> $tout | 
|---|
| 114 | # | 
|---|
| 115 | #        now for the clean options for this library: | 
|---|
| 116 | all_clean="$all_clean $libname""_clean" | 
|---|
| 117 | echo "$libname"_clean : >> $tout | 
|---|
| 118 | echo "  del $subdir\\$libname\\"'*.obj' >> $tout | 
|---|
| 119 | echo "  del $subdir\\$libname\\"'*.il?' >> $tout | 
|---|
| 120 | echo "  del $subdir\\$libname\\"'*.csm' >> $tout | 
|---|
| 121 | echo "  del $subdir\\$libname\\"'*.tds' >> $tout | 
|---|
| 122 | echo "  del $subdir\\"'*.tds' >> $tout | 
|---|
| 123 | echo "" >> $tout | 
|---|
| 124 | # | 
|---|
| 125 | #        now for the main target for this library: | 
|---|
| 126 | echo $subdir\\$libname.lib : $all_obj >> $tout | 
|---|
| 127 | echo "  bcc32 @&&|" >> $tout | 
|---|
| 128 | echo "-lw-dup -lw-dpl $opts -e$subdir\\$libname.dll \$(XLFLAGS) $all_obj \$(LIBS)" >> $tout | 
|---|
| 129 | echo "|" >> $tout | 
|---|
| 130 | echo "  implib -w $subdir\\$libname.lib $subdir\\$libname.dll" >> $tout | 
|---|
| 131 | echo "" >> $tout | 
|---|
| 132 | } | 
|---|
| 133 |  | 
|---|
| 134 |  | 
|---|
| 135 |  | 
|---|
| 136 | function bcb_gen() | 
|---|
| 137 | { | 
|---|
| 138 | tout="temp" | 
|---|
| 139 | iout="temp_install" | 
|---|
| 140 | all_dep="$subdir" | 
|---|
| 141 | all_clean="" | 
|---|
| 142 | echo > $out | 
|---|
| 143 | echo > $tout | 
|---|
| 144 | rm -f $iout | 
|---|
| 145 |  | 
|---|
| 146 | libname="libboost_regex-${subdir}-s-${boost_version}" | 
|---|
| 147 | opts="-tWM- -D_NO_VCL -O2 -Ve -Vx -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I\$(BCROOT)\include;../../../" | 
|---|
| 148 | bcb_gen_lib | 
|---|
| 149 |  | 
|---|
| 150 | libname="libboost_regex-${subdir}-mt-s-${boost_version}" | 
|---|
| 151 | opts="-tWM -D_NO_VCL -O2 -Ve -Vx -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I\$(BCROOT)\include;../../../" | 
|---|
| 152 | bcb_gen_lib | 
|---|
| 153 |  | 
|---|
| 154 | libname="boost_regex-${subdir}-mt-${boost_version}" | 
|---|
| 155 | opts="-tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -Ve -Vx -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I\$(BCROOT)\include;../../../ -L\$(BCROOT)\lib;\$(BCROOT)\lib\release;" | 
|---|
| 156 | bcb_gen_dll | 
|---|
| 157 |  | 
|---|
| 158 | libname="boost_regex-${subdir}-${boost_version}" | 
|---|
| 159 | opts="-tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -Ve -Vx -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I\$(BCROOT)\include;../../../ -L\$(BCROOT)\lib;\$(BCROOT)\lib\release;" | 
|---|
| 160 | bcb_gen_dll | 
|---|
| 161 |  | 
|---|
| 162 | libname="libboost_regex-${subdir}-mt-${boost_version}" | 
|---|
| 163 | opts="-tWD -tWM -tWR -DBOOST_REGEX_STATIC_LINK -D_NO_VCL -D_RTLDLL -O2 -Ve -Vx -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I\$(BCROOT)\include;../../../ -L\$(BCROOT)\lib;\$(BCROOT)\lib\release;" | 
|---|
| 164 | bcb_gen_lib | 
|---|
| 165 |  | 
|---|
| 166 | libname="libboost_regex-${subdir}-${boost_version}" | 
|---|
| 167 | opts="-tWD -tWR -tWM- -DBOOST_REGEX_STATIC_LINK -D_NO_VCL -D_RTLDLL -O2 -Ve -Vx -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I\$(BCROOT)\include;../../../ -L\$(BCROOT)\lib;\$(BCROOT)\lib\release;" | 
|---|
| 168 | bcb_gen_lib | 
|---|
| 169 |  | 
|---|
| 170 | libname="libboost_regex-${subdir}-sd-${boost_version}" | 
|---|
| 171 | opts="-tWM- -D_NO_VCL -v -Ve -Vx -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I\$(BCROOT)\include;../../../" | 
|---|
| 172 | bcb_gen_lib | 
|---|
| 173 |  | 
|---|
| 174 | libname="libboost_regex-${subdir}-mt-sd-${boost_version}" | 
|---|
| 175 | opts="-tWM -D_NO_VCL -v -Ve -Vx -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I\$(BCROOT)\include;../../../" | 
|---|
| 176 | bcb_gen_lib | 
|---|
| 177 |  | 
|---|
| 178 | libname="boost_regex-${subdir}-mt-d-${boost_version}" | 
|---|
| 179 | opts="-tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -v -Ve -Vx -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I\$(BCROOT)\include;../../../ -L\$(BCROOT)\lib;\$(BCROOT)\lib\release;" | 
|---|
| 180 | bcb_gen_dll | 
|---|
| 181 |  | 
|---|
| 182 | libname="boost_regex-${subdir}-d-${boost_version}" | 
|---|
| 183 | opts="-tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -v -Ve -Vx -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I\$(BCROOT)\include;../../../ -L\$(BCROOT)\lib;\$(BCROOT)\lib\release;" | 
|---|
| 184 | bcb_gen_dll | 
|---|
| 185 |  | 
|---|
| 186 | libname="libboost_regex-${subdir}-mt-d-${boost_version}" | 
|---|
| 187 | opts="-tWD -tWM -tWR -DBOOST_REGEX_STATIC_LINK -D_NO_VCL -D_RTLDLL -v -Ve -Vx -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I\$(BCROOT)\include;../../../ -L\$(BCROOT)\lib;\$(BCROOT)\lib\release;" | 
|---|
| 188 | bcb_gen_lib | 
|---|
| 189 |  | 
|---|
| 190 | libname="libboost_regex-${subdir}-d-${boost_version}" | 
|---|
| 191 | opts="-tWD -tWR -tWM- -DBOOST_REGEX_STATIC_LINK -D_NO_VCL -D_RTLDLL -v -Ve -Vx -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I\$(BCROOT)\include;../../../ -L\$(BCROOT)\lib;\$(BCROOT)\lib\release;" | 
|---|
| 192 | bcb_gen_lib | 
|---|
| 193 |  | 
|---|
| 194 | cat > $out << EOF | 
|---|
| 195 | # | 
|---|
| 196 | # auto generated makefile for C++ Builder | 
|---|
| 197 | # | 
|---|
| 198 | # usage: | 
|---|
| 199 | # make | 
|---|
| 200 | #   brings libraries up to date | 
|---|
| 201 | # make install | 
|---|
| 202 | #   brings libraries up to date and copies binaries to your C++ Builder /lib and /bin directories (recomended) | 
|---|
| 203 | # make clean | 
|---|
| 204 | #   removes all temporary files. | 
|---|
| 205 |  | 
|---|
| 206 | # | 
|---|
| 207 | # Add additional compiler options here: | 
|---|
| 208 | # | 
|---|
| 209 | CXXFLAGS= | 
|---|
| 210 | # | 
|---|
| 211 | # Add additional include directories here: | 
|---|
| 212 | # | 
|---|
| 213 | INCLUDES= | 
|---|
| 214 | # | 
|---|
| 215 | # add additional linker flags here: | 
|---|
| 216 | # | 
|---|
| 217 | XLFLAGS= | 
|---|
| 218 | # | 
|---|
| 219 | # add additional libraries to link to here: | 
|---|
| 220 | # | 
|---|
| 221 | LIBS= | 
|---|
| 222 | # | 
|---|
| 223 | # add additional static-library creation flags here: | 
|---|
| 224 | # | 
|---|
| 225 | XSFLAGS= | 
|---|
| 226 |  | 
|---|
| 227 | !ifndef BCROOT | 
|---|
| 228 | BCROOT=\$(MAKEDIR)\\.. | 
|---|
| 229 | !endif | 
|---|
| 230 |  | 
|---|
| 231 | EOF | 
|---|
| 232 | echo "" >> $out | 
|---|
| 233 | echo "ALL_HEADER=$header" >> $out | 
|---|
| 234 | echo "" >> $out | 
|---|
| 235 | echo "all : $all_dep" >> $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 | echo $subdir : >> $out | 
|---|
| 243 | echo "  -@mkdir $subdir" >> $out | 
|---|
| 244 | echo "" >> $out | 
|---|
| 245 |  | 
|---|
| 246 | cat $tout >> $out | 
|---|
| 247 | } | 
|---|
| 248 |  | 
|---|
| 249 | . common.sh | 
|---|
| 250 |  | 
|---|
| 251 | # | 
|---|
| 252 | # generate C++ Builder 6 files: | 
|---|
| 253 | out="bcb6.mak" | 
|---|
| 254 | subdir="bcb" | 
|---|
| 255 | has_stlport="yes" | 
|---|
| 256 | bcb_gen | 
|---|
| 257 |  | 
|---|
| 258 |  | 
|---|
| 259 |  | 
|---|
| 260 |  | 
|---|
| 261 |  | 
|---|