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