1rule Libstdc++ForImage 2{ 3 # Libstdc++ForImage 4 # 5 # Returns the c++-standard-library to be put onto the image. 6 7 if $(TARGET_PACKAGING_ARCH) = x86_gcc2 { 8 # the libstdc++.so for our legacy compiler (needs to be built) 9 return libstdc++.r4.so ; 10 } 11 12 # libstdc++.so for other architectures comes with the gcc_syslibs 13 # package, so there's no library to put onto the image directly. 14 return ; 15} 16 17 18rule TargetLibstdc++ asPath 19{ 20 # TargetLibstdc++ [ <asPath> ] 21 # 22 # Returns the c++-standard-library for the target. 23 # Invoking with <asPath> = true will return the full library path. 24 25 if $(TARGET_PLATFORM) = haiku || $(TARGET_PLATFORM) = libbe_test { 26 if $(TARGET_PACKAGING_ARCH) = x86_gcc2 { 27 # the libstdc++.so for our legacy compiler (needs to be built) 28 return libstdc++.r4.so ; 29 } 30 # return libstdc++.so from the gcc_syslibs build feature. 31 local flags ; 32 if $(asPath) = true { 33 flags += path ; 34 } 35 return [ 36 BuildFeatureAttribute gcc_syslibs : libstdc++.so : $(flags) 37 ] ; 38 } 39 # TODO: return libstdc++.so for non-Haiku target platform if needed 40} 41 42 43rule TargetLibsupc++ asPath 44{ 45 # TargetLibsupc++ [ <asPath> ] 46 # 47 # Returns the c++-support-library for the target. 48 # Invoking with <asPath> = true will return the full library path. 49 50 if $(TARGET_PLATFORM) = haiku { 51 if $(TARGET_PACKAGING_ARCH) = x86_gcc2 { 52 # there is no libsupc++.so for the legacy compiler 53 return ; 54 } 55 # return libstdc++.so (which includes libsupc++) from the gcc_syslibs 56 # build feature. 57 local flags ; 58 if $(asPath) = true { 59 flags += path ; 60 } 61 return [ 62 BuildFeatureAttribute gcc_syslibs : libstdc++.so : $(flags) 63 ] ; 64 } else { 65 # TODO: return libsupc++.so for non-Haiku target platform if needed 66 } 67} 68 69 70rule TargetStaticLibsupc++ asPath 71{ 72 # TargetStaticLibsupc++ [ <asPath> ] 73 # 74 # Returns the static c++-support-library for the target. 75 # Invoking with <asPath> = true will return the full library path. 76 77 if $(TARGET_PLATFORM) = haiku { 78 # return libsupc++.a from the gcc_syslibs_devel build feature. 79 local flags ; 80 if $(asPath) = true { 81 flags += path ; 82 } 83 return [ 84 BuildFeatureAttribute gcc_syslibs_devel : libsupc++.a : $(flags) 85 ] ; 86 } else { 87 # TODO: return libsupc++.a for non-Haiku target platform if needed 88 } 89} 90 91 92rule TargetKernelLibsupc++ asPath 93{ 94 # TargetKernelLibsupc++ [ <asPath> ] 95 # 96 # Returns the static kernel c++-support-library for the target. 97 # Invoking with <asPath> = true will return the full library path. 98 99 if $(TARGET_PLATFORM) = haiku { 100 # return libsupc++-kernel.a from the gcc_syslibs_devel build feature. 101 local flags ; 102 if $(asPath) = true { 103 flags += path ; 104 } 105 return [ 106 BuildFeatureAttribute gcc_syslibs_devel 107 : libsupc++-kernel.a : $(flags) 108 ] ; 109 } else { 110 # There is no libsupc++-kernel.a for non-Haiku target platform 111 } 112} 113 114 115rule TargetBootLibsupc++ asPath 116{ 117 # TargetBootLibsupc++ [ <asPath> ] 118 # 119 # Returns the static bootloader c++-support-library for the target. 120 # Invoking with <asPath> = true will return the full library path. 121 122 if $(TARGET_PLATFORM) = haiku { 123 if $(TARGET_PACKAGING_ARCH) = x86_64 { 124 # we need to use the 32-bit libsupc++.a built by the cross-compiler 125 return $(TARGET_BOOT_LIBSUPC++) ; 126 127 # TODO: ideally, we would build this as part of gcc_syslibs_devel, 128 # but that isn't currently possible, as that would require 129 # 32-bit support (libraries and glue-code) on x86_64-Haiku. 130 } 131 # no special boot version of libsupc++.a needed, so we return 132 # libsupc++-kernel.a from the gcc_syslibs_devel build feature. 133 local flags ; 134 if $(asPath) = true { 135 flags += path ; 136 } 137 return [ 138 BuildFeatureAttribute gcc_syslibs_devel 139 : libsupc++-kernel.a : $(flags) 140 ] ; 141 } else { 142 # There is no libsupc++-boot.a for non-Haiku target platform 143 } 144} 145 146 147rule TargetLibgcc asPath 148{ 149 # TargetLibgcc [ <asPath> ] 150 # 151 # Returns the default libgcc(s) for the target. On x86_gcc2, this is the 152 # static libgcc, on everything else this will return the shared libgcc_s 153 # followed by the static libgcc (both are needed as they do not contain 154 # the same set of symbols). 155 # Invoking with <asPath> = true will return the full library path. 156 157 if $(TARGET_PLATFORM) = haiku { 158 local flags ; 159 if $(asPath) = true { 160 flags += path ; 161 } 162 if $(TARGET_PACKAGING_ARCH) = x86_gcc2 { 163 # return libgcc.a from the gcc_syslibs_devel build feature. 164 return [ 165 BuildFeatureAttribute gcc_syslibs_devel : libgcc.a : $(flags) 166 ] ; 167 } else { 168 # return libgcc_s.so from the gcc_syslibs build feature and libgcc.a 169 # from the gcc_syslibs_devel build feature. 170 return [ 171 BuildFeatureAttribute gcc_syslibs : libgcc_s.so.1 : $(flags) 172 ] [ 173 BuildFeatureAttribute gcc_syslibs_devel : libgcc.a : $(flags) 174 ] ; 175 } 176 } else { 177 # TODO: return libgcc for non-Haiku target platform if needed 178 } 179} 180 181 182rule TargetStaticLibgcc asPath 183{ 184 # TargetStaticLibgcc [ <asPath> ] 185 # 186 # Returns the static libgcc for the target. 187 # Invoking with <asPath> = true will return the full library path. 188 189 if $(TARGET_PLATFORM) = haiku { 190 # return libgcc.a from the gcc_syslibs_devel build feature. 191 local flags ; 192 if $(asPath) = true { 193 flags += path ; 194 } 195 return [ 196 BuildFeatureAttribute gcc_syslibs_devel : libgcc.a : $(flags) 197 ] ; 198 } else { 199 # TODO: return libgcc.a for non-Haiku target platform if needed 200 } 201} 202 203 204rule TargetKernelLibgcc asPath 205{ 206 # TargetKernelLibgcc [ <asPath> ] 207 # 208 # Returns the static kernel libgcc for the target. 209 # Invoking with <asPath> = true will return the full library path. 210 211 if $(TARGET_PLATFORM) = haiku { 212 # return libgcc-kernel.a from the gcc_syslibs_devel build feature. 213 local flags ; 214 if $(asPath) = true { 215 flags += path ; 216 } 217 return [ 218 BuildFeatureAttribute gcc_syslibs_devel 219 : libgcc-kernel.a : $(flags) 220 ] ; 221 } else { 222 # there is no libgcc-kernel.a for non-Haiku target platform 223 } 224} 225 226 227rule TargetBootLibgcc asPath 228{ 229 # TargetBootLibgcc [ <asPath> ] 230 # 231 # Returns the static bootloader libgcc for the target. 232 # Invoking with <asPath> = true will return the full library path. 233 234 if $(TARGET_PLATFORM) = haiku { 235 if $(TARGET_PACKAGING_ARCH) = x86_64 { 236 # we need to use the 32-bit libgcc.a built by the cross-compiler 237 return $(TARGET_BOOT_LIBGCC) ; 238 239 # TODO: ideally, we would build this as part of gcc_syslibs_devel, 240 # but that isn't currently possible, as that would require 241 # 32-bit support (libraries and glue-code) on x86_64-Haiku. 242 } 243 # no special boot version of libgcc needed, so we return 244 # libgcc-kernel.a from the gcc_syslibs_devel build feature. 245 local flags ; 246 if $(asPath) = true { 247 flags += path ; 248 } 249 return [ 250 BuildFeatureAttribute gcc_syslibs_devel 251 : libgcc-kernel.a : $(flags) 252 ] ; 253 } else { 254 # there is no libgcc-boot.a for non-Haiku target platform 255 } 256} 257 258 259rule TargetStaticLibgcceh asPath 260{ 261 # TargetStaticLibgcceh [ <asPath> ] 262 # 263 # Returns the static libgcc_eh for the target. 264 # Invoking with <asPath> = true will return the full library path. 265 266 if $(TARGET_PLATFORM) = haiku { 267 # return libgcc.a from the gcc_syslibs_devel build feature. 268 local flags ; 269 if $(asPath) = true { 270 flags += path ; 271 } 272 return [ 273 BuildFeatureAttribute gcc_syslibs_devel : libgcc_eh.a : $(flags) 274 ] ; 275 } else { 276 # TODO: return libgcc_eh.a for non-Haiku target platform if needed 277 } 278} 279 280 281rule TargetKernelLibgcceh asPath 282{ 283 # TargetKernelLibgcceh [ <asPath> ] 284 # 285 # Returns the static kernel libgcc_eh for the target. 286 # Invoking with <asPath> = true will return the full library path. 287 288 if $(TARGET_PLATFORM) = haiku { 289 # return libgcc_eh-kernel.a from the gcc_syslibs_devel build feature. 290 local flags ; 291 if $(asPath) = true { 292 flags += path ; 293 } 294 return [ 295 BuildFeatureAttribute gcc_syslibs_devel 296 : libgcc_eh-kernel.a : $(flags) 297 ] ; 298 } else { 299 # there is no libgcc_eh-kernel.a for non-Haiku target platform 300 } 301} 302 303 304rule C++HeaderDirectories architecture 305{ 306 # C++HeaderDirectories 307 # 308 # Returns the c++ header directories to use for the given architecture. 309 310 local c++HeaderDirs ; 311 if $(architecture) = x86_gcc2 { 312 c++HeaderDirs = [ FDirName $(HAIKU_TOP) headers cpp ] ; 313 } else if $(PLATFORM) = bootstrap_stage0 { 314 # Currently, no c++-headers are needed for stage0 of the boostrap. 315 } else { 316 local baseDir = [ 317 BuildFeatureAttribute gcc_syslibs_devel : c++-headers : path 318 ] ; 319 if $(baseDir) { 320 c++HeaderDirs = 321 $(baseDir) 322 [ FDirName $(baseDir) $(HAIKU_GCC_MACHINE_$(architecture)) ] 323 [ FDirName $(baseDir) backward ] 324 [ FDirName $(baseDir) ext ] 325 ; 326 } 327 } 328 329 return $(c++HeaderDirs) ; 330} 331 332rule GccHeaderDirectories architecture 333{ 334 # GccHeaderDirectories 335 # 336 # Returns the gcc header directories to use for the given architecture. 337 338 local gccHeaderDirs ; 339 if $(architecture) = x86_gcc2 { 340 gccHeaderDirs = [ FDirName $(HAIKU_TOP) headers build gcc-2.95.3 ] ; 341 } else if $(PLATFORM) = bootstrap_stage0 { 342 gccHeaderDirs = 343 [ FDirName $(HAIKU_GCC_LIB_DIR_$(architecture)) include ] 344 [ FDirName $(HAIKU_GCC_LIB_DIR_$(architecture)) include-fixed ] 345 ; 346 } else { 347 local baseDir = [ 348 BuildFeatureAttribute gcc_syslibs_devel : gcc-headers : path 349 ] ; 350 if $(baseDir) { 351 gccHeaderDirs = 352 [ FDirName $(baseDir) include ] 353 [ FDirName $(baseDir) include-fixed ] 354 ; 355 } 356 } 357 358 return $(gccHeaderDirs) ; 359} 360