# Variable naming conventions: # TARGET_*: A build system variable specifying a property for building for # the target platform (usually Haiku). E.g. TARGET_CC specifies the # compiler when building a target for the target platform. # HOST_*: A build system variable specifying a property of the platform # hosting the build. E.g. HOST_CC specifies the compiler when # building a target for the host platform (a build tool for # instance). # HAIKU_*: A build system variable specifying a build system property. Usually # directory paths and the like. # The Haiku (base) version. For development builds the revision will be # attached. HAIKU_VERSION = r1~beta4 ; #pragma mark - container settings # Haiku image HAIKU_IMAGE_CONTAINER_NAME = haiku-image-container ; HAIKU_CONTAINER_GRIST on $(HAIKU_IMAGE_CONTAINER_NAME) = HaikuImage ; HAIKU_INCLUDE_IN_CONTAINER_VAR on $(HAIKU_IMAGE_CONTAINER_NAME) = HAIKU_INCLUDE_IN_IMAGE ; HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_IMAGE_CONTAINER_NAME) = HAIKU_IMAGE_INSTALL_TARGETS ; HAIKU_CONTAINER_SYSTEM_DIR_TOKENS on $(HAIKU_IMAGE_CONTAINER_NAME) = system non-packaged ; # network boot archive HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME = haiku-netboot-archive-container ; HAIKU_CONTAINER_GRIST on $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME) = NetBootArchive ; # HAIKU_INCLUDE_IN_CONTAINER_VAR -- update only mode not supported HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME) = HAIKU_NET_BOOT_ARCHIVE_INSTALL_TARGETS ; HAIKU_CONTAINER_SYSTEM_DIR_TOKENS on $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME) = system ; # boot floppy HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME = haiku-boot-floppy-container ; HAIKU_CONTAINER_GRIST on $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME) = FloppyBootImage ; # HAIKU_INCLUDE_IN_CONTAINER_VAR -- update only mode not supported HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME) = HAIKU_FLOPPY_BOOT_IMAGE_INSTALL_TARGETS ; HAIKU_CONTAINER_SYSTEM_DIR_TOKENS on $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME) = system ; # boot CD image HAIKU_CD_BOOT_IMAGE_CONTAINER_NAME = haiku-boot-cd-container ; HAIKU_CONTAINER_GRIST on $(HAIKU_CD_BOOT_IMAGE_CONTAINER_NAME) = CDBootImage ; # HAIKU_INCLUDE_IN_CONTAINER_VAR -- update only mode not supported HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_CD_BOOT_IMAGE_CONTAINER_NAME) = HAIKU_CD_BOOT_IMAGE_INSTALL_TARGETS ; HAIKU_CONTAINER_SYSTEM_DIR_TOKENS on $(HAIKU_CD_BOOT_IMAGE_CONTAINER_NAME) = system ; # boot MMC image HAIKU_MMC_BOOT_IMAGE_CONTAINER_NAME = haiku-boot-mmc-container ; HAIKU_CONTAINER_GRIST on $(HAIKU_MMC_BOOT_IMAGE_CONTAINER_NAME) = MMCImage ; # HAIKU_INCLUDE_IN_CONTAINER_VAR -- update only mode not supported HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_MMC_BOOT_IMAGE_CONTAINER_NAME) = HAIKU_MMC_BOOT_IMAGE_INSTALL_TARGETS ; HAIKU_CONTAINER_SYSTEM_DIR_TOKENS on $(HAIKU_MMC_BOOT_IMAGE_CONTAINER_NAME) = system ; # Haiku image/install defaults HAIKU_DEFAULT_IMAGE_NAME = haiku.image ; HAIKU_DEFAULT_IMAGE_DIR = $(HAIKU_OUTPUT_DIR) ; HAIKU_DEFAULT_VMWARE_IMAGE_NAME = haiku.vmdk ; HAIKU_DEFAULT_INSTALL_DIR = /Haiku ; HAIKU_DEFAULT_IMAGE_SIZE ?= 300 ; # 300 MB HAIKU_DEFAULT_IMAGE_LABEL ?= Haiku ; # Haiku CD defaults HAIKU_DEFAULT_CD_NAME = haiku-cd.iso ; HAIKU_DEFAULT_CD_DIR = $(HAIKU_OUTPUT_DIR) ; HAIKU_DEFAULT_CD_LABEL = Haiku ; # Haiku Anyboot defaults HAIKU_DEFAULT_ANYBOOT_NAME = haiku-anyboot.iso ; HAIKU_DEFAULT_ANYBOOT_DIR = $(HAIKU_OUTPUT_DIR) ; HAIKU_DEFAULT_ANYBOOT_LABEL ?= Haiku ; # Haiku MMC defaults HAIKU_DEFAULT_MMC_NAME = haiku-mmc.image ; HAIKU_DEFAULT_MMC_DIR = $(HAIKU_OUTPUT_DIR) ; HAIKU_DEFAULT_MMC_LABEL ?= Haiku ; # analyze and optionally replace jam's target parameters ProcessCommandLineArguments ; # supported debug levels HAIKU_DEBUG_LEVELS = 0 1 2 3 4 5 ; # configuration header directories HAIKU_CONFIG_HEADERS = [ FDirName $(HAIKU_TOP) build user_config_headers ] [ FDirName $(HAIKU_TOP) build config_headers ] ; # object directories common to all architectures HAIKU_OBJECT_BASE_DIR = [ FDirName $(HAIKU_OBJECT_DIR) haiku ] ; HAIKU_COMMON_ARCH_OBJECT_DIR = [ FDirName $(HAIKU_OBJECT_BASE_DIR) common ] ; #pragma mark - haiku target platform settings local architecture ; for architecture in $(HAIKU_PACKAGING_ARCHS) { ArchitectureSetup $(architecture) ; } if $(HAIKU_PACKAGING_ARCH) { local kernelArch = $(HAIKU_PACKAGING_ARCH) ; # Always use the non-legacy GCC for the kernel. if $(kernelArch) = x86_gcc2 { kernelArch = x86 ; } KernelArchitectureSetup $(kernelArch) ; } # define primary packaging architecture macro HAIKU_DEFINES = __HAIKU_PRIMARY_PACKAGING_ARCH=\\\"$(HAIKU_PACKAGING_ARCH)\\\" ; # distro compatibility level defines HAIKU_DISTRO_COMPATIBILITY ?= "default" ; switch $(HAIKU_DISTRO_COMPATIBILITY) { case official : HAIKU_DEFINES += HAIKU_DISTRO_COMPATIBILITY_OFFICIAL ; HAIKU_INCLUDE_TRADEMARKS = "" ; case compatible : HAIKU_DEFINES += HAIKU_DISTRO_COMPATIBILITY_COMPATIBLE ; HAIKU_INCLUDE_TRADEMARKS = "" ; case "default" : HAIKU_DEFINES += HAIKU_DISTRO_COMPATIBILITY_DEFAULT ; HAIKU_INCLUDE_TRADEMARKS = ; case * : Exit "Invalid value for HAIKU_DISTRO_COMPATIBILITY:" $(HAIKU_DISTRO_COMPATIBILITY) ; } # network libraries HAIKU_NETWORK_LIBS = network ; HAIKU_NETAPI_LIB = bnetapi ; HAIKU_SELECT_UNAME_ETC_LIB = ; # libroot, against which we link anyway HAIKU_EXECUTABLE_MIME_TYPE = "application/x-vnd.Be-elfexecutable" ; # TODO: The version stuff should probably go into a separate file and be made # available as macro, too. # Set our version number if not already set and mark it as a developer build if ! $(HAIKU_BUILD_VERSION) { HAIKU_BUILD_VERSION ?= "1 0 0 a 1" ; HAIKU_BUILD_DESCRIPTION ?= "Developer Build" ; } # If HAIKU_BUILD_VERSION is set, but HAIKU_BUILD_DESCRIPTION isn't, mark it as # an unknown build. HAIKU_BUILD_DESCRIPTION ?= "Unknown Build" ; #pragma mark - host platform settings # analyze the host gcc machine spec to find out about 64-bitness HOST_PLATFORM_IS_64_BIT = ; switch $(HOST_GCC_MACHINE) { case i686-apple-darwin10 : HOST_PLATFORM_IS_64_BIT = 1 ; case i686-apple-darwin11 : HOST_PLATFORM_IS_64_BIT = 1 ; case x86_64-* : HOST_PLATFORM_IS_64_BIT = 1 ; case amd64-* : HOST_PLATFORM_IS_64_BIT = 1 ; case arm64-* : HOST_PLATFORM_IS_64_BIT = 1 ; case aarch64-* : HOST_PLATFORM_IS_64_BIT = 1 ; case riscv64-* : HOST_PLATFORM_IS_64_BIT = 1 ; } # If HAIKU_HOST_USE_32BIT is set, add the required gcc base flag (the LD flag # is set later), or, if the architecture isn't actually 64 bit, clear # HAIKU_HOST_USE_32BIT. # Afterwards HOST_PLATFORM_IS_64_BIT will indicate whether the architecture is # effectively (i.e. when using the compiler/linker flags) 64 bit and # HAIKU_HOST_USE_32BIT will be set, iff the architecture is really 64 bit and # 32 bit mode was requested. if $(HAIKU_HOST_USE_32BIT) = 1 { if $(HOST_PLATFORM_IS_64_BIT) { # enable GCC -m32 option HOST_GCC_BASE_FLAGS = -m32 ; HOST_PLATFORM_IS_64_BIT = ; } else { HAIKU_HOST_USE_32BIT = 0 ; } } # save jam's variables for the build platform HOST_AR ?= $(AR) ; HOST_ARFLAGS ?= $(ARFLAGS) ; HOST_CC ?= $(CC) ; HOST_C++ ?= $(HOST_CC) ; HOST_LINK ?= $(HOST_CC) ; HOST_RANLIB ?= $(RANLIB) ; HOST_CPPFLAGS ?= $(CPPFLAGS) ; HOST_CCFLAGS ?= $(HOST_GCC_BASE_FLAGS) $(CCFLAGS) ; HOST_C++FLAGS ?= $(HOST_GCC_BASE_FLAGS) $(C++FLAGS) ; HOST_LDFLAGS ?= $(LDFLAGS) ; HOST_LINKFLAGS ?= $(HOST_GCC_BASE_FLAGS) $(LINKFLAGS) ; HOST_DEFINES ?= $(DEFINES) ; HOST_HDRS ?= $(HDRS) ; # split up HOST_AR into the command name and flags HOST_AR = [ Match "([^ ]*) *(.*)" : $(HOST_AR[1]) ] $(HOST_AR[2-]) ; HOST_ARFLAGS = $(HOST_AR[2-]) $(HOST_ARFLAGS) ; HOST_AR = $(HOST_AR[1]) ; HOST_UNARFLAGS ?= x ; # check the host platform compatibility SetPlatformCompatibilityFlagVariables HOST_PLATFORM : HOST : host : linux openbsd freebsd darwin ; HOST_PLATFORM_(host)_COMPATIBLE = 1 ; if $(HOST_PLATFORM) = linux || $(HOST_PLATFORM) = freebsd || $(HOST_PLATFORM) = darwin || $(HOST_PLATFORM) = openbsd { # don't use lex: otherwise rc will not work correctly if $(LEX) = lex { LEX = flex ; } } HOST_CPU ?= $(OSPLAT:L) ; # Jam doesn't know x86_64, so override HOST_CPU, if 64 bit. if $(HOST_CPU) = x86 && $(HOST_PLATFORM_IS_64_BIT) { HOST_CPU = x86_64 ; } HOST_ARCH ?= $(HOST_CPU) ; HOST_ARCHS = $(HOST_ARCH) ; HOST_KERNEL_ARCH = host ; # set packaging architecture HOST_PACKAGING_ARCH ?= $(HOST_CPU) ; if $(HOST_PACKAGING_ARCH) = x86 && $(HOST_CC_IS_LEGACY_GCC) = 1 { HOST_PACKAGING_ARCH = x86_gcc2 ; } HOST_PACKAGING_ARCHS = $(HOST_PACKAGING_ARCH) ; # directories HOST_OBJECT_BASE_DIR = [ FDirName $(HAIKU_OBJECT_DIR) $(HOST_PLATFORM) ] ; HOST_COMMON_ARCH_OBJECT_DIR = [ FDirName $(HOST_OBJECT_BASE_DIR) common ] ; HOST_ARCH_OBJECT_DIR = [ FDirName $(HOST_OBJECT_BASE_DIR) $(HOST_PACKAGING_ARCH) ] ; HOST_COMMON_DEBUG_OBJECT_DIR = [ FDirName $(HOST_ARCH_OBJECT_DIR) common ] ; HOST_DEBUG_0_OBJECT_DIR = [ FDirName $(HOST_ARCH_OBJECT_DIR) release ] ; local level ; for level in $(HAIKU_DEBUG_LEVELS[2-]) { HOST_DEBUG_$(level)_OBJECT_DIR = [ FDirName $(HOST_ARCH_OBJECT_DIR) debug_$(level) ] ; } # set variables for gcc header options SetIncludePropertiesVariables HOST ; # assembler flags HOST_ASFLAGS = ; # C/C++ flags HOST_CCFLAGS += -Wno-multichar ; HOST_C++FLAGS += -Wno-multichar ; HOST_PIC_CCFLAGS += -fPIC ; HOST_PIC_C++FLAGS += -fPIC ; if $(HOST_CC_IS_LEGACY_GCC) != 1 { HOST_GCC_BASE_FLAGS += -fno-strict-aliasing -fno-delete-null-pointer-checks ; } HOST_KERNEL_CCFLAGS += $(HOST_GCC_BASE_FLAGS) -finline -fno-builtin -D_KERNEL_MODE ; HOST_KERNEL_C++FLAGS += $(HOST_GCC_BASE_FLAGS) -finline -fno-builtin -fno-exceptions -D_KERNEL_MODE ; HOST_KERNEL_DEFINES += _KERNEL_MODE ; HOST_KERNEL_PIC_CCFLAGS = -fno-pic ; HOST_KERNEL_PIC_LINKFLAGS = ; if $(HOST_ARCH) = ppc { # Build a position independent PPC kernel. We need to be able to relocate # the kernel, since the virtual address space layout at boot time is not # fixed. HOST_KERNEL_PIC_CCFLAGS = -fPIE ; HOST_KERNEL_PIC_LINKFLAGS = -shared -fPIE ; } if $(HOST_ARCH) = m68k { # Build a position independent M68K kernel. We need to be able to relocate # the kernel, since the virtual address space layout at boot time is not # fixed. HOST_KERNEL_PIC_CCFLAGS = $(HAIKU_KERNEL_PIC_CCFLAGS) ; HOST_KERNEL_PIC_LINKFLAGS = $(HAIKU_KERNEL_PIC_LINKFLAGS) ; } if $(HOST_PLATFORM) != darwin { # fix for new changes to DSO linking policies HOST_LINKFLAGS += -Xlinker --no-as-needed ; if $(HOST_CC_IS_LEGACY_GCC) != 1 { HOST_LINKFLAGS += -Wl,--copy-dt-needed-entries ; } } # warning flags HOST_WARNING_CCFLAGS = -Wall -Wno-trigraphs -Wmissing-prototypes -Wpointer-arith -Wcast-align -Wsign-compare ; HOST_WARNING_C++FLAGS = -Wall -Wno-trigraphs -Wno-ctor-dtor-privacy -Woverloaded-virtual -Wpointer-arith -Wcast-align -Wsign-compare ; HOST_KERNEL_WARNING_CCFLAGS = -Wall -Wno-trigraphs -Wmissing-prototypes ; HOST_KERNEL_WARNING_C++FLAGS = -Wall -Wno-trigraphs ; HOST_WERROR_FLAGS = ; # debug flags local hostDebugFlags ; switch $(HOST_PLATFORM) { case haiku : hostDebugFlags ?= -ggdb ; case haiku_host : hostDebugFlags ?= -ggdb ; case linux : hostDebugFlags ?= -ggdb ; case freebsd : hostDebugFlags ?= -ggdb ; case darwin : hostDebugFlags ?= -ggdb ; case * : hostDebugFlags ?= -g ; } # debug 0: suppress asserts HOST_DEBUG_0_CCFLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ; HOST_DEBUG_0_C++FLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ; HOST_KERNEL_DEBUG_0_CCFLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ; HOST_KERNEL_DEBUG_0_C++FLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ; local level ; for level in $(HAIKU_DEBUG_LEVELS[2-]) { local flags = $(hostDebugFlags) [ FDefines DEBUG=$(level) ] ; HOST_DEBUG_$(level)_CCFLAGS = $(flags) ; HOST_DEBUG_$(level)_C++FLAGS = $(flags) ; HOST_KERNEL_DEBUG_$(level)_CCFLAGS = $(flags) ; HOST_KERNEL_DEBUG_$(level)_C++FLAGS = $(flags) ; } # ld flags if $(HAIKU_HOST_USE_32BIT) = 1 { HOST_LDFLAGS += -melf_i386 ; } # private kernel headers do be used when compiling kernel code HOST_PRIVATE_KERNEL_HEADERS = ; # private shared kernel/libroot headers HOST_PRIVATE_SYSTEM_HEADERS = ; # under Haiku use copyattr instead of cp if $(HOST_PLATFORM_HAIKU_COMPATIBLE) { CP = copyattr --data ; } HOST_DEFINES += ARCH_$(HOST_CPU) ; HOST_DEFINES += _NO_INLINE_ASM __NO_INLINE__ ; # for builds of tools in the current environment HOST_BUILD_COMPATIBILITY_LIB_DIR = [ FDirName $(PWD) $(HOST_OBJECT_BASE_DIR) lib ] ; # For the generic attributes emulation: Target rm_attrs -- rm replacement that # also removes the attributes. HOST_RM_ATTRS_TARGET = ; HOST_LIBROOT = libroot_build_function_remapper.a libroot_build.so ; HOST_STATIC_LIBROOT = libroot_build_function_remapper.a libroot_build.a ; HOST_LIBBE = libbe_build.so ; # adding rpath allows directly invoking host tools without specifying # a library search path if $(HOST_PLATFORM) != darwin { HOST_LINKFLAGS += -Wl,-rpath,$(HOST_BUILD_COMPATIBILITY_LIB_DIR) ; } if $(HOST_PLATFORM_HAIKU_COMPATIBLE) { # the C++ standard and support libraries if $(HOST_CC_IS_LEGACY_GCC) = 1 { HOST_LIBSTDC++ = stdc++.r4 ; HOST_LIBSUPC++ = ; } else { HOST_LIBSTDC++ = stdc++ ; HOST_LIBSUPC++ = supc++ ; } HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR = "LIBRARY_PATH=\"$LIBRARY_PATH:$(HOST_BUILD_COMPATIBILITY_LIB_DIR)\"" ; HOST_PTHREAD_LINKFLAGS = ; HOST_LINKFLAGS += -lbsd ; HOST_LIBRARY_NAME_MAP_input_server = /system/servers/input_server ; HOST_DEFINES += __STDC_FORMAT_MACROS __STDC_LIMIT_MACROS ; local compatibilityHeader = -include [ FDirName $(HAIKU_TOP) headers build HaikuBuildCompatibility.h ] ; HOST_CCFLAGS += $(compatibilityHeader) ; HOST_C++FLAGS += $(compatibilityHeader) ; } else { HOST_LINKFLAGS += -lm -ldl ; HOST_LIBSTDC++ = stdc++ ; if $(HOST_PLATFORM) = darwin { HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR = "DYLD_LIBRARY_PATH=\"$DYLD_LIBRARY_PATH:$(HOST_BUILD_COMPATIBILITY_LIB_DIR)\"" ; } else { HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR = "LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH:$(HOST_BUILD_COMPATIBILITY_LIB_DIR)\"" ; } HOST_PTHREAD_LINKFLAGS = -pthread ; # the C++ support library if $(HOST_CC_IS_LEGACY_GCC) = 1 { HOST_LIBSUPC++ = ; } else { HOST_LIBSUPC++ = supc++ ; } if $(HOST_PLATFORM) = darwin { # part of the C++ runtime lives in libstdc++ on Darwin HOST_LIBSUPC++ = gcc_s.1 stdc++ ; HOST_LIBSTDC++ = ; } else if $(HOST_PLATFORM) = freebsd { if $(HOST_CPU) = x86_64 { # amd64 FreeBSD 8 doesn't come without a shared libsupc++, and the # static one prevents us from building shared libraries. So we have # to work around by using the shared libstdc++. HOST_LIBSUPC++ = stdc++ ; HOST_LIBSTDC++ = ; } } # Supposing this is a glibc platform, let's try to get features like large # file support, ISO C 99 definitions, etc. On some platforms we need to # request 64 bit off_t support explicitely. HOST_DEFINES += _GNU_SOURCE _FILE_OFFSET_BITS=64 __STDC_FORMAT_MACROS __STDC_LIMIT_MACROS ; } if $(HAIKU_HOST_USE_XATTR) = 1 { HOST_DEFINES += HAIKU_HOST_USE_XATTR ; } else { # Otherwise the generic attribute emulation is used, which uses a # directory per file to store its attribute. We need to redefine RM so # that the attributes are removed as well. We use a wrapper script, # which invokes a build tool. If the build tool hasn't been built yet, # the normal "rm" is used and the attributes are leaked (likely there # aren't any yet). RM = $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) [ FDirName $(HAIKU_TOP) build scripts rm_attrs ] [ FDirName $(HAIKU_OBJECT_DIR) $(HOST_PLATFORM) $(HOST_ARCH) release tools rm_attrs ] -f ; # assumes that rm_attrs is built with debugging disabled HOST_RM_ATTRS_TARGET = rm_attrs ; # If specified, use xattr support to tag files with unique IDs. if $(HAIKU_HOST_USE_XATTR_REF) = 1 { HOST_DEFINES += HAIKU_HOST_USE_XATTR_REF ; } } # network libraries if $(HOST_PLATFORM_HAIKU_COMPATIBLE) { HOST_NETWORK_LIBS = network ; HOST_NETAPI_LIB = bnetapi ; HOST_SELECT_UNAME_ETC_LIB = ; # libroot } else { # Linux, ... HOST_NETWORK_LIBS = ; HOST_NETAPI_LIB = ; HOST_SELECT_UNAME_ETC_LIB = ; } # define the executable MIME type HOST_EXECUTABLE_MIME_TYPE = "application/x-vnd.Be-elfexecutable" ; if $(METROWERKS) { # at least parts of Haiku still can be compiled with # the Metrowerks compiler on BeOS/PPC HOST_EXECUTABLE_MIME_TYPE = "application/x-be-executable" ; } # Be API compatibility HOST_BE_API_HEADERS = ; HOST_BE_API_CCFLAGS = ; HOST_BE_API_C++FLAGS = ; # Add directory with system headers we need when building something for the host # platform, e.g. containing missing POSIX/GNU headers. HOST_HDRS += [ FDirName $(HAIKU_TOP) headers build host $(HOST_PLATFORM) ] ; if $(HOST_PLATFORM) = freebsd { # FreeBSD's gcc doesn't include /usr/local/* in its search paths, # though that's where most things from ports wind up being installed. HOST_HDRS += /usr/local/include /usr/include/gnu ; HOST_LINKFLAGS += -L/usr/local/lib ; } if $(HOST_PLATFORM) = darwin { HOST_HDRS += [ FDirName $(HAIKU_TOP) src build libgnuregex ] ; # Mac OS X users may be using macports libraries, in which case the headers # and the libs are located in /opt/local/. HOST_HDRS += /opt/local/include ; HOST_LINKFLAGS += -L/opt/local/lib ; # Mac OS X users may be using homebrew libraries, in which case the headers # and the libs are locted in the /usr/local/. HOST_HDRS += /usr/local/include ; HOST_LINKFLAGS += -L/usr/local/lib ; } HOST_BE_API_HEADERS = [ FDirName $(HAIKU_TOP) headers build ] [ FDirName $(HAIKU_TOP) headers build os ] [ FDirName $(HAIKU_TOP) headers build os add-ons registrar ] [ FDirName $(HAIKU_TOP) headers build os app ] [ FDirName $(HAIKU_TOP) headers build os bluetooth ] [ FDirName $(HAIKU_TOP) headers build os drivers ] [ FDirName $(HAIKU_TOP) headers build os kernel ] [ FDirName $(HAIKU_TOP) headers build os interface ] [ FDirName $(HAIKU_TOP) headers build os locale ] [ FDirName $(HAIKU_TOP) headers build os storage ] [ FDirName $(HAIKU_TOP) headers build os support ] [ FDirName $(HAIKU_TOP) headers build private ] ; HOST_BE_API_CCFLAGS = -include [ FDirName $(HAIKU_TOP) headers build BeOSBuildCompatibility.h ] ; HOST_BE_API_C++FLAGS = $(HOST_BE_API_CCFLAGS) ; if ! $(HOST_PYTHON) { Echo "HOST_PYTHON variable not defined --> will default to 'python'" ; HOST_PYTHON ?= "python" ; } #pragma mark - target platform settings # check the target platform compatibility SetPlatformCompatibilityFlagVariables TARGET_PLATFORM : TARGET : target ; # Haiku architecture is undefined on host-only builds # set here to host arch to prevent recusive loops. if $(HAIKU_HOST_BUILD_ONLY) = 1 { Echo "Host tools build for $(HOST_ARCH)" ; HAIKU_ARCH = $(HOST_ARCH) ; HAIKU_KERNEL_ARCH = $(HOST_ARCH) ; HAIKU_KERNEL_ARCH_DIR = $(HAIKU_KERNEL_ARCH) ; } # Set TARGET_* variables either from HAIKU_* or HOST_* depending on the # specified TARGET_PLATFORM. Some variables are package architecture dependent # and their name gets a respective suffix. A few variables exist both with and # without suffix. The latter is either equivalent to the variable with the # primary architecture suffix (e.g. TARGET_ARCH) or is (additionally) applicable # for all architectures (e.g. TARGET_DEFINES). local buildVars = ARCH ARCHS KERNEL_ARCH KERNEL_ARCH_DIR PACKAGING_ARCH PACKAGING_ARCHS DEFINES KERNEL_DEFINES BOOT_DEFINES KERNEL_CCFLAGS KERNEL_C++FLAGS KERNEL_PIC_CCFLAGS KERNEL_PIC_LINKFLAGS KERNEL_ADDON_LINKFLAGS BOOT_CCFLAGS BOOT_C++FLAGS BOOT_LINKFLAGS BOOT_LDFLAGS KERNEL_WARNING_CCFLAGS KERNEL_WARNING_C++FLAGS KERNEL_DEBUG_$(HAIKU_DEBUG_LEVELS)_CCFLAGS KERNEL_DEBUG_$(HAIKU_DEBUG_LEVELS)_C++FLAGS PRIVATE_KERNEL_HEADERS NETWORK_LIBS NETAPI_LIB SELECT_UNAME_ETC_LIB EXECUTABLE_MIME_TYPE OBJECT_BASE_DIR COMMON_ARCH_OBJECT_DIR ; local archDependentBuildVars = ARCH CPU AR CC C++ ELFEDIT LD OBJCOPY RANLIB STRIP CC_IS_LEGACY_GCC CC_IS_CLANG ARFLAGS ASFLAGS UNARFLAGS CPPFLAGS CCFLAGS C++FLAGS HDRS LDFLAGS LINK LINKFLAGS WARNING_CCFLAGS WARNING_C++FLAGS WERROR_FLAGS DEBUG_$(HAIKU_DEBUG_LEVELS)_CCFLAGS DEBUG_$(HAIKU_DEBUG_LEVELS)_C++FLAGS INCLUDES_SEPARATOR LOCAL_INCLUDES_OPTION SYSTEM_INCLUDES_OPTION PRIVATE_SYSTEM_HEADERS ARCH_OBJECT_DIR COMMON_DEBUG_OBJECT_DIR DEBUG_$(HAIKU_DEBUG_LEVELS)_OBJECT_DIR ; # target platform setup local var ; for var in $(buildVars) { TARGET_$(var) = $(HAIKU_$(var)) ; } for var in $(archDependentBuildVars)_$(TARGET_PACKAGING_ARCHS) { TARGET_$(var) = $(HAIKU_$(var)) ; } TARGET_BOOT_LIBGCC = $(HAIKU_BOOT_LIBGCC_$(TARGET_PACKAGING_ARCH)) ; TARGET_BOOT_LIBSUPC++ = $(HAIKU_BOOT_LIBSUPC++_$(TARGET_PACKAGING_ARCH)) ; TARGET_BOOT_32_LIBGCC = $(HAIKU_BOOT_32_LIBGCC_$(TARGET_PACKAGING_ARCH)) ; TARGET_BOOT_32_LIBSUPC++ = $(HAIKU_BOOT_32_LIBSUPC++_$(TARGET_PACKAGING_ARCH)) ; TARGET_KERNEL_PLATFORM ?= $(HAIKU_KERNEL_PLATFORM) ; local architecture ; for architecture in $(TARGET_PACKAGING_ARCHS) { TARGET_DEFINES_$(architecture) = $(HAIKU_DEFINES_$(architecture)) ; TARGET_LIBRARY_NAME_MAP_$(architecture) = HAIKU_LIBRARY_NAME_MAP_$(architecture) ; } # define macro, for identifying the platform switch $(TARGET_PLATFORM) { case haiku : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_HAIKU ; case libbe_test : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_LIBBE_TEST ; } # define macro, for identifying the host platform switch $(HOST_PLATFORM) { case haiku_host : HOST_DEFINES += HAIKU_HOST_PLATFORM_HAIKU ; case linux : HOST_DEFINES += HAIKU_HOST_PLATFORM_LINUX ; case freebsd : HOST_DEFINES += HAIKU_HOST_PLATFORM_FREEBSD ; case darwin : HOST_DEFINES += HAIKU_HOST_PLATFORM_DARWIN ; } # define host platform 64 bit macro if $(HOST_PLATFORM_IS_64_BIT) { HOST_DEFINES += HAIKU_HOST_PLATFORM_64_BIT ; } # define Haiku packaging architecture macro for host build HOST_DEFINES += HAIKU_PACKAGING_ARCH=\\\"$(HAIKU_PACKAGING_ARCH)\\\" ; #pragma mark - # special target libbe_test if $(TARGET_PLATFORM) = libbe_test { # headers and flags TARGET_HDRS_$(TARGET_PACKAGING_ARCH) += [ PublicHeaders $(DOT) app drivers game interface kernel locale storage support ] [ PrivateHeaders $(DOT) ] ; TARGET_DEFINES += __HAIKU__ ; TARGET_PRIVATE_SYSTEM_HEADERS_$(TARGET_PACKAGING_ARCH) = [ PrivateHeaders $(DOT) system system/arch/$(TARGET_ARCH) ] ; # directories TARGET_OBJECT_BASE_DIR = [ FDirName $(HAIKU_OBJECT_DIR) $(TARGET_PLATFORM) ] ; TARGET_COMMON_ARCH_OBJECT_DIR = [ FDirName $(TARGET_OBJECT_BASE_DIR) common ] ; TARGET_ARCH_OBJECT_DIR_$(TARGET_PACKAGING_ARCH) = [ FDirName $(TARGET_OBJECT_BASE_DIR) $(TARGET_ARCH) ] ; TARGET_COMMON_DEBUG_OBJECT_DIR_$(TARGET_PACKAGING_ARCH) = [ FDirName $(TARGET_ARCH_OBJECT_DIR_$(TARGET_PACKAGING_ARCH)) common ] ; TARGET_DEBUG_0_OBJECT_DIR_$(TARGET_PACKAGING_ARCH) = [ FDirName $(TARGET_ARCH_OBJECT_DIR_$(TARGET_PACKAGING_ARCH)) release ] ; local level ; for level in $(HAIKU_DEBUG_LEVELS[2-]) { TARGET_DEBUG_$(level)_OBJECT_DIR_$(TARGET_PACKAGING_ARCH) = [ FDirName $(TARGET_ARCH_OBJECT_DIR_$(TARGET_PACKAGING_ARCH)) debug_$(level) ] ; } # library name map TARGET_LIBRARY_NAME_MAP_$(TARGET_PACKAGING_ARCH) = LIBBE_LIBRARY_NAME_MAP ; LIBBE_LIBRARY_NAME_MAP_be = libbe_test.so ; } #pragma mark - common stuff # start with a clean state CCFLAGS = ; C++FLAGS = ; DEFINES = ; # Set CC, C++, LINK to invalid values, so that we realize early, that we use # the wrong compiler. CC = bad-cc ; C++ = bad-c++ ; LINK = bad-link ; # Defaults for warnings, optimization, and debugging. # WARNINGS ?= 1 ; OPTIM ?= -O2 ; DEBUG ?= 0 ; # Set a sane default for whether this is a CI build. HAIKU_CONTINUOUS_INTEGRATION_BUILD ?= 0 ; # Set the defaults for PLATFORM and SUPPORTED_PLATFORMS. PLATFORM is only # overridden for targets to be built for the host platform. SUPPORTED_PLATFORMS # can be overridden by the author of a component. PLATFORM = $(TARGET_PLATFORM) ; SUPPORTED_PLATFORMS = haiku ; # Define two pseudo targets for the target and buildhost platform. The main # build rules (Cc, C++, As, ...) depend on these pseude targets such that global # initializations that are required before anything is built for a specific # platform can be forced by depending the pseudo target for the platform on the # initializations. # This is currently used to unpack the external headers from the # gcc_syslibs_devel build feature before anything is built for the target # platform. NotFile $(TARGET_PLATFORM) ; NotFile host ; # Instructs the Library rule to not make its object files temporary. # This is needed as some objects are used in a static library and for an # executable. KEEPOBJS = true ; # Set permissions to how they should be on the image. EXEMODE = 755 ; FILEMODE = 644 ; SHELLMODE = 755 ; # output directories # TODO: Review this. HAIKU_DOCUMENTATION_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) documentation ] ; HAIKU_DOCUMENTATION_OBJECT_DIR ?= [ FDirName $(HAIKU_COMMON_PLATFORM_OBJECT_DIR) documentation ] ; # TODO: Rethink test stuff. HAIKU_TEST_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) tests $(TARGET_PLATFORM) $(HAIKU_ARCH) ] ; HAIKU_APP_TEST_DIR ?= [ FDirName $(HAIKU_TEST_DIR) apps ] ; HAIKU_APP_TEST_LIB_DIR ?= [ FDirName $(HAIKU_APP_TEST_DIR) lib ] ; HAIKU_TMP_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) tmp ] ; local architecture ; for architecture in $(HAIKU_PACKAGING_ARCHS) { local baseDir = [ FDirName $(TARGET_OBJECT_BASE_DIR) $(architecture) packaging ] ; HAIKU_PACKAGES_DIR_$(architecture) = [ FDirName $(baseDir) packages ] ; HAIKU_PACKAGES_BUILD_DIR_$(architecture) = [ FDirName $(baseDir) packages_build ] ; HAIKU_PACKAGE_REPOSITORIES_DIR_$(architecture) = [ FDirName $(baseDir) repositories ] ; } HAIKU_PACKAGE_INFOS_DIR = [ FDirName $(HAIKU_TOP) src data package_infos ] ; TARGET_TEST_DIR ?= [ FDirName $(HAIKU_TEST_DIR) $(TARGET_PLATFORM) ] ; TARGET_UNIT_TEST_DIR ?= [ FDirName $(TARGET_TEST_DIR) unittests ] ; TARGET_UNIT_TEST_LIB_DIR ?= [ FDirName $(TARGET_UNIT_TEST_DIR) lib ] ; # automatically setup the objects directory per subdirectory SUBDIRRULES += SetupObjectsDir ; # Add the standard (userland) warning flags variables to the ones restored in # every subdirectory. Thus we can easily meddle with them in subdirectories # with imported sources. AUTO_SET_UP_CONFIG_VARIABLES += HOST_WARNING_CCFLAGS HOST_WARNING_C++FLAGS TARGET_WARNING_CCFLAGS_$(TARGET_PACKAGING_ARCHS) TARGET_WARNING_C++FLAGS_$(TARGET_PACKAGING_ARCHS) ; # also add PLATFORM and SUPPORTED_PLATFORMS AUTO_SET_UP_CONFIG_VARIABLES += PLATFORM SUPPORTED_PLATFORMS ; # set up warnings local architecture ; for architecture in $(TARGET_PACKAGING_ARCHS) { ArchitectureSetupWarnings $(architecture) ; } # set up architecture build features local architecture ; for architecture in $(TARGET_PACKAGING_ARCHS) { InitArchitectureBuildFeatures $(architecture) ; } # The following directories cannot currently be compiled with DEBUG=1 SetConfigVar DEBUG : HAIKU_TOP src add-ons disk_systems bfs : 0 : local ; SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel drivers audio hda : 0 : local ; SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel drivers audio ac97 auich : 0 : local ; # fails with gcc4 only SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel drivers audio ac97 auvia : 0 : local ; # fails with gcc4 only SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel drivers audio ac97 sis7018 : 0 : local ; SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel file_systems btrfs : 0 : local ; SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel file_systems ntfs libntfs : 0 : local ; SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel file_systems udf : 0 : local ; SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel file_systems userlandfs server : 0 : local ; # fails with gcc2 only SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel file_systems userlandfs server haiku : 0 : local ; # fails with gcc2 only SetConfigVar DEBUG : HAIKU_TOP src add-ons media media-add-ons dvb : 0 : local ; SetConfigVar DEBUG : HAIKU_TOP src add-ons print drivers gutenprint : 0 : local ; SetConfigVar DEBUG : HAIKU_TOP src servers input : 0 : local ; SetConfigVar DEBUG : HAIKU_TOP src servers media_addon : 0 : local ; SetConfigVar DEBUG : HAIKU_TOP src system boot loader file_systems bfs : 0 : local ;