1 2# Variable naming conventions: 3# TARGET_*: A build system variable specifying a property for building for 4# the target platform (usually Haiku). E.g. TARGET_CC specifies the 5# compiler when building a target for the target platform. 6# HOST_*: A build system variable specifying a property of the platform 7# hosting the build. E.g. HOST_CC specifies the compiler when 8# building a target for the host platform (a build tool for 9# instance). 10# HAIKU_*: A build system variable specifying a build system property. Usually 11# directory paths and the like. 12 13 14#pragma mark - container settings 15 16# Haiku image 17HAIKU_IMAGE_CONTAINER_NAME = haiku-image-container ; 18HAIKU_CONTAINER_GRIST on $(HAIKU_IMAGE_CONTAINER_NAME) = HaikuImage ; 19HAIKU_INCLUDE_IN_CONTAINER_VAR on $(HAIKU_IMAGE_CONTAINER_NAME) 20 = HAIKU_INCLUDE_IN_IMAGE ; 21HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_IMAGE_CONTAINER_NAME) 22 = HAIKU_IMAGE_INSTALL_TARGETS ; 23 24# network boot archive 25HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME = haiku-netboot-archive-container ; 26HAIKU_CONTAINER_GRIST on $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME) 27 = NetBootArchive ; 28# HAIKU_INCLUDE_IN_CONTAINER_VAR -- update only mode not supported 29HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME) 30 = HAIKU_NET_BOOT_ARCHIVE_INSTALL_TARGETS ; 31 32# boot floppy 33HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME = haiku-boot-floppy-container ; 34HAIKU_CONTAINER_GRIST on $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME) = FloppyBootImage ; 35# HAIKU_INCLUDE_IN_CONTAINER_VAR -- update only mode not supported 36HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME) 37 = HAIKU_FLOPPY_BOOT_IMAGE_INSTALL_TARGETS ; 38 39# boot CD image 40HAIKU_CD_BOOT_IMAGE_CONTAINER_NAME = haiku-boot-cd-container ; 41HAIKU_CONTAINER_GRIST on $(HAIKU_CD_BOOT_IMAGE_CONTAINER_NAME) = CDBootImage ; 42# HAIKU_INCLUDE_IN_CONTAINER_VAR -- update only mode not supported 43HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_CD_BOOT_IMAGE_CONTAINER_NAME) 44 = HAIKU_CD_BOOT_IMAGE_INSTALL_TARGETS ; 45 46# Haiku image/install defaults 47HAIKU_DEFAULT_IMAGE_NAME = haiku.image ; 48HAIKU_DEFAULT_IMAGE_DIR = $(HAIKU_OUTPUT_DIR) ; 49HAIKU_DEFAULT_VMWARE_IMAGE_NAME = haiku.vmdk ; 50HAIKU_DEFAULT_INSTALL_DIR = /Haiku ; 51HAIKU_DEFAULT_IMAGE_SIZE ?= 100 ; # 100 MB 52 53 54# analyze an optionally replace jam's target parameters 55HAIKU_ORIGINAL_JAM_TARGETS = $(JAM_TARGETS) ; 56HAIKU_BUILD_PROFILE = ; 57if $(JAM_TARGETS) { 58 switch $(JAM_TARGETS[1]) { 59 # If the target to be built is "all" (i.e. the default) and we're in 60 # the output directory, the root directory of the build system, or 61 # in "src/", we change the target to be built to "haiku-image". 62 case all : { 63 if ! $(INVOCATION_SUBDIR) || $(INVOCATION_SUBDIR) = src { 64 JAM_TARGETS = haiku-image ; 65 } 66 } 67 68 # The "run" target allows for running arbitrary command lines containing 69 # build system targets, which are built and replaced accordingly. 70 case run : { 71 if $(JAM_TARGETS[2]) { 72 JAM_TARGETS = [ RunCommandLine $(JAM_TARGETS[2-]) ] ; 73 } else { 74 Exit "\"jam run\" requires parameters!" ; 75 } 76 } 77 78 # A target starting with "@" is a build profile. 79 case @* : { 80 HAIKU_BUILD_PROFILE = [ Match "@(.*)" : $(JAM_TARGETS[1]) ] ; 81 HAIKU_BUILD_PROFILE_ACTION = $(JAM_TARGETS[2]:E=build) ; 82 HAIKU_BUILD_PROFILE_PARAMETERS = $(JAM_TARGETS[3-]) ; 83 HAIKU_BUILD_PROFILE_DEFINED = ; 84 } 85 86 case * : { 87 # "update-image", "update-vmware-image", and "update-install" 88 # targets allow for updating only specific targets in the 89 # image/installation dir. 90 if $(JAM_TARGETS[1]) in update-image update-vmware-image 91 update-install { 92 SetUpdateHaikuImageOnly 1 ; 93 HAIKU_INCLUDE_IN_IMAGE on $(JAM_TARGETS[2-]) = 1 ; 94 95 if $(JAM_TARGETS[1]) = update-image { 96 JAM_TARGETS = haiku-image ; 97 } else if $(JAM_TARGETS[1]) = update-vmware-image { 98 JAM_TARGETS = haiku-vmware-image ; 99 } else { 100 JAM_TARGETS = install-haiku ; 101 } 102 } 103 } 104 } 105} 106 107 108# Include BuildConfig/Timezones/libgccObjects 109{ 110 local buildConfig = [ GLOB $(HAIKU_BUILD_OUTPUT_DIR) : BuildConfig ] ; 111 local timezones = [ GLOB $(HAIKU_BUILD_OUTPUT_DIR) : Timezones ] ; 112 local libgccObjects = [ GLOB $(HAIKU_BUILD_OUTPUT_DIR) : libgccObjects ] ; 113 114 if ! $(buildConfig) { 115 ECHO "No `BuildConfig' found in $(HAIKU_BUILD_OUTPUT_DIR)!" ; 116 EXIT "Run ./configure in the source tree's root directory first!" ; 117 } 118 if ! ( $(timezones) && $(libgccObjects) ) { 119 ECHO "No `Timezones' or `libgccObjects' found in $(HAIKU_BUILD_OUTPUT_DIR)!" ; 120 EXIT "Please run ./configure in the source tree's root directory again!" ; 121 } 122 123 LOCATE on BuildConfig = $(HAIKU_BUILD_OUTPUT_DIR) ; 124 LOCATE on Timezones = $(HAIKU_BUILD_OUTPUT_DIR) ; 125 LOCATE on libgccObjects = $(HAIKU_BUILD_OUTPUT_DIR) ; 126 127 include BuildConfig ; 128 include Timezones ; 129 include libgccObjects ; 130} 131 132 133# supported debug levels 134HAIKU_DEBUG_LEVELS = 0 1 2 3 4 5 ; 135 136# BeOS, BONE, Dan0 compatible platforms 137HAIKU_BEOS_COMPATIBLE_PLATFORMS = haiku r5 bone dano haiku_host ; 138HAIKU_BONE_COMPATIBLE_PLATFORMS = haiku bone dano haiku_host ; 139HAIKU_DANO_COMPATIBLE_PLATFORMS = haiku dano haiku_host ; 140HAIKU_HAIKU_COMPATIBLE_PLATFORMS = haiku haiku_host ; 141 142# configuration header directories 143HAIKU_CONFIG_HEADERS = [ FDirName $(HAIKU_TOP) build user_config_headers ] 144 [ FDirName $(HAIKU_TOP) build config_headers ] ; 145 146 147#pragma mark - 148 149# haiku target platform settings 150 151# analyze GCC version 152HAIKU_GCC_VERSION = [ FAnalyzeGCCVersion HAIKU_GCC_RAW_VERSION ] ; 153 154# enable GCC -pipe option, if requested 155if $(HAIKU_USE_GCC_PIPE) = 1 { 156 HAIKU_GCC_BASE_FLAGS = -pipe ; 157} 158 159# disable strict aliasing on anything newer than gcc 2 as it may lead to 160# unexpected results. also disable the tree-vrp (value range propagation) 161# optimization for now as with the current gcc4 version we are using this 162# results in some broken code. 163# TODO: remove the -fno-strict-aliasing option when all code has been 164# analyzed/fixed with regard to aliasing. 165# TODO: retest/remove the -fno-tree-vrp option as soon as we have updated our 166# gcc4 compiler. 167if $(HAIKU_GCC_VERSION[1]) >= 3 { 168 HAIKU_GCC_BASE_FLAGS += -fno-strict-aliasing -fno-tree-vrp ; 169} 170 171# override gcc 2.95.3's header directory -- strictly necessary only when using 172# the BeOS native compiler (since its headers are incompatible), but it doesn't 173# harm for the cross-compiler either. 174if $(HAIKU_GCC_VERSION[1]) = 2 { 175 HAIKU_GCC_HEADERS_DIR = [ FDirName $(HAIKU_TOP) headers build gcc-2.95.3 ] ; 176} 177 178# initial state for flags etc. 179HAIKU_C++ ?= $(HAIKU_CC) ; 180HAIKU_LINK = $(HAIKU_CC) ; 181HAIKU_LINKFLAGS = $(HAIKU_GCC_BASE_FLAGS) ; 182 183HAIKU_HDRS = [ FStandardHeaders ] ; 184HAIKU_CCFLAGS = $(HAIKU_GCC_BASE_FLAGS) -nostdinc ; 185HAIKU_C++FLAGS = $(HAIKU_GCC_BASE_FLAGS) -nostdinc ; 186HAIKU_KERNEL_CCFLAGS = $(HAIKU_GCC_BASE_FLAGS) ; 187HAIKU_KERNEL_C++FLAGS = $(HAIKU_GCC_BASE_FLAGS) ; 188HAIKU_DEFINES = __HAIKU__ ; 189 190# distro compatibility level defines 191HAIKU_DISTRO_COMPATIBILITY ?= "default" ; 192switch $(HAIKU_DISTRO_COMPATIBILITY) { 193 case official : HAIKU_DEFINES += HAIKU_DISTRO_COMPATIBILITY_OFFICIAL ; 194 case compatible : HAIKU_DEFINES += HAIKU_DISTRO_COMPATIBILITY_COMPATIBLE ; 195 case "default" : HAIKU_DEFINES += HAIKU_DISTRO_COMPATIBILITY_DEFAULT ; 196 case * : Exit "Invalid value for HAIKU_DISTRO_COMPATIBILITY:" 197 $(HAIKU_DISTRO_COMPATIBILITY) ; 198} 199 200# analyze the gcc machine spec to determine HAIKU_CPU 201switch $(HAIKU_GCC_MACHINE) { 202 case i386-* : HAIKU_CPU = x86 ; 203 case i486-* : HAIKU_CPU = x86 ; 204 case i586-* : HAIKU_CPU = x86 ; 205 case i686-* : HAIKU_CPU = x86 ; 206 case powerpc-* : HAIKU_CPU = ppc ; 207 case m68k-* : HAIKU_CPU = m68k ; 208 case * : Exit "Unsupported gcc target machine:" $(HAIKU_GCC_MACHINE) ; 209} 210 211switch $(HAIKU_CPU) { 212 case ppc : 213 { 214 HAIKU_DEFINES += __POWERPC__ ; 215 HAIKU_BOOT_PLATFORM = openfirmware ; 216 } 217 case x86 : 218 { 219 HAIKU_DEFINES += __INTEL__ ; 220 HAIKU_BOOT_PLATFORM = bios_ia32 ; 221 } 222 case m68k : 223 { 224 HAIKU_DEFINES += __M68K__ ; 225 HAIKU_BOOT_PLATFORM = atari_m68k ; 226 } 227 case * : 228 Exit "Currently unsupported target CPU:" $(HAIKU_CPU) ; 229} 230HAIKU_ARCH ?= $(HAIKU_CPU) ; 231HAIKU_ARCH_MACRO_DEFINE = ARCH_$(HAIKU_ARCH) ; 232HAIKU_DEFINES += $(HAIKU_ARCH_MACRO_DEFINE) ; 233 234# directories 235HAIKU_OBJECT_BASE_DIR = [ FDirName $(HAIKU_OBJECT_DIR) haiku ] ; 236HAIKU_COMMON_ARCH_OBJECT_DIR = [ FDirName $(HAIKU_OBJECT_BASE_DIR) common ] ; 237HAIKU_ARCH_OBJECT_DIR = [ FDirName $(HAIKU_OBJECT_BASE_DIR) $(HAIKU_ARCH) ] ; 238HAIKU_COMMON_DEBUG_OBJECT_DIR = [ FDirName $(HAIKU_ARCH_OBJECT_DIR) common ] ; 239HAIKU_DEBUG_0_OBJECT_DIR = [ FDirName $(HAIKU_ARCH_OBJECT_DIR) release ] ; 240 241local level ; 242for level in $(HAIKU_DEBUG_LEVELS[2-]) { 243 HAIKU_DEBUG_$(level)_OBJECT_DIR 244 = [ FDirName $(HAIKU_ARCH_OBJECT_DIR) debug_$(level) ] ; 245} 246 247# set variables for gcc header options 248SetIncludePropertiesVariables HAIKU ; 249 250# assembler flags 251HAIKU_ASFLAGS = ; 252 253# C/C++ flags 254HAIKU_CCFLAGS += -Wno-multichar ; 255HAIKU_C++FLAGS += -Wno-multichar ; 256 257HAIKU_KERNEL_CCFLAGS += -finline -fno-builtin -Wno-multichar 258 -DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) ; 259HAIKU_KERNEL_C++FLAGS += -finline -fno-builtin -fno-exceptions -Wno-multichar 260 -DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) ; 261HAIKU_KERNEL_DEFINES += _KERNEL_MODE ; 262 263if $(HAIKU_GCC_VERSION[1]) >= 3 { 264 HAIKU_KERNEL_C++FLAGS += -fno-use-cxa-atexit ; 265} 266 267if $(HAIKU_GCC_VERSION[1]) >= 4 { 268 HAIKU_C++FLAGS += -Wno-deprecated ; 269} 270 271HAIKU_KERNEL_PIC_CCFLAGS = -fno-pic ; 272HAIKU_KERNEL_PIC_LINKFLAGS = ; 273if $(HAIKU_ARCH) = ppc { 274 # Build a position independent PPC kernel. We need to be able to relocate 275 # the kernel, since the virtual address space layout at boot time is not 276 # fixed. 277 HAIKU_KERNEL_PIC_CCFLAGS = -fPIE ; 278 HAIKU_KERNEL_PIC_LINKFLAGS = -shared -fPIE ; 279} 280 281# If the environment variable DEBUG_PRINTF is defined we define an equally 282# named macro to the variable value. Some components use the macro to allow 283# another function than printf() to print the debug output. The variable should 284# be set to the name of the alternative function. 285# 286if $(DEBUG_PRINTF) { 287 HAIKU_CCFLAGS += [ FDefines DEBUG_PRINTF=$(DEBUG_PRINTF) ] ; 288 HAIKU_C++FLAGS += [ FDefines DEBUG_PRINTF=$(DEBUG_PRINTF) ] ; 289} 290 291# warning flags 292HAIKU_WARNING_CCFLAGS = -Wall -Wno-trigraphs -Wmissing-prototypes -Wpointer-arith -Wcast-align 293 -Wsign-compare ; 294HAIKU_WARNING_C++FLAGS = -Wall -Wno-trigraphs -Wno-ctor-dtor-privacy 295 -Woverloaded-virtual -Wpointer-arith -Wcast-align -Wsign-compare ; 296 297HAIKU_KERNEL_WARNING_CCFLAGS = -Wall -Wno-trigraphs -Wmissing-prototypes ; 298HAIKU_KERNEL_WARNING_C++FLAGS = -Wall -Wno-trigraphs ; 299 300# debug flags 301HAIKU_DEBUG_FLAGS ?= -ggdb ; 302 303# debug 0: suppress asserts 304HAIKU_DEBUG_0_CCFLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ; 305HAIKU_DEBUG_0_C++FLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ; 306 307HAIKU_KERNEL_DEBUG_0_CCFLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ; 308HAIKU_KERNEL_DEBUG_0_C++FLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ; 309 310local level ; 311for level in $(HAIKU_DEBUG_LEVELS[2-]) { 312 local flags = $(HAIKU_DEBUG_FLAGS) [ FDefines DEBUG=$(level) ] ; 313 HAIKU_DEBUG_$(level)_CCFLAGS = $(flags) ; 314 HAIKU_DEBUG_$(level)_C++FLAGS = $(flags) ; 315 HAIKU_KERNEL_DEBUG_$(level)_CCFLAGS = $(flags) ; 316 HAIKU_KERNEL_DEBUG_$(level)_C++FLAGS = $(flags) ; 317} 318 319if $(HAIKU_GCC_VERSION[1]) >= 3 { 320 # TODO: Temporary work-around. Should be defined in the compiler specs 321 HAIKU_LINKFLAGS += -Xlinker --no-undefined ; 322} else { 323 HAIKU_DEFINES += _BEOS_R5_COMPATIBLE_ ; 324} 325 326# private kernel headers to be used when compiling kernel code 327HAIKU_PRIVATE_KERNEL_HEADERS = 328 [ PrivateHeaders $(DOT) kernel libroot 329 kernel/boot/platform/$(HAIKU_BOOT_PLATFORM) ] 330 [ ArchHeaders $(HAIKU_ARCH) ] 331; 332 333# Add some grist to the libgcc objects 334HAIKU_GCC_LIBGCC_OBJECTS = $(HAIKU_GCC_LIBGCC_OBJECTS:G=libgcc) ; 335 336# the C++ library 337if $(HAIKU_SHARED_LIBSTDC++) { 338 HAIKU_LIBSTDC++ = $(HAIKU_SHARED_LIBSTDC++) ; 339} else if $(HAIKU_STATIC_LIBSTDC++) { 340 HAIKU_LIBSTDC++ = $(HAIKU_STATIC_LIBSTDC++) ; 341} else { 342 HAIKU_LIBSTDC++ = libstdc++.r4.so ; 343} 344 345# the C++ support library 346if $(HAIKU_SHARED_LIBSUPC++) { 347 HAIKU_LIBSUPC++ = $(HAIKU_SHARED_LIBSUPC++) ; 348} else if $(HAIKU_STATIC_LIBSUPC++) { 349 HAIKU_LIBSUPC++ = $(HAIKU_STATIC_LIBSUPC++) ; 350} else { 351 HAIKU_LIBSUPC++ = ; 352} 353 354# network libraries 355HAIKU_NETWORK_LIBS = network ; 356HAIKU_NETAPI_LIB = network ; 357HAIKU_SELECT_UNAME_ETC_LIB = ; # libroot, against which we link anyway 358 359# library and executable glue code 360local commonGlueCode = 361 <src!system!glue>init_term_dyn.o 362 <src!system!glue!arch!$(HAIKU_ARCH)>crti.o 363 <src!system!glue!arch!$(HAIKU_ARCH)>crtn.o 364; 365HAIKU_LIBRARY_BEGIN_GLUE_CODE = 366 <src!system!glue!arch!$(HAIKU_ARCH)>crti.o 367 crtbegin.o 368 <src!system!glue>init_term_dyn.o 369; 370HAIKU_LIBRARY_END_GLUE_CODE = 371 # TODO: For the time being always link against libsupc++.a. 372 $(HAIKU_STATIC_LIBSUPC++) 373 crtend.o 374 <src!system!glue!arch!$(HAIKU_ARCH)>crtn.o 375; 376HAIKU_EXECUTABLE_BEGIN_GLUE_CODE = 377 <src!system!glue!arch!$(HAIKU_ARCH)>crti.o 378 crtbegin.o 379 <src!system!glue>start_dyn.o 380 <src!system!glue>init_term_dyn.o 381; 382HAIKU_EXECUTABLE_END_GLUE_CODE = $(HAIKU_LIBRARY_END_GLUE_CODE) ; 383HAIKU_KERNEL_ADDON_BEGIN_GLUE_CODE = crtbegin.o ; 384HAIKU_KERNEL_ADDON_END_GLUE_CODE = $(HAIKU_GCC_LIBGCC) crtend.o ; 385 386SEARCH on crtbegin.o crtend.o = $(HAIKU_GCC_LIB_DIR) ; 387 388HAIKU_EXECUTABLE_MIME_TYPE = "application/x-vnd.Be-elfexecutable" ; 389 390# TODO: The version stuff should probably go into a separate file and be made 391# available as macro, too. 392# Set our version number if not already set and mark it as a developer build 393if ! $(HAIKU_BUILD_VERSION) { 394 HAIKU_BUILD_VERSION ?= "1 0 0 a 1" ; 395 HAIKU_BUILD_DESCRIPTION ?= "Developer Build" ; 396} 397 398# If HAIKU_BUILD_VERSION is set, but HAIKU_BUILD_DESCRIPTION isn't, mark it as 399# an unknown build. 400HAIKU_BUILD_DESCRIPTION ?= "Unknown Build" ; 401 402# init library name map 403{ 404 local i ; 405 for i in be game GL mail media midi midi2 network netapi opengl screensaver root z 406 textencoding tracker translation { 407 HAIKU_LIBRARY_NAME_MAP_$(i) = lib$(i).so ; 408 } 409 HAIKU_LIBRARY_NAME_MAP_libstdc++ = $(HAIKU_LIBSTDC++) ; 410 HAIKU_LIBRARY_NAME_MAP_input_server = <nogrist>input_server ; 411} 412 413 414#pragma mark - 415 416# host platform settings 417 418# enable GCC -m32 option, if requested 419if $(HAIKU_HOST_USE_32BIT) = 1 { 420 HOST_GCC_BASE_FLAGS = -m32 ; 421} 422 423 424# save jam's variables for the build platform 425HOST_AR ?= $(AR) ; 426HOST_CC ?= $(CC) ; 427HOST_C++ ?= $(C++) ; 428HOST_LINK ?= $(LINK) ; 429HOST_LD ?= ld ; # TODO: Fix this! 430HOST_OBJCOPY ?= objcopy ; # 431HOST_RANLIB ?= $(RANLIB) ; 432HOST_CPPFLAGS ?= $(CPPFLAGS) ; 433HOST_CCFLAGS ?= $(HOST_GCC_BASE_FLAGS) $(CCFLAGS) ; 434HOST_C++FLAGS ?= $(HOST_GCC_BASE_FLAGS) $(C++FLAGS) ; 435HOST_LDFLAGS ?= $(HOST_GCC_BASE_FLAGS) $(LDFLAGS) ; 436HOST_LINKFLAGS ?= $(HOST_GCC_BASE_FLAGS) $(LINKFLAGS) ; 437HOST_DEFINES ?= $(DEFINES) ; 438HOST_HDRS ?= $(HDRS) ; 439 440 441# split up HOST_AR into the command name and flags 442HOST_AR = [ Match "([^ ]*) *(.*)" : $(HOST_AR[1]) ] 443 $(HOST_AR[2-]) ; 444HOST_ARFLAGS = $(HOST_AR[2-]) ; 445HOST_AR = $(HOST_AR[1]) ; 446HOST_UNARFLAGS ?= x ; 447 448# check the host platform compatibility 449SetPlatformCompatibilityFlagVariables HOST_PLATFORM : HOST : host 450 : linux freebsd darwin ; 451 452if $(HOST_PLATFORM) = linux || $(HOST_PLATFORM) = freebsd 453 || $(HOST_PLATFORM) = darwin { 454 # don't use lex: otherwise rc will not work correctly 455 if $(LEX) = lex { 456 LEX = flex ; 457 } 458} 459 460HOST_CPU ?= $(OSPLAT:L) ; 461 462HOST_ARCH ?= $(HOST_CPU) ; 463HOST_ARCH_MACRO_DEFINE = ARCH_$(HOST_CPU) ; 464 465# directories 466HOST_OBJECT_BASE_DIR = [ FDirName $(HAIKU_OBJECT_DIR) $(HOST_PLATFORM) ] ; 467HOST_COMMON_ARCH_OBJECT_DIR = [ FDirName $(HOST_OBJECT_BASE_DIR) common ] ; 468HOST_ARCH_OBJECT_DIR = [ FDirName $(HOST_OBJECT_BASE_DIR) $(HOST_ARCH) ] ; 469HOST_COMMON_DEBUG_OBJECT_DIR = [ FDirName $(HOST_ARCH_OBJECT_DIR) common ] ; 470HOST_DEBUG_0_OBJECT_DIR = [ FDirName $(HOST_ARCH_OBJECT_DIR) release ] ; 471 472local level ; 473for level in $(HAIKU_DEBUG_LEVELS[2-]) { 474 HOST_DEBUG_$(level)_OBJECT_DIR 475 = [ FDirName $(HOST_ARCH_OBJECT_DIR) debug_$(level) ] ; 476} 477 478# analyze GCC version 479HOST_GCC_VERSION = [ FAnalyzeGCCVersion HOST_GCC_RAW_VERSION ] ; 480 481# set variables for gcc header options 482SetIncludePropertiesVariables HOST ; 483 484# assembler flags 485HOST_ASFLAGS = ; 486 487# C/C++ flags 488HOST_CCFLAGS += -Wno-multichar ; 489HOST_C++FLAGS += -Wno-multichar ; 490 491HOST_PIC_CCFLAGS += -fPIC ; 492HOST_PIC_C++FLAGS += -fPIC ; 493 494HOST_KERNEL_CCFLAGS += $(HOST_GCC_BASE_FLAGS) -finline -fno-builtin 495 -DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) -D_KERNEL_MODE ; 496HOST_KERNEL_C++FLAGS += $(HOST_GCC_BASE_FLAGS) -finline -fno-builtin 497 -fno-exceptions -DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) -D_KERNEL_MODE ; 498HOST_KERNEL_DEFINES += _KERNEL_MODE ; 499 500HOST_KERNEL_PIC_CCFLAGS = -fno-pic ; 501HOST_KERNEL_PIC_LINKFLAGS = ; 502if $(HOST_ARCH) = ppc { 503 # Build a position independent PPC kernel. We need to be able to relocate 504 # the kernel, since the virtual address space layout at boot time is not 505 # fixed. 506 HOST_KERNEL_PIC_CCFLAGS = -fPIE ; 507 HOST_KERNEL_PIC_LINKFLAGS = -shared -fPIE ; 508} 509 510# warning flags 511HOST_WARNING_CCFLAGS = -Wall -Wno-trigraphs -Wmissing-prototypes -Wpointer-arith -Wcast-align 512 -Wsign-compare ; 513HOST_WARNING_C++FLAGS = -Wall -Wno-trigraphs -Wno-ctor-dtor-privacy 514 -Woverloaded-virtual -Wpointer-arith -Wcast-align -Wsign-compare ; 515 516HOST_KERNEL_WARNING_CCFLAGS = -Wall -Wno-trigraphs -Wmissing-prototypes ; 517HOST_KERNEL_WARNING_C++FLAGS = -Wall -Wno-trigraphs ; 518 519# debug flags 520switch $(HOST_PLATFORM) { 521 case haiku : HOST_DEBUG_FLAGS ?= -ggdb ; 522 case haiku_host : HOST_DEBUG_FLAGS ?= -ggdb ; 523 case linux : HOST_DEBUG_FLAGS ?= -ggdb ; 524 case freebsd : HOST_DEBUG_FLAGS ?= -ggdb ; 525 case darwin : HOST_DEBUG_FLAGS ?= -ggdb ; 526 case * : HOST_DEBUG_FLAGS ?= -g ; 527} 528 529# debug 0: suppress asserts 530HOST_DEBUG_0_CCFLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ; 531HOST_DEBUG_0_C++FLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ; 532 533HOST_KERNEL_DEBUG_0_CCFLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ; 534HOST_KERNEL_DEBUG_0_C++FLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ; 535 536local level ; 537for level in $(HAIKU_DEBUG_LEVELS[2-]) { 538 local flags = $(HOST_DEBUG_FLAGS) [ FDefines DEBUG=$(level) ] ; 539 HOST_DEBUG_$(level)_CCFLAGS = $(flags) ; 540 HOST_DEBUG_$(level)_C++FLAGS = $(flags) ; 541 HOST_KERNEL_DEBUG_$(level)_CCFLAGS = $(flags) ; 542 HOST_KERNEL_DEBUG_$(level)_C++FLAGS = $(flags) ; 543} 544 545# ld flags 546if $(HOST_ARCH) = x86 && $(HAIKU_HOST_USE_32BIT) = 1 { 547 HOST_LDFLAGS += -melf_i386 ; 548} 549 550# private kernel headers do be used when compiling kernel code 551HOST_PRIVATE_KERNEL_HEADERS = ; 552 553# under BeOS use copyattr instead of cp 554if $(HOST_PLATFORM_BEOS_COMPATIBLE) 555{ 556 CP = copyattr --data ; 557} 558 559HOST_DEFINES += $(HOST_ARCH_MACRO_DEFINE) ; 560HOST_DEFINES += _NO_INLINE_ASM ; 561 562if $(HOST_PLATFORM_BEOS_COMPATIBLE) { 563 # TODO: That's obviously not correct, but in the way the COMPILE_FOR_R5 564 # macro is used, it actually seems to mean r5/bone/dano. 565 # TODO: Deprecated. Remove! 566 HOST_DEFINES += COMPILE_FOR_R5 ; 567} 568 569# for builds of tools in the current environment 570HOST_BUILD_COMPATIBILITY_LIB_DIR = [ FDirName $(HOST_OBJECT_BASE_DIR) lib ] ; 571 572# For the generic attributes emulation: Target rm_attrs -- rm replacement that 573# also removes the attributes. 574HOST_RM_ATTRS_TARGET = ; 575 576if $(HOST_PLATFORM_BEOS_COMPATIBLE) { 577 HOST_LIBSTDC++ = stdc++.r4 ; 578 HOST_LIBROOT = root ; 579 HOST_STATIC_LIBROOT = $(HOST_LIBROOT) ; 580 HOST_LIBBE = be ; 581 HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR = ; 582 HOST_LIBRARY_NAME_MAP_input_server = /system/servers/input_server ; 583} else { 584 HOST_LIBSTDC++ = stdc++ ; 585 HOST_LIBROOT = libroot_build.so ; 586 HOST_STATIC_LIBROOT = libroot_build.a ; 587 HOST_LIBBE = libbe_build.so ; 588 HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR 589 = "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(HOST_BUILD_COMPATIBILITY_LIB_DIR)" ; 590 591 # the C++ support library 592 if $(HOST_GCC_VERSION[1]) < 3 { 593 HOST_LIBSUPC++ = ; 594 } else { 595 HOST_LIBSUPC++ = supc++ ; 596 } 597 598 if $(HOST_PLATFORM) = darwin { 599 # part of the C++ runtime lives in libstdc++ on Darwin 600 HOST_LIBSUPC++ = gcc_s.1 stdc++ ; 601 HOST_LIBSTDC++ = ; 602 } 603 604 # Unlike glibc FreeBSD's libc doesn't have built-in regex support. 605 if $(HOST_PLATFORM) = freebsd { 606 HOST_LIBROOT += /usr/lib/libgnuregex.so ; 607 HOST_STATIC_LIBROOT += /usr/lib/libgnuregex.so ; 608 } else if $(HOST_PLATFORM) = darwin { 609 HOST_LIBROOT += /opt/local/lib/libgnuregex.dylib ; 610 HOST_STATIC_LIBROOT += /opt/local/lib/libgnuregex.dylib ; 611 } 612 613 614 # The BeOS compilers define __INTEL__ respectively __POWERPC__. On the 615 # build platform we need to make sure, this is also defined. 616 if $(HOST_CPU) = x86 { 617 HOST_DEFINES += __INTEL__ ; 618 } else if $(HOST_CPU) = ppc { 619 HOST_DEFINES += __POWERPC__ ; 620 } else if $(HOST_CPU) = m68k { 621 HOST_DEFINES += __M68K__ ; 622 } 623 624 # Supposing this is a glibc platform, let's try to get features like large 625 # file support, ISO C 99 definitions, etc. On some platforms we need to 626 # request 64 bit off_t support explicitely. 627 HOST_DEFINES += _GNU_SOURCE _FILE_OFFSET_BITS=64 ; 628 629 # On Linux with xattr support we can use it for our attribute emulation, 630 # which is somewhat more robust. 631 if $(HAIKU_HOST_USE_XATTR) = 1 { 632 HOST_DEFINES += HAIKU_HOST_USE_XATTR ; 633 } else { 634 # Otherwise the generic attribute emulation is used, which uses a 635 # directory per file to store its attribute. We need to redefine RM so 636 # that the attributes are removed as well. We use a wrapper script, which 637 # invokes a build tool. If the build tool hasn't been built yet, the 638 # normal "rm" is used and the attributes are leaked (likely there aren't 639 # any yet). 640 RM = $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) ";" 641 [ FDirName $(HAIKU_TOP) build scripts rm_attrs ] 642 [ FDirName $(HAIKU_OBJECT_DIR) $(HOST_PLATFORM) $(HOST_ARCH) release 643 tools rm_attrs ] -f ; 644 # assumes that rm_attrs is built with debugging disabled 645 HOST_RM_ATTRS_TARGET = <build>rm_attrs ; 646 } 647} 648 649# network libraries 650if $(HOST_PLATFORM_HAIKU_COMPATIBLE) { 651 HOST_NETWORK_LIBS = network ; 652 HOST_NETAPI_LIB = network ; 653 HOST_SELECT_UNAME_ETC_LIB = ; # libroot 654} else if $(HOST_PLATFORM_BONE_COMPATIBLE) { 655 HOST_NETWORK_LIBS = socket bind ; 656 HOST_NETAPI_LIB = bnetapi ; 657 HOST_SELECT_UNAME_ETC_LIB = ; # libroot 658} else if $(HOST_PLATFORM_BEOS_COMPATIBLE) { 659 HOST_NETWORK_LIBS = net ; 660 HOST_NETAPI_LIB = netapi ; 661 HOST_SELECT_UNAME_ETC_LIB = net ; 662} else { 663 # Linux,... 664 HOST_NETWORK_LIBS = ; 665 HOST_NETAPI_LIB = ; 666 HOST_SELECT_UNAME_ETC_LIB = ; 667} 668 669# define the executable MIME type 670HOST_EXECUTABLE_MIME_TYPE = "application/x-vnd.Be-elfexecutable" ; 671 672if $(METROWERKS) { 673 # at least parts of Haiku still can be compiled with 674 # the Metrowerks compiler on BeOS/PPC 675 HOST_EXECUTABLE_MIME_TYPE = "application/x-be-executable" ; 676} 677 678# Be API compatibility 679HOST_BE_API_HEADERS = ; 680HOST_BE_API_CCFLAGS = ; 681HOST_BE_API_C++FLAGS = ; 682 683if ! $(HOST_PLATFORM_BEOS_COMPATIBLE) { 684 HOST_BE_API_HEADERS = 685 [ FDirName $(HAIKU_TOP) headers build ] 686 [ FDirName $(HAIKU_TOP) headers build os ] 687 [ FDirName $(HAIKU_TOP) headers build os app ] 688 [ FDirName $(HAIKU_TOP) headers build os drivers ] 689 [ FDirName $(HAIKU_TOP) headers build os kernel ] 690 [ FDirName $(HAIKU_TOP) headers build os interface ] 691 [ FDirName $(HAIKU_TOP) headers build os storage ] 692 [ FDirName $(HAIKU_TOP) headers build os support ] 693 ; 694 HOST_BE_API_CCFLAGS = -include BeOSBuildCompatibility.h ; 695 HOST_BE_API_C++FLAGS = $(HOST_BE_API_CCFLAGS) ; 696} 697 698# Add directory with system headers we need when building something for the host 699# platform, e.g. containing missing POSIX/GNU headers. 700HOST_HDRS += [ FDirName $(HAIKU_TOP) headers build host $(HOST_PLATFORM) ] ; 701 702# For all versions of BeOS also add the common beos directory. 703if $(HOST_PLATFORM) in r5 bone dano { 704 HOST_HDRS += [ FDirName $(HAIKU_TOP) headers build host beos_common ] ; 705} 706 707 708#pragma mark - 709 710# target platform settings 711 712# check the target platform compatibility 713SetPlatformCompatibilityFlagVariables TARGET_PLATFORM : TARGET : target ; 714 715# check the compatibility between host and target platform 716if $(TARGET_PLATFORM) != haiku { 717 if ! $(HOST_PLATFORM_($(TARGET_PLATFORM))_COMPATIBLE) { 718 Exit ERROR: The host platform is not compatible with target platform 719 $(TARGET_PLATFORM). ; 720 } 721} 722 723# Set TARGET_* variables either from HAIKU_* or HOST_* depending on the 724# specified TARGET_PLATFORM. 725 726local buildVars = 727 ARCH CPU GCC_VERSION 728 729 AR CC C++ LD OBJCOPY RANLIB 730 731 INCLUDES_SEPARATOR LOCAL_INCLUDES_OPTION SYSTEM_INCLUDES_OPTION 732 733 HDRS CPPFLAGS CCFLAGS C++FLAGS LDFLAGS LINK LINKFLAGS DEFINES 734 ARFLAGS UNARFLAGS 735 KERNEL_DEFINES 736 737 KERNEL_CCFLAGS KERNEL_C++FLAGS 738 KERNEL_PIC_CCFLAGS KERNEL_PIC_LINKFLAGS 739 WARNING_CCFLAGS WARNING_C++FLAGS 740 741 KERNEL_WARNING_CCFLAGS KERNEL_WARNING_C++FLAGS 742 743 DEBUG_FLAGS 744 745 DEBUG_$(HAIKU_DEBUG_LEVELS)_CCFLAGS DEBUG_$(HAIKU_DEBUG_LEVELS)_C++FLAGS 746 747 KERNEL_DEBUG_$(HAIKU_DEBUG_LEVELS)_CCFLAGS 748 KERNEL_DEBUG_$(HAIKU_DEBUG_LEVELS)_C++FLAGS 749 750 PRIVATE_KERNEL_HEADERS 751 752 LIBSTDC++ LIBSUPC++ 753 754 NETWORK_LIBS NETAPI_LIB SELECT_UNAME_ETC_LIB 755 756 ARCH_MACRO_DEFINE EXECUTABLE_MIME_TYPE 757 758 OBJECT_BASE_DIR COMMON_ARCH_OBJECT_DIR COMMON_DEBUG_OBJECT_DIR 759 DEBUG_$(HAIKU_DEBUG_LEVELS)_OBJECT_DIR 760; 761 762if $(TARGET_PLATFORM) = haiku { 763 local var ; 764 for var in $(buildVars) { 765 TARGET_$(var) = $(HAIKU_$(var)) ; 766 } 767 768 TARGET_GCC_LIB_DIR = $(HAIKU_GCC_LIB_DIR) ; 769 TARGET_GCC_HEADERS_DIR = $(HAIKU_GCC_HEADERS_DIR) ; 770 TARGET_GCC_LIBGCC = $(HAIKU_GCC_LIBGCC) ; 771 TARGET_GCC_LIBGCC_OBJECTS = $(HAIKU_GCC_LIBGCC_OBJECTS) ; 772 773 TARGET_BOOT_PLATFORM ?= $(HAIKU_BOOT_PLATFORM) ; 774 775 TARGET_LIBRARY_NAME_MAP = HAIKU_LIBRARY_NAME_MAP ; 776 777} else { 778 local var ; 779 for var in $(buildVars) { 780 TARGET_$(var) = $(HOST_$(var)) ; 781 } 782 783 TARGET_GCC_LIB_DIR = ; 784 TARGET_GCC_HEADERS_DIR = ; 785 TARGET_GCC_LIBGCC = ; 786 TARGET_GCC_LIBGCC_OBJECTS = ; 787 788 TARGET_BOOT_PLATFORM = ; 789 790 TARGET_LIBRARY_NAME_MAP = HOST_LIBRARY_NAME_MAP ; 791} 792 793# define macro, for identifying the platform 794switch $(TARGET_PLATFORM) { 795 case r5 : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_BEOS ; 796 case bone : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_BONE ; 797 case dano : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_DANO ; 798 case haiku_host : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_HAIKU ; 799 case haiku : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_HAIKU ; 800 case linux : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_LINUX ; 801 case freebsd : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_FREEBSD ; 802 case darwin : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_DARWIN ; 803 case libbe_test : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_LIBBE_TEST ; 804} 805 806# define macro, for identifying the host platform 807switch $(HOST_PLATFORM) { 808 case r5 : HOST_DEFINES += HAIKU_HOST_PLATFORM_BEOS ; 809 case bone : HOST_DEFINES += HAIKU_HOST_PLATFORM_BONE ; 810 case dano : HOST_DEFINES += HAIKU_HOST_PLATFORM_DANO ; 811 case haiku_host : HOST_DEFINES += HAIKU_HOST_PLATFORM_HAIKU ; 812 case linux : HOST_DEFINES += HAIKU_HOST_PLATFORM_LINUX ; 813 case freebsd : HOST_DEFINES += HAIKU_HOST_PLATFORM_FREEBSD ; 814 case darwin : HOST_DEFINES += HAIKU_HOST_PLATFORM_DARWIN ; 815} 816 817 818#pragma mark - 819 820# In case we build for a BeOS compatible platform, but not for Haiku, we 821# include the HaikuBuildCompatibility.h header and link against 822# libhaikucompat.a. 823 824if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) && $(TARGET_PLATFORM_BEOS_COMPATIBLE) { 825 # headers and flags 826 local compatibilityHeader = -include [ FDirName $(HAIKU_TOP) headers build 827 HaikuBuildCompatibility.h ] ; 828 TARGET_CCFLAGS += $(compatibilityHeader) ; 829 TARGET_C++FLAGS += $(compatibilityHeader) ; 830 831 # compatibility library 832 TARGET_HAIKU_COMPATIBILITY_LIBS = libhaikucompat.a ; 833} 834 835# special target libbe_test 836 837if $(TARGET_PLATFORM) = libbe_test { 838 # headers and flags 839 TARGET_HDRS += 840 [ PublicHeaders $(DOT) app drivers game interface kernel storage 841 support ] 842 [ PrivateHeaders $(DOT) ] ; 843 TARGET_DEFINES += __HAIKU__ ; 844 845 # directories 846 TARGET_OBJECT_BASE_DIR 847 = [ FDirName $(HAIKU_OBJECT_DIR) $(TARGET_PLATFORM) ] ; 848 TARGET_COMMON_ARCH_OBJECT_DIR 849 = [ FDirName $(TARGET_OBJECT_BASE_DIR) common ] ; 850 TARGET_ARCH_OBJECT_DIR 851 = [ FDirName $(TARGET_OBJECT_BASE_DIR) $(TARGET_ARCH) ] ; 852 TARGET_COMMON_DEBUG_OBJECT_DIR 853 = [ FDirName $(TARGET_ARCH_OBJECT_DIR) common ] ; 854 TARGET_DEBUG_0_OBJECT_DIR 855 = [ FDirName $(TARGET_ARCH_OBJECT_DIR) release ] ; 856 857 local level ; 858 for level in $(HAIKU_DEBUG_LEVELS[2-]) { 859 TARGET_DEBUG_$(level)_OBJECT_DIR 860 = [ FDirName $(TARGET_ARCH_OBJECT_DIR) debug_$(level) ] ; 861 } 862 863 # library name map 864 TARGET_LIBRARY_NAME_MAP = LIBBE_LIBRARY_NAME_MAP ; 865 LIBBE_LIBRARY_NAME_MAP_be = libbe_haiku.so ; 866} 867 868 869#pragma mark - 870 871# common stuff 872 873# start with a clean state 874CCFLAGS = ; 875C++FLAGS = ; 876DEFINES = ; 877 878# Set CC, C++, LINK to invalid values, so that we realize early, that we use 879# the wrong compiler. 880CC = bad-cc ; 881C++ = bad-c++ ; 882LINK = bad-link ; 883 884# Allow compiling unit tests on Zeta. Instead of fixing the PostMessage() 885# issues, they deprecated that nice function. This will enable it again: 886C++FLAGS += -D_ZETA_USING_DEPRECATED_API_=1 ; 887# Same for buggy find_directory threadsafety fixes 888C++FLAGS += -D_ZETA_TS_FIND_DIR_=1 ; 889 # TODO: Doesn't really belong here. 890 891 892# Defaults for warnings, optimization, and debugging. 893# 894WARNINGS ?= 1 ; 895OPTIM ?= -O2 ; 896DEBUG ?= 0 ; 897 898 899# Set the defaults for PLATFORM and SUPPORTED_PLATFORMS. PLATFORM is only 900# overridden for targets to be built for the host platform. SUPPORTED_PLATFORMS 901# can be overridden by the author of a component. 902PLATFORM = $(TARGET_PLATFORM) ; 903SUPPORTED_PLATFORMS = haiku ; 904 905 906# Instructs the Library rule to not make its object files temporary. 907# This is needed as some objects are used in a static library and for an 908# executable. 909KEEPOBJS = true ; 910 911 912# Set permissions to how they should be on the image. 913EXEMODE = 755 ; 914FILEMODE = 644 ; 915SHELLMODE = 755 ; 916 917 918# output directories 919# TODO: Review this. 920HAIKU_DOCUMENTATION_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) documentation ] ; 921HAIKU_DOCUMENTATION_OBJECT_DIR ?= [ FDirName $(HAIKU_COMMON_PLATFORM_OBJECT_DIR) 922 documentation ] ; 923 924# TODO: Rethink test stuff. 925HAIKU_TEST_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) tests $(TARGET_PLATFORM) $(HAIKU_ARCH) ] ; 926HAIKU_APP_TEST_DIR ?= [ FDirName $(HAIKU_TEST_DIR) apps ] ; 927HAIKU_APP_TEST_LIB_DIR ?= [ FDirName $(HAIKU_APP_TEST_DIR) lib ] ; 928HAIKU_TMP_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) tmp ] ; 929 930HAIKU_PACKAGE_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) packages ] ; 931HAIKU_PACKAGE_OBJECT_DIR ?= [ FDirName $(HAIKU_OBJECT_DIR) packages ] ; 932 933TARGET_TEST_DIR ?= [ FDirName $(HAIKU_TEST_DIR) 934 $(TARGET_PLATFORM) ] ; 935TARGET_UNIT_TEST_DIR ?= [ FDirName $(TARGET_TEST_DIR) unittests ] ; 936TARGET_UNIT_TEST_LIB_DIR ?= [ FDirName $(TARGET_UNIT_TEST_DIR) lib ] ; 937 938# automatically setup the objects directory per subdirectory 939SUBDIRRULES += SetupObjectsDir ; 940 941# Add the standard (userland) warning flags variables to the ones restored in 942# every subdirectory. Thus we can easily meddle with them in subdirectories 943# with imported sources. 944AUTO_SET_UP_CONFIG_VARIABLES += 945 HOST_WARNING_CCFLAGS HOST_WARNING_C++FLAGS 946 TARGET_WARNING_CCFLAGS TARGET_WARNING_C++FLAGS 947 948 # also add PLATFORM and SUPPORTED_PLATFORMS 949 PLATFORM SUPPORTED_PLATFORMS 950; 951