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 QUALIFIED $(TARGET_KERNEL_ARCH):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 if $(TARGET_BOOT_PLATFORM) = efi { 125 # we need to use the 64-bit libsupc++.a built by the cross-compiler 126 return $(TARGET_BOOT_LIBSUPC++) ; 127 } else { 128 # we need to use the 32-bit libsupc++.a built by the cross-compiler 129 return $(TARGET_BOOT_32_LIBSUPC++) ; 130 } 131 # TODO: ideally, we would build this as part of gcc_syslibs_devel, 132 # but that isn't currently possible, as that would require 133 # 32-bit support (libraries and glue-code) on x86_64-Haiku. 134 } 135 # no special boot version of libsupc++.a needed, so we return 136 # libsupc++-kernel.a from the gcc_syslibs_devel build feature. 137 local flags ; 138 if $(asPath) = true { 139 flags += path ; 140 } 141 if $(TARGET_PACKAGING_ARCH) = arm { 142 return [ 143 BuildFeatureAttribute gcc_syslibs_devel 144 : libsupc++-boot.a : $(flags) 145 ] ; 146 } 147 return [ 148 BuildFeatureAttribute gcc_syslibs_devel 149 : libsupc++-kernel.a : $(flags) 150 ] ; 151 } else { 152 # There is no libsupc++-boot.a for non-Haiku target platform 153 } 154} 155 156 157rule TargetLibgcc asPath 158{ 159 # TargetLibgcc [ <asPath> ] 160 # 161 # Returns the default libgcc(s) for the target. On x86_gcc2, this is the 162 # static libgcc, on everything else this will return the shared libgcc_s 163 # followed by the static libgcc (both are needed as they do not contain 164 # the same set of symbols). 165 # Invoking with <asPath> = true will return the full library path. 166 167 if $(TARGET_PLATFORM) = haiku { 168 local flags ; 169 if $(asPath) = true { 170 flags += path ; 171 } 172 if $(TARGET_PACKAGING_ARCH) = x86_gcc2 { 173 # return libgcc.a from the gcc_syslibs_devel build feature. 174 return [ 175 BuildFeatureAttribute gcc_syslibs_devel : libgcc.a : $(flags) 176 ] ; 177 } else { 178 # return libgcc_s.so from the gcc_syslibs build feature and libgcc.a 179 # from the gcc_syslibs_devel build feature. 180 return [ 181 BuildFeatureAttribute gcc_syslibs : libgcc_s.so.1 : $(flags) 182 ] [ 183 BuildFeatureAttribute gcc_syslibs_devel : libgcc.a : $(flags) 184 ] ; 185 } 186 } else { 187 # TODO: return libgcc for non-Haiku target platform if needed 188 } 189} 190 191 192rule TargetStaticLibgcc asPath 193{ 194 # TargetStaticLibgcc [ <asPath> ] 195 # 196 # Returns the static libgcc for the target. 197 # Invoking with <asPath> = true will return the full library path. 198 199 if $(TARGET_PLATFORM) = haiku { 200 # return libgcc.a from the gcc_syslibs_devel build feature. 201 local flags ; 202 if $(asPath) = true { 203 flags += path ; 204 } 205 return [ 206 BuildFeatureAttribute gcc_syslibs_devel : libgcc.a : $(flags) 207 ] ; 208 } else { 209 # TODO: return libgcc.a for non-Haiku target platform if needed 210 } 211} 212 213 214rule TargetKernelLibgcc asPath 215{ 216 # TargetKernelLibgcc [ <asPath> ] 217 # 218 # Returns the static kernel libgcc for the target. 219 # Invoking with <asPath> = true will return the full library path. 220 221 if $(TARGET_PLATFORM) = haiku { 222 # return libgcc-kernel.a from the gcc_syslibs_devel build feature. 223 local flags ; 224 if $(asPath) = true { 225 flags += path ; 226 } 227 return [ 228 BuildFeatureAttribute QUALIFIED $(TARGET_KERNEL_ARCH):gcc_syslibs_devel 229 : libgcc-kernel.a : $(flags) 230 ] ; 231 } else { 232 # there is no libgcc-kernel.a for non-Haiku target platform 233 } 234} 235 236 237rule TargetBootLibgcc architecture : asPath 238{ 239 # TargetBootLibgcc [ architecture ] : [ <asPath> ] 240 # 241 # Returns the static bootloader libgcc for the target. 242 # Invoking with <asPath> = true will return the full library path. 243 244 if $(TARGET_PLATFORM) = haiku { 245 if $(architecture) = x86_64 { 246 if $(TARGET_BOOT_PLATFORM) = efi { 247 # we need to use the 64-bit libgcc.a built by the cross-compiler 248 return $(TARGET_BOOT_LIBGCC) ; 249 } else { 250 # we need to use the 32-bit libgcc.a built by the cross-compiler 251 return $(TARGET_BOOT_32_LIBGCC) ; 252 } 253 # TODO: ideally, we would build this as part of gcc_syslibs_devel, 254 # but that isn't currently possible, as that would require 255 # 32-bit support (libraries and glue-code) on x86_64-Haiku. 256 } 257 # no special boot version of libgcc needed, so we return 258 # libgcc-kernel.a from the gcc_syslibs_devel build feature. 259 local flags ; 260 if $(asPath) = true { 261 flags += path ; 262 } 263 if $(architecture) = arm { 264 return [ 265 BuildFeatureAttribute QUALIFIED $(architecture):gcc_syslibs_devel 266 : libgcc-boot.a : $(flags) 267 ] ; 268 } 269 return [ 270 BuildFeatureAttribute QUALIFIED $(architecture):gcc_syslibs_devel 271 : libgcc-kernel.a : $(flags) 272 ] ; 273 } else { 274 # there is no libgcc-boot.a for non-Haiku target platform 275 } 276} 277 278 279rule TargetStaticLibgcceh asPath 280{ 281 # TargetStaticLibgcceh [ <asPath> ] 282 # 283 # Returns the static libgcc_eh for the target. 284 # Invoking with <asPath> = true will return the full library path. 285 286 if $(TARGET_PLATFORM) = haiku { 287 # return libgcc.a from the gcc_syslibs_devel build feature. 288 local flags ; 289 if $(asPath) = true { 290 flags += path ; 291 } 292 return [ 293 BuildFeatureAttribute gcc_syslibs_devel : libgcc_eh.a : $(flags) 294 ] ; 295 } else { 296 # TODO: return libgcc_eh.a for non-Haiku target platform if needed 297 } 298} 299 300 301rule TargetKernelLibgcceh asPath 302{ 303 # TargetKernelLibgcceh [ <asPath> ] 304 # 305 # Returns the static kernel libgcc_eh for the target. 306 # Invoking with <asPath> = true will return the full library path. 307 308 if $(TARGET_PLATFORM) = haiku { 309 # return libgcc_eh-kernel.a from the gcc_syslibs_devel build feature. 310 local flags ; 311 if $(asPath) = true { 312 flags += path ; 313 } 314 return [ 315 BuildFeatureAttribute QUALIFIED $(TARGET_KERNEL_ARCH):gcc_syslibs_devel 316 : libgcc_eh-kernel.a : $(flags) 317 ] ; 318 } else { 319 # there is no libgcc_eh-kernel.a for non-Haiku target platform 320 } 321} 322 323 324rule C++HeaderDirectories architecture 325{ 326 # C++HeaderDirectories 327 # 328 # Returns the c++ header directories to use for the given architecture. 329 330 local c++HeaderDirs ; 331 if $(architecture) = x86_gcc2 { 332 c++HeaderDirs = [ FDirName $(HAIKU_TOP) headers cpp ] ; 333 } else if $(PLATFORM) = bootstrap_stage0 { 334 # Currently, no c++-headers are needed for stage0 of the boostrap. 335 } else { 336 local baseDir = [ 337 BuildFeatureAttribute gcc_syslibs_devel : c++-headers : path 338 ] ; 339 if $(baseDir) { 340 c++HeaderDirs = 341 $(baseDir) 342 [ FDirName $(baseDir) $(HAIKU_GCC_MACHINE_$(architecture)) ] 343 [ FDirName $(baseDir) backward ] 344 [ FDirName $(baseDir) ext ] 345 ; 346 } 347 } 348 349 return $(c++HeaderDirs) ; 350} 351 352rule GccHeaderDirectories architecture 353{ 354 # GccHeaderDirectories 355 # 356 # Returns the gcc header directories to use for the given architecture. 357 358 local gccHeaderDirs ; 359 if $(architecture) = x86_gcc2 { 360 gccHeaderDirs = [ FDirName $(HAIKU_TOP) headers build gcc-2.95.3 ] ; 361 } else if $(PLATFORM) = bootstrap_stage0 { 362 gccHeaderDirs = 363 [ FDirName $(HAIKU_GCC_LIB_DIR_$(architecture)) include ] 364 [ FDirName $(HAIKU_GCC_LIB_DIR_$(architecture)) include-fixed ] 365 ; 366 } else { 367 local baseDir = [ 368 BuildFeatureAttribute gcc_syslibs_devel : gcc-headers : path 369 ] ; 370 if $(baseDir) { 371 gccHeaderDirs = 372 [ FDirName $(baseDir) include ] 373 [ FDirName $(baseDir) include-fixed ] 374 ; 375 } 376 } 377 378 return $(gccHeaderDirs) ; 379} 380