Merged changes from branch build_system_redesign at revision 14573.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14574 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,157 @@
|
||||
# BeOS specific rules
|
||||
|
||||
|
||||
rule AddStringDataResource
|
||||
{
|
||||
# AddStringDataResource <target> : <resourceID> : <dataString>
|
||||
# Adds a single resource to the resources of an executable/library.
|
||||
# <target>: The executable/library.
|
||||
# <resourceID>: A resource ID string as understood by xres (type:id[:name]).
|
||||
# <dataString>: The string <dataString> will be written to the resource.
|
||||
# Defaults to "".
|
||||
#
|
||||
local target = $(1) ;
|
||||
local resourceID = $(2) ;
|
||||
local dataString = $(3:E="") ;
|
||||
|
||||
# the resource file
|
||||
local resources
|
||||
= [ FGristFiles $(target:B)-added-string-data-resources.rsrc ] ;
|
||||
|
||||
# add the resource file to the target, if not yet done
|
||||
if ! [ on $(resources) return $(RESOURCES_ADDED) ] {
|
||||
RESOURCES_ADDED on $(resources) = true ;
|
||||
MakeLocateArch $(resources) ;
|
||||
Depends $(resources) : <build>xres ;
|
||||
AddStringDataResource1 $(resources) : <build>xres ;
|
||||
AddResources $(target) : $(resources) ;
|
||||
}
|
||||
|
||||
RESOURCE_STRINGS on $(resources)
|
||||
+= "-a "$(resourceID)" -s \""$(dataString)"\"" ;
|
||||
}
|
||||
|
||||
actions together AddStringDataResource1
|
||||
{
|
||||
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
|
||||
$(2[1]) -o "$(1)" $(RESOURCE_STRINGS)
|
||||
}
|
||||
|
||||
|
||||
rule AddFileDataResource
|
||||
{
|
||||
# AddFileDataResource <target> : <resourceID> : [ <dataFile> ]
|
||||
# : [ <dataString> ]
|
||||
# Adds a single resource to the resources of an executable/library.
|
||||
# <target>: The executable/library.
|
||||
# <resourceID>: A resource ID string as understood by xres (type:id[:name]).
|
||||
# <dataFile>: The data to be written into the resource will be read from
|
||||
# that file.
|
||||
#
|
||||
local target = $(1) ;
|
||||
local resourceID = $(2) ;
|
||||
local dataFile = $(3) ;
|
||||
|
||||
# the resource file
|
||||
local resources
|
||||
= <added-resources>file-data-$(resourceID)-$(dataFile).rsrc ;
|
||||
|
||||
# add it to the resources of the given target
|
||||
AddResources $(target) : $(resources) ;
|
||||
|
||||
# if the rule for creating the resource file has not been invoked yet, do it
|
||||
if ! [ on $(resources) return $(RESOURCES_DEFINED) ] {
|
||||
RESOURCES_DEFINED on $(resources) = true ;
|
||||
RESOURCE_ID on $(resources) = $(resourceID) ;
|
||||
MakeLocateArch $(resources) ;
|
||||
|
||||
Depends $(resources) : <build>xres $(dataFile) ;
|
||||
AddFileDataResource1 $(resources) : <build>xres $(dataFile) ;
|
||||
}
|
||||
}
|
||||
|
||||
actions AddFileDataResource1
|
||||
{
|
||||
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
|
||||
$(2[1]) -o "$(1)" -a "$(RESOURCE_ID)" "$(2[2])" ;
|
||||
}
|
||||
|
||||
rule XRes
|
||||
{
|
||||
# XRes <target> : <resource files>
|
||||
if $(2)
|
||||
{
|
||||
Depends $(1) : <build>xres $(2) ;
|
||||
XRes1 $(1) : <build>xres $(2) ;
|
||||
}
|
||||
}
|
||||
|
||||
actions XRes1
|
||||
{
|
||||
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
|
||||
$(2[1]) -o "$(1)" "$(2[2-])" ;
|
||||
}
|
||||
|
||||
rule SetVersion
|
||||
{
|
||||
# SetVersion <target>
|
||||
|
||||
Depends $(1) : <build>setversion ;
|
||||
SetVersion1 $(1) : <build>setversion ;
|
||||
}
|
||||
|
||||
actions SetVersion1
|
||||
{
|
||||
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
|
||||
$(2[1]) "$(1)" -system $(HAIKU_BUILD_VERSION) -short "$(HAIKU_BUILD_DESCRIPTION)" ;
|
||||
}
|
||||
|
||||
rule SetType
|
||||
{
|
||||
# SetType <target>
|
||||
|
||||
Depends $(1) : <build>settype ;
|
||||
SetType1 $(1) : <build>settype ;
|
||||
}
|
||||
|
||||
actions SetType1
|
||||
{
|
||||
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
|
||||
$(2[1]) -t $(TARGET_EXECUTABLE_MIME_TYPE) "$(1)" ;
|
||||
}
|
||||
|
||||
rule MimeSet
|
||||
{
|
||||
# MimeSet <target>
|
||||
}
|
||||
|
||||
rule ResComp
|
||||
{
|
||||
# ResComp <resource file> : <rdef file> ;
|
||||
#
|
||||
# <resource file> and <rdef file> must be gristed.
|
||||
|
||||
SEARCH on $(2) += $(SEARCH_SOURCE) ;
|
||||
MakeLocateArch $(1) ;
|
||||
Depends $(1) : $(2) <build>rc ;
|
||||
LocalClean clean : $(1) ;
|
||||
ResComp1 $(1) : <build>rc $(2) ;
|
||||
}
|
||||
|
||||
actions ResComp1
|
||||
{
|
||||
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
|
||||
$(2[1]) --auto-names -o $(1) $(2[2-])
|
||||
}
|
||||
|
||||
|
||||
if $(OS) = BEOS
|
||||
{
|
||||
|
||||
actions MimeSet
|
||||
{
|
||||
mimeset -f "$(1)" ;
|
||||
}
|
||||
|
||||
} # if BEOS
|
||||
|
||||
@@ -0,0 +1,577 @@
|
||||
|
||||
# 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.
|
||||
|
||||
|
||||
# Include BuildConfig/Timezones/libgccObjects
|
||||
{
|
||||
local buildConfig = [ GLOB $(HAIKU_BUILD_OUTPUT_DIR) : BuildConfig ] ;
|
||||
local timezones = [ GLOB $(HAIKU_BUILD_OUTPUT_DIR) : Timezones ] ;
|
||||
local libgccObjects = [ GLOB $(HAIKU_BUILD_OUTPUT_DIR) : libgccObjects ] ;
|
||||
|
||||
if ! $(buildConfig) {
|
||||
ECHO "No `BuildConfig' found in $(HAIKU_BUILD_OUTPUT_DIR)!" ;
|
||||
EXIT "Run ./configure in the source tree's root directory first!" ;
|
||||
}
|
||||
if ! ( $(timezones) && $(libgccObjects) ) {
|
||||
ECHO "No `Timezones' or `libgccObjects' found in $(HAIKU_BUILD_OUTPUT_DIR)!" ;
|
||||
EXIT "Please run ./configure in the source tree's root directory again!" ;
|
||||
}
|
||||
|
||||
LOCATE on BuildConfig = $(HAIKU_BUILD_OUTPUT_DIR) ;
|
||||
LOCATE on Timezones = $(HAIKU_BUILD_OUTPUT_DIR) ;
|
||||
LOCATE on libgccObjects = $(HAIKU_BUILD_OUTPUT_DIR) ;
|
||||
|
||||
include BuildConfig ;
|
||||
include Timezones ;
|
||||
include libgccObjects ;
|
||||
}
|
||||
|
||||
|
||||
# supported debug levels
|
||||
HAIKU_DEBUG_LEVELS = 0 1 2 3 4 5 ;
|
||||
|
||||
# BeOS, BONE, Dan0 compatible platforms
|
||||
HAIKU_BEOS_COMPATIBLE_PLATFORMS = haiku r5 bone dano ;
|
||||
HAIKU_BONE_COMPATIBLE_PLATFORMS = haiku bone dano ;
|
||||
HAIKU_DANO_COMPATIBLE_PLATFORMS = haiku dano ;
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
# haiku target platform settings
|
||||
|
||||
# initial state for flags etc.
|
||||
HAIKU_C++ ?= $(HAIKU_CC) ;
|
||||
HAIKU_LINK = $(HAIKU_CC) ;
|
||||
HAIKU_LINKFLAGS = ;
|
||||
|
||||
HAIKU_HDRS = [ FStandardHeaders ] ;
|
||||
HAIKU_CCFLAGS = -nostdinc ;
|
||||
HAIKU_C++FLAGS = -nostdinc ;
|
||||
HAIKU_DEFINES = __HAIKU__ ;
|
||||
|
||||
# analyze the gcc machine spec to determine HAIKU_CPU
|
||||
switch $(HAIKU_GCC_MACHINE) {
|
||||
case i386-* : HAIKU_CPU = x86 ;
|
||||
case i486-* : HAIKU_CPU = x86 ;
|
||||
case i586-* : HAIKU_CPU = x86 ;
|
||||
case i686-* : HAIKU_CPU = x86 ;
|
||||
# TODO: PPC?
|
||||
case * : Exit "Unsupported gcc target machine:" $(HAIKU_GCC_MACHINE) ;
|
||||
}
|
||||
|
||||
switch $(HAIKU_CPU) {
|
||||
case ppc :
|
||||
{
|
||||
HAIKU_DEFINES += __POWERPC__ ;
|
||||
HAIKU_BOOT_PLATFORM = openfirmware ;
|
||||
}
|
||||
case x86 :
|
||||
{
|
||||
HAIKU_DEFINES += __INTEL__ ;
|
||||
HAIKU_BOOT_PLATFORM = bios_ia32 ;
|
||||
}
|
||||
case * :
|
||||
Exit "Currently unsupported target CPU:" $(HAIKU_CPU) ;
|
||||
}
|
||||
HAIKU_ARCH ?= $(HAIKU_CPU) ;
|
||||
HAIKU_ARCH_MACRO_DEFINE = ARCH_$(HAIKU_ARCH) ;
|
||||
HAIKU_DEFINES += $(HAIKU_ARCH_MACRO_DEFINE) ;
|
||||
|
||||
# directories
|
||||
HAIKU_OBJECT_BASE_DIR = [ FDirName $(HAIKU_OBJECT_DIR) haiku ] ;
|
||||
HAIKU_COMMON_ARCH_OBJECT_DIR = [ FDirName $(HAIKU_OBJECT_BASE_DIR) common ] ;
|
||||
HAIKU_ARCH_OBJECT_DIR = [ FDirName $(HAIKU_OBJECT_BASE_DIR) $(HAIKU_ARCH) ] ;
|
||||
HAIKU_COMMON_DEBUG_OBJECT_DIR = [ FDirName $(HAIKU_ARCH_OBJECT_DIR) common ] ;
|
||||
HAIKU_DEBUG_0_OBJECT_DIR = [ FDirName $(HAIKU_ARCH_OBJECT_DIR) release ] ;
|
||||
|
||||
local level ;
|
||||
for level in $(HAIKU_DEBUG_LEVELS[2-]) {
|
||||
HAIKU_DEBUG_$(level)_OBJECT_DIR
|
||||
= [ FDirName $(HAIKU_ARCH_OBJECT_DIR) debug_$(level) ] ;
|
||||
}
|
||||
|
||||
# analyze GCC version
|
||||
if ! $(HAIKU_GCC_RAW_VERSION) {
|
||||
ECHO "Variable HAIKU_GCC_RAW_VERSION not set. Please run ./configure or" ;
|
||||
EXIT "specify it manually." ;
|
||||
}
|
||||
HAIKU_GCC_VERSION = ;
|
||||
{
|
||||
# split the raw version string at `.' and `-' characters
|
||||
local version = $(HAIKU_GCC_RAW_VERSION) ;
|
||||
while $(version) {
|
||||
local split = [ Match "([^.-]*)[.-](.*)" : $(version) ] ;
|
||||
if $(split) {
|
||||
HAIKU_GCC_VERSION += $(split[1]) ;
|
||||
version = $(split[2]) ;
|
||||
} else {
|
||||
HAIKU_GCC_VERSION += $(version) ;
|
||||
version = ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# assembler flags
|
||||
HAIKU_ASFLAGS = ;
|
||||
|
||||
# C/C++ flags
|
||||
HAIKU_CCFLAGS += -Wno-multichar ;
|
||||
HAIKU_C++FLAGS += -Wno-multichar ;
|
||||
|
||||
HAIKU_KERNEL_CCFLAGS += -finline -fno-builtin
|
||||
-DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) -D_KERNEL_MODE ;
|
||||
HAIKU_KERNEL_C++FLAGS += -finline -fno-builtin -fno-exceptions
|
||||
-DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) -D_KERNEL_MODE ;
|
||||
|
||||
if $(HAIKU_GCC_VERSION[1]) >= 3 {
|
||||
HAIKU_KERNEL_C++FLAGS += -fno-use-cxa-atexit ;
|
||||
}
|
||||
|
||||
# If the environment variable DEBUG_PRINTF is defined we define an equally
|
||||
# named macro to the variable value. Some components use the macro to allow
|
||||
# another function than printf() to print the debug output. The variable should
|
||||
# be set to the name of the alternative function.
|
||||
#
|
||||
if $(DEBUG_PRINTF) {
|
||||
HAIKU_CCFLAGS += [ FDefines DEBUG_PRINTF=$(DEBUG_PRINTF) ] ;
|
||||
HAIKU_C++FLAGS += [ FDefines DEBUG_PRINTF=$(DEBUG_PRINTF) ] ;
|
||||
}
|
||||
|
||||
# warning flags
|
||||
HAIKU_WARNING_CCFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wcast-align
|
||||
-Wsign-compare ;
|
||||
HAIKU_WARNING_C++FLAGS = -Wall -Wmissing-prototypes -Wno-ctor-dtor-privacy
|
||||
-Woverloaded-virtual -Wpointer-arith -Wcast-align -Wsign-compare ;
|
||||
|
||||
HAIKU_KERNEL_WARNING_CCFLAGS = -Wall -Wmissing-prototypes ;
|
||||
HAIKU_KERNEL_WARNING_C++FLAGS = -Wall -Wmissing-prototypes ;
|
||||
|
||||
# debug flags
|
||||
HAIKU_DEBUG_FLAGS ?= -ggdb ;
|
||||
|
||||
# debug 0: suppress asserts
|
||||
HAIKU_DEBUG_0_CCFLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
|
||||
HAIKU_DEBUG_0_C++FLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
|
||||
|
||||
HAIKU_KERNEL_DEBUG_0_CCFLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
|
||||
HAIKU_KERNEL_DEBUG_0_C++FLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
|
||||
|
||||
local level ;
|
||||
for level in $(HAIKU_DEBUG_LEVELS[2-]) {
|
||||
local flags = $(HAIKU_DEBUG_FLAGS) [ FDefines DEBUG=$(level) ] ;
|
||||
HAIKU_DEBUG_$(level)_CCFLAGS = $(flags) ;
|
||||
HAIKU_DEBUG_$(level)_C++FLAGS = $(flags) ;
|
||||
HAIKU_KERNEL_DEBUG_$(level)_CCFLAGS = $(flags) ;
|
||||
HAIKU_KERNEL_DEBUG_$(level)_C++FLAGS = $(flags) ;
|
||||
}
|
||||
|
||||
# private kernel headers do be used when compiling kernel code
|
||||
HAIKU_PRIVATE_KERNEL_HEADERS =
|
||||
[ PrivateHeaders $(DOT) kernel libroot
|
||||
kernel/boot/platform/$(HAIKU_BOOT_PLATFORM) ]
|
||||
[ ArchHeaders $(HAIKU_ARCH) ]
|
||||
;
|
||||
|
||||
# Add some grist to the libgcc objects
|
||||
HAIKU_GCC_LIBGCC_OBJECTS = $(HAIKU_GCC_LIBGCC_OBJECTS:G=libgcc) ;
|
||||
|
||||
# the C++ library
|
||||
HAIKU_LIBSTDC++ = libstdc++.r4.so ;
|
||||
|
||||
# library and executable glue code
|
||||
local commonGlueCode =
|
||||
<src!system!glue>init_term_dyn.o
|
||||
<src!system!glue!arch!$(HAIKU_ARCH)>crti.o
|
||||
<src!system!glue!arch!$(HAIKU_ARCH)>crtn.o
|
||||
;
|
||||
HAIKU_LIBRARY_BEGIN_GLUE_CODE =
|
||||
<src!system!glue!arch!$(HAIKU_ARCH)>crti.o
|
||||
crtbegin.o
|
||||
<src!system!glue>init_term_dyn.o
|
||||
;
|
||||
HAIKU_LIBRARY_END_GLUE_CODE =
|
||||
crtend.o
|
||||
<src!system!glue!arch!$(HAIKU_ARCH)>crtn.o
|
||||
;
|
||||
HAIKU_EXECUTABLE_BEGIN_GLUE_CODE =
|
||||
<src!system!glue!arch!$(HAIKU_ARCH)>crti.o
|
||||
crtbegin.o
|
||||
<src!system!glue>start_dyn.o
|
||||
<src!system!glue>init_term_dyn.o
|
||||
;
|
||||
HAIKU_EXECUTABLE_END_GLUE_CODE = $(HAIKU_LIBRARY_END_GLUE_CODE) ;
|
||||
|
||||
SEARCH on crtbegin.o crtend.o = $(HAIKU_GCC_LIB_DIR) ;
|
||||
|
||||
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" ;
|
||||
|
||||
# init library name map
|
||||
{
|
||||
local i ;
|
||||
for i in be game mail media midi midi2 net netapi opengl screensaver root z
|
||||
textencoding tracker translation {
|
||||
HAIKU_LIBRARY_NAME_MAP_$(i) = lib$(i).so ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
# host platform settings
|
||||
|
||||
# save jam's variables for the build platform
|
||||
HOST_AR ?= $(AR) ;
|
||||
HOST_CC ?= $(CC) ;
|
||||
HOST_C++ ?= $(C++) ;
|
||||
HOST_LINK ?= $(LINK) ;
|
||||
HOST_LD ?= ld ; # TODO: Fix this!
|
||||
HOST_OBJCOPY ?= objcopy ; #
|
||||
HOST_RANLIB ?= $(RANLIB) ;
|
||||
HOST_CPPFLAGS ?= $(CPPFLAGS) ;
|
||||
HOST_CCFLAGS ?= $(CCFLAGS) ;
|
||||
HOST_C++FLAGS ?= $(C++FLAGS) ;
|
||||
HOST_LDFLAGS ?= $(LDFLAGS) ;
|
||||
HOST_LINKFLAGS ?= $(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_AR = $(HOST_AR[1]) ;
|
||||
HOST_UNARFLAGS ?= x ;
|
||||
|
||||
# check the host platform compatibility
|
||||
SetPlatformCompatibilityFlagVariables HOST_PLATFORM : HOST : host : linux ;
|
||||
|
||||
if $(HOST_PLATFORM) = linux {
|
||||
# don't use lex: otherwise rc will not work correctly
|
||||
if $(LEX) = lex {
|
||||
LEX = flex ;
|
||||
}
|
||||
}
|
||||
|
||||
HOST_CPU ?= $(OSPLAT:L) ;
|
||||
|
||||
HOST_ARCH ?= $(HOST_CPU) ;
|
||||
HOST_ARCH_MACRO_DEFINE = ARCH_$(HOST_CPU) ;
|
||||
|
||||
# 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_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) ] ;
|
||||
}
|
||||
|
||||
# assembler flags
|
||||
HOST_ASFLAGS = ;
|
||||
|
||||
# C/C++ flags
|
||||
HOST_CCFLAGS += -Wno-multichar ;
|
||||
HOST_C++FLAGS += -Wno-multichar ;
|
||||
|
||||
HOST_KERNEL_CCFLAGS += -finline -fno-builtin
|
||||
-DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) -D_KERNEL_MODE ;
|
||||
HOST_KERNEL_C++FLAGS += -finline -fno-builtin -fno-exceptions
|
||||
-DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) -D_KERNEL_MODE ;
|
||||
|
||||
# warning flags
|
||||
HOST_WARNING_CCFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wcast-align
|
||||
-Wsign-compare ;
|
||||
HOST_WARNING_C++FLAGS = -Wall -Wmissing-prototypes -Wno-ctor-dtor-privacy
|
||||
-Woverloaded-virtual -Wpointer-arith -Wcast-align -Wsign-compare ;
|
||||
|
||||
HOST_KERNEL_WARNING_CCFLAGS = -Wall -Wmissing-prototypes ;
|
||||
HOST_KERNEL_WARNING_C++FLAGS = -Wall -Wmissing-prototypes ;
|
||||
|
||||
# debug flags
|
||||
switch $(HOST_PLATFORM) {
|
||||
case haiku : HOST_DEBUG_FLAGS ?= -ggdb ;
|
||||
case linux : HOST_DEBUG_FLAGS ?= -ggdb ;
|
||||
case * : HOST_DEBUG_FLAGS ?= -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 = $(HOST_DEBUG_FLAGS) [ 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) ;
|
||||
}
|
||||
|
||||
# private kernel headers do be used when compiling kernel code
|
||||
HOST_PRIVATE_KERNEL_HEADERS = ;
|
||||
|
||||
# under BeOS use copyattr instead of cp
|
||||
if $(HOST_PLATFORM_BEOS_COMPATIBLE)
|
||||
{
|
||||
CP = copyattr --data ;
|
||||
}
|
||||
|
||||
HOST_DEFINES += $(HOST_ARCH_MACRO_DEFINE) ;
|
||||
HOST_DEFINES += _NO_INLINE_ASM ;
|
||||
|
||||
if $(HOST_PLATFORM_BEOS_COMPATIBLE) {
|
||||
# TODO: That's obviously not correct, but in the way the COMPILE_FOR_R5
|
||||
# macro is used, it actually seems to mean r5/bone/dano.
|
||||
HOST_DEFINES += COMPILE_FOR_R5 ;
|
||||
}
|
||||
|
||||
# for builds of tools in the current environment
|
||||
HOST_BUILD_COMPATIBILITY_LIB_DIR = [ FDirName $(HOST_OBJECT_BASE_DIR) lib ] ;
|
||||
|
||||
if $(HOST_PLATFORM_BEOS_COMPATIBLE) {
|
||||
HOST_LIBSTDC++ = stdc++.r4 ;
|
||||
HOST_LIBROOT = root ;
|
||||
HOST_LIBBE = be ;
|
||||
HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR = ;
|
||||
} else {
|
||||
HOST_LIBSTDC++ = stdc++ ;
|
||||
HOST_LIBROOT = libroot_build.so ;
|
||||
HOST_LIBBE = libbe_build.so ;
|
||||
HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR
|
||||
= "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(HOST_BUILD_COMPATIBILITY_LIB_DIR)" ;
|
||||
|
||||
# The BeOS compilers define __INTEL__ respectively __POWERPC__. On the
|
||||
# build platform we need to make sure, this is also defined.
|
||||
if $(HOST_CPU) = x86 {
|
||||
HOST_DEFINES += __INTEL__ ;
|
||||
} else if $(HOST_CPU) = ppc {
|
||||
HOST_DEFINES += __POWERPC__ ;
|
||||
}
|
||||
|
||||
# Supposing this is a glibc platform, let's try to get large file support
|
||||
HOST_DEFINES +=
|
||||
_LARGEFILE_SOURCE _LARGEFILE64_SOURCE _FILE_OFFSET_BITS=64
|
||||
;
|
||||
}
|
||||
|
||||
# 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 = ;
|
||||
|
||||
if ! $(HOST_PLATFORM_BEOS_COMPATIBLE) {
|
||||
HOST_BE_API_HEADERS =
|
||||
[ FDirName $(HAIKU_TOP) headers build ]
|
||||
[ FDirName $(HAIKU_TOP) headers build os ]
|
||||
[ FDirName $(HAIKU_TOP) headers build os app ]
|
||||
[ 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 storage ]
|
||||
[ FDirName $(HAIKU_TOP) headers build os support ]
|
||||
;
|
||||
HOST_BE_API_CCFLAGS = -include HaikuBuildCompatibility.h ;
|
||||
HOST_BE_API_C++FLAGS = $(HOST_BE_API_CCFLAGS) ;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
# target platform settings
|
||||
|
||||
# check the target platform compatibility
|
||||
SetPlatformCompatibilityFlagVariables TARGET_PLATFORM : TARGET : target ;
|
||||
|
||||
# check the compatibility between host and target platform
|
||||
if $(TARGET_PLATFORM) != haiku {
|
||||
if ! $(HOST_PLATFORM_($(TARGET_PLATFORM))_COMPATIBLE) {
|
||||
Exit ERROR: The host platform is not compatible with target platform
|
||||
$(TARGET_PLATFORM). ;
|
||||
}
|
||||
}
|
||||
|
||||
# TODO: Fix the naming!
|
||||
if $(TARGET_PLATFORM_BONE_COMPATIBLE) {
|
||||
NETWORK_LIBS = libsocket.so libbind.so ;
|
||||
NETAPI_LIB = libbnetapi.so ;
|
||||
SELECT_UNAME_ETC_LIB = libroot.so ;
|
||||
} else {
|
||||
NETWORK_LIBS = libnet.so ;
|
||||
NETAPI_LIB = libnetapi.so ;
|
||||
SELECT_UNAME_ETC_LIB = libnet.so ;
|
||||
}
|
||||
|
||||
# TODO: For compatibility only. Remove when no longer used.
|
||||
R5_COMPATIBLE = $(TARGET_PLATFORM_BEOS_COMPATIBLE) ;
|
||||
BONE_COMPATIBLE = $(TARGET_PLATFORM_BONE_COMPATIBLE) ;
|
||||
DANO_COMPATIBLE = $(TARGET_PLATFORM_DANO_COMPATIBLE) ;
|
||||
HAIKU_COMPATIBLE = $(TARGET_PLATFORM_HAIKU_COMPATIBLE) ;
|
||||
|
||||
# Set TARGET_* variables either from HAIKU_* or HOST_* depending on the
|
||||
# specified TARGET_PLATFORM.
|
||||
|
||||
local buildVars =
|
||||
ARCH CPU
|
||||
|
||||
AR CC C++ LD OBJCOPY RANLIB
|
||||
|
||||
HDRS CPPFLAGS CCFLAGS C++FLAGS LDFLAGS LINK LINKFLAGS DEFINES
|
||||
ARFLAGS UNARFLAGS
|
||||
|
||||
KERNEL_CCFLAGS KERNEL_C++FLAGS
|
||||
WARNING_CCFLAGS WARNING_C++FLAGS
|
||||
|
||||
KERNEL_WARNING_CCFLAGS KERNEL_WARNING_C++FLAGS
|
||||
|
||||
DEBUG_FLAGS
|
||||
|
||||
DEBUG_$(HAIKU_DEBUG_LEVELS)_CCFLAGS DEBUG_$(HAIKU_DEBUG_LEVELS)_C++FLAGS
|
||||
|
||||
KERNEL_DEBUG_$(HAIKU_DEBUG_LEVELS)_CCFLAGS
|
||||
KERNEL_DEBUG_$(HAIKU_DEBUG_LEVELS)_C++FLAGS
|
||||
|
||||
PRIVATE_KERNEL_HEADERS
|
||||
|
||||
LIBSTDC++
|
||||
|
||||
ARCH_MACRO_DEFINE EXECUTABLE_MIME_TYPE
|
||||
|
||||
OBJECT_BASE_DIR COMMON_ARCH_OBJECT_DIR COMMON_DEBUG_OBJECT_DIR
|
||||
DEBUG_$(HAIKU_DEBUG_LEVELS)_OBJECT_DIR
|
||||
;
|
||||
|
||||
if $(TARGET_PLATFORM) = haiku {
|
||||
local var ;
|
||||
for var in $(buildVars) {
|
||||
TARGET_$(var) = $(HAIKU_$(var)) ;
|
||||
}
|
||||
|
||||
TARGET_GCC_LIB_DIR = $(HAIKU_GCC_LIB_DIR) ;
|
||||
TARGET_GCC_HEADERS_DIR = $(HAIKU_GCC_HEADERS_DIR) ;
|
||||
TARGET_GCC_LIBGCC = $(HAIKU_GCC_LIBGCC) ;
|
||||
TARGET_GCC_LIBGCC_OBJECTS = $(HAIKU_GCC_LIBGCC_OBJECTS) ;
|
||||
|
||||
TARGET_BOOT_PLATFORM = $(HAIKU_BOOT_PLATFORM) ;
|
||||
|
||||
} else {
|
||||
local var ;
|
||||
for var in $(buildVars) {
|
||||
TARGET_$(var) = $(HOST_$(var)) ;
|
||||
}
|
||||
|
||||
TARGET_GCC_LIB_DIR = ;
|
||||
TARGET_GCC_HEADERS_DIR = ;
|
||||
TARGET_GCC_LIBGCC = ;
|
||||
TARGET_GCC_LIBGCC_OBJECTS = ;
|
||||
|
||||
TARGET_BOOT_PLATFORM = ;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
# common stuff
|
||||
|
||||
# start with a clean slate
|
||||
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 ;
|
||||
|
||||
# Allow compiling unit tests on Zeta. Instead of fixing the PostMessage()
|
||||
# issues, they deprecated that nice function. This will enable it again:
|
||||
C++FLAGS += -D_ZETA_USING_DEPRECATED_API_=1 ;
|
||||
# TODO: Doesn't really belong here.
|
||||
|
||||
|
||||
# Defaults for warnings, optimization, and debugging.
|
||||
#
|
||||
WARNINGS ?= 1 ;
|
||||
OPTIM ?= -O2 ;
|
||||
DEBUG ?= 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 ;
|
||||
|
||||
|
||||
# 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 ;
|
||||
|
||||
|
||||
# output directories
|
||||
# TODO: Review this.
|
||||
HAIKU_DOCUMENTATION_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) documentation ] ;
|
||||
HAIKU_DOCUMENTATION_OBJECT_DIR ?= [ FDirName $(HAIKU_COMMON_PLATFORM_DIR)
|
||||
documentation ] ;
|
||||
|
||||
# TODO: Rethink test stuff.
|
||||
HAIKU_TEST_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) tests ] ;
|
||||
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 ] ;
|
||||
|
||||
HAIKU_PACKAGE_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) packages ] ;
|
||||
HAIKU_PACKAGE_OBJECT_DIR ?= [ FDirName $(HAIKU_OBJECT_DIR) packages ] ;
|
||||
|
||||
# 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_WARNING_C++FLAGS
|
||||
|
||||
# also add PLATFORM and SUPPORTED_PLATFORMS
|
||||
PLATFORM SUPPORTED_PLATFORMS
|
||||
;
|
||||
@@ -0,0 +1,168 @@
|
||||
# ConfigRules
|
||||
#
|
||||
# Contains rules providing the config variable feature. It allows to set the
|
||||
# values for certain variables for subdirectories in a central place. That is
|
||||
# one can, for instance, specify in a file like UserBuildConfig for which
|
||||
# directories to enable debugging, warnings, set special defines, compiler
|
||||
# flags and the like without needing to edit the Jamfiles for the respective
|
||||
# dirs.
|
||||
|
||||
rule ConfigObject
|
||||
{
|
||||
# ConfigObject <dir> [ : <varName> ] ;
|
||||
#
|
||||
# Private rule. Returns the dummy object on which the config variables are
|
||||
# set for a given subdir.
|
||||
#
|
||||
# <dir>: Parameters as passed to the SubDir rule, i.e. the name of the
|
||||
# TOP variable and the subdir tokens.
|
||||
#
|
||||
local config = $(2:E=__config__) ;
|
||||
local grist = [ FGrist root $(1) ] ;
|
||||
return $(config:G=$(grist)) ;
|
||||
}
|
||||
|
||||
rule SetConfigVar
|
||||
{
|
||||
# SetConfigVar <var> : <dir> : <value> [ : <scope> ] ;
|
||||
#
|
||||
# Sets a config variable for a specified directory to the given value.
|
||||
#
|
||||
# <var>: The name of the variable to be set.
|
||||
# <dir>: Parameters as passed to the SubDir rule, i.e. the name of the
|
||||
# TOP variable and the subdir tokens.
|
||||
# <value>: The value to which the variable shall be set.
|
||||
# <scope>: Either "global" or "local". The former implies that the variable
|
||||
# value shall also be used for subdirectories (recursively), if
|
||||
# for them the variable has not been set. The latter has the same
|
||||
# effect regarding subdirs as if the variable for the directory
|
||||
# is not set. Defaults to "global".
|
||||
#
|
||||
local var = $(1[1]) ;
|
||||
local config = [ ConfigObject $(2) ] ;
|
||||
local scope = $(4:E=global) ;
|
||||
|
||||
$(var) on $(config) = $(3) ;
|
||||
__set_$(var) on $(config) = $(scope) ;
|
||||
|
||||
if $(scope) = global {
|
||||
$(var) on [ ConfigObject $(2) : __inherited_config__ ] = $(3) ;
|
||||
}
|
||||
|
||||
if ! [ on $(config) return $(__configured) ] {
|
||||
__configured on $(config) = true ;
|
||||
__dir_tokens on $(config) = $(2) ;
|
||||
|
||||
HAIKU_EXISTING_SUBDIR_CONFIGS += $(config) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule AppendToConfigVar
|
||||
{
|
||||
# AppendToConfigVar <var> : <dir> : <value> [ : <scope> ] ;
|
||||
#
|
||||
# Appends a value to a config variable for a specified directory. Shortcut
|
||||
# for
|
||||
# SetConfigVar <var> : <dir> : [ ConfigVar <var> : <dir> ] <value
|
||||
# : <scope> ;
|
||||
#
|
||||
# <var>: The name of the variable to be set.
|
||||
# <dir>: Parameters as passed to the SubDir rule, i.e. the name of the
|
||||
# TOP variable and the subdir tokens.
|
||||
# <value>: The value which to append to the variables current value.
|
||||
# <scope>: Either "global" or "local". The former implies that the variable
|
||||
# value shall also be used for subdirectories (recursively), if
|
||||
# for them the variable has not been set. The latter has the same
|
||||
# effect regarding subdirs as if the variable for the directory
|
||||
# is not set. Defaults to "global".
|
||||
#
|
||||
SetConfigVar $(1) : $(2) : [ ConfigVar $(1) : $(2) ] $(3) : $(4) ;
|
||||
}
|
||||
|
||||
rule ConfigVar
|
||||
{
|
||||
# ConfigVar <var> : <dir> [ : <scope> ] ;
|
||||
#
|
||||
# Returns the value of a configuration variable for a given subdir.
|
||||
# If the variable is not set for the subdir, the rule is invoked
|
||||
# recursively for the parent directory with the scope "global". When
|
||||
# the root is reached without yielding a value, the value of the global
|
||||
# variable <var> is returned.
|
||||
#
|
||||
# <var>: The name of the variable whose value shall be returned.
|
||||
# <dir>: Parameters as passed to the SubDir rule, i.e. the name of the
|
||||
# TOP variable and the subdir tokens.
|
||||
# <scope>: If not given any scope passed to SetConfigVar for the given
|
||||
# directory will be accepted, otherwise it must match the scope
|
||||
# passed to SetConfigVar.
|
||||
#
|
||||
local var = $(1[1]) ;
|
||||
local dir = $(2) ;
|
||||
local config = [ ConfigObject $(dir) ] ;
|
||||
local scope = $(3) ;
|
||||
local varScope = [ on $(config) return $(__set_$(var)) ] ;
|
||||
if ( ! $(scope) && $(varScope) )
|
||||
|| ( $(scope) && $(scope) = $(varScope) )
|
||||
|| ! $(dir) {
|
||||
on $(config) return $($(var)) ;
|
||||
} else {
|
||||
dir = [ FReverse $(dir) ] ;
|
||||
return [ ConfigVar $(var) : [ FReverse $(dir[2-]) ] : global ] ;
|
||||
}
|
||||
}
|
||||
|
||||
rule PrepareSubDirConfigVariables
|
||||
{
|
||||
local dirTokens = $(1) ;
|
||||
local config = [ ConfigObject $(dirTokens) ] ;
|
||||
|
||||
if ! [ on $(config) return $(__prepared) ] {
|
||||
# prepare config for parent dir
|
||||
local parentDir = [ FReverse $(dirTokens) ] ;
|
||||
parentDir = [ FReverse $(parentDir[2-]) ] ;
|
||||
PrepareSubDirConfigVariables $(parentDir) ;
|
||||
|
||||
# set values for all config variables for the config and the inherited
|
||||
# config for this directory
|
||||
local inheritedConfig = [ ConfigObject $(dirTokens)
|
||||
: __inherited_config__ ] ;
|
||||
|
||||
on [ ConfigObject $(parentDir) : __inherited_config__ ] {
|
||||
for var in $(AUTO_SET_UP_CONFIG_VARIABLES) {
|
||||
$(var) on $(config) ?= $($(var)) ;
|
||||
$(var) on $(inheritedConfig) ?= $($(var)) ;
|
||||
}
|
||||
}
|
||||
|
||||
HAIKU_INHERITED_SUBDIR_CONFIG on $(config) = $(inheritedConfig) ;
|
||||
|
||||
__prepared on $(config) = true ;
|
||||
}
|
||||
}
|
||||
|
||||
rule PrepareConfigVariables
|
||||
{
|
||||
# initialize variables on the root config and the root inherited config
|
||||
# objects to the global values
|
||||
local rootConfig = [ ConfigObject ] ; # the root config object
|
||||
local inheritedRootConfig = [ ConfigObject : __inherited_config__ ] ;
|
||||
|
||||
for var in $(AUTO_SET_UP_CONFIG_VARIABLES) {
|
||||
$(var) on $(rootConfig) = $($(var)) ;
|
||||
$(var) on $(inheritedRootConfig) = $($(var)) ;
|
||||
}
|
||||
__prepared on $(rootConfig) = true ;
|
||||
|
||||
HAIKU_INHERITED_SUBDIR_CONFIG = $(rootConfig) ;
|
||||
|
||||
local config ;
|
||||
for config in $(HAIKU_EXISTING_SUBDIR_CONFIGS) {
|
||||
PrepareSubDirConfigVariables [ on $(config) return $(__dir_tokens) ] ;
|
||||
}
|
||||
}
|
||||
|
||||
# Some config variables that should be set up automatically for subdirs.
|
||||
AUTO_SET_UP_CONFIG_VARIABLES +=
|
||||
CCFLAGS C++FLAGS DEBUG DEFINES HDRS LINKFLAGS OPTIM OPTIMIZE
|
||||
SYSHDRS WARNINGS
|
||||
;
|
||||
@@ -0,0 +1,72 @@
|
||||
rule Man2Doc
|
||||
{
|
||||
local source = [ FGristFiles $(2) ] ;
|
||||
local binary = $(1) ;
|
||||
|
||||
SEARCH on $(source) = $(SEARCH_SOURCE) ;
|
||||
|
||||
MakeLocate $(binary)
|
||||
: [ FDirName $(HAIKU_DOCUMENTATION_OBJECT_DIR) Shell_Tools ] ;
|
||||
|
||||
Depends $(binary) : $(source) rman ;
|
||||
|
||||
LocalDepends doc_files : $(binary) ;
|
||||
Man2Doc1 $(binary) : rman $(source) ;
|
||||
LocalClean clean : $(binary) ;
|
||||
}
|
||||
|
||||
actions Man2Doc1
|
||||
{
|
||||
$(2[1]) -f XML "$(2[2])" > "$(1)" ;
|
||||
}
|
||||
|
||||
rule Man2Docs
|
||||
{
|
||||
# Man2Docs <sources> ;
|
||||
local source ;
|
||||
for source in [ FGristFiles $(1) ]
|
||||
{
|
||||
local target = $(source:S=.xml) ;
|
||||
|
||||
Man2Doc $(target) : $(source) ;
|
||||
}
|
||||
}
|
||||
|
||||
XSLTPROC ?= xsltproc ;
|
||||
|
||||
rule Doc2HTML
|
||||
{
|
||||
local source = [ FGristFiles $(1) ] ;
|
||||
local target = $(2) ;
|
||||
local xslsheet = $(3) ;
|
||||
local basedir = [ FDirName $(HAIKU_DOCUMENTATION_DIR) $(4) ] ;
|
||||
local paths = $(5) ;
|
||||
local options = $(6) ;
|
||||
|
||||
if ! $(target) {
|
||||
target = $(1:S=.html) ;
|
||||
}
|
||||
|
||||
SEARCH on $(source) = $(SEARCH_SOURCE) ;
|
||||
|
||||
MakeLocate $(target) : $(basedir) ;
|
||||
if $(2) {
|
||||
XSLBASEDIR on $(target) = -stringparam base.dir \"$(basedir)/\" ;
|
||||
}
|
||||
XSLSHEET on $(target) = $(xslsheet) ;
|
||||
XSLOPTIONS on $(target) = $(options) ;
|
||||
if $(2) = "" {
|
||||
XSLOUTPUT on $(target) = "-o "\"$(target:D=$(basedir))\" ;
|
||||
}
|
||||
|
||||
Depends $(target) : $(source) ;
|
||||
LocalDepends doc_files : $(target) ;
|
||||
XSLPROCPATHS on $(target) = -path \" $(paths:J=\ ) \" ;
|
||||
Doc2HTML1 $(target) : $(source) ;
|
||||
LocalClean clean : $(target) ;
|
||||
}
|
||||
|
||||
actions Doc2HTML1
|
||||
{
|
||||
$(XSLTPROC) -xinclude $(XSLPROCPATHS) $(XSLBASEDIR) $(XSLOPTIONS) $(XSLOUTPUT) $(XSLSHEET) $(2)
|
||||
}
|
||||
@@ -0,0 +1,219 @@
|
||||
rule SymLink
|
||||
{
|
||||
# SymLink <target> : <source> : <makeDefaultDependencies> ;
|
||||
# Links <target> to <source>.
|
||||
# <source> is the exact link contents. No binding is done.
|
||||
# <makeDefaultDependencies> If true, <target> will be made a dependency
|
||||
# of the `all' pseudo target, i.e. it will be made by default, and removed
|
||||
# on `jam clean'.
|
||||
|
||||
local target = $(1) ;
|
||||
local source = $(2) ;
|
||||
local makeDefaultDependencies = $(3) ;
|
||||
if ! $(makeDefaultDependencies) {
|
||||
makeDefaultDependencies = true ;
|
||||
}
|
||||
LINKCONTENTS on $(target) = $(source) ;
|
||||
SymLink1 $(target) ;
|
||||
if $(makeDefaultDependencies) = true {
|
||||
LocalDepends files : $(target) ;
|
||||
LocalClean clean : $(target) ;
|
||||
}
|
||||
}
|
||||
|
||||
actions SymLink1
|
||||
{
|
||||
$(RM) "$(1)" && $(LN) -s "$(LINKCONTENTS)" "$(1)"
|
||||
}
|
||||
|
||||
rule RelSymLink
|
||||
{
|
||||
# RelSymLink <link> : <link target> : <makeDefaultDependencies> ;
|
||||
# Creates a relative symbolic link from <link> to <link target>.
|
||||
# <link> and <link target> can be usual targets. They may have a grist
|
||||
# and don't need to have any dirname. Their LOCATE variables are used to
|
||||
# find their locations.
|
||||
# <makeDefaultDependencies> If true (which is the default), <link> will be
|
||||
# made a dependency of the `files' pseudo target, i.e. it will be made by
|
||||
# default, and removed on `jam clean'.
|
||||
|
||||
local target = $(1) ;
|
||||
local source = $(2) ;
|
||||
local makeDefaultDependencies = $(3) ;
|
||||
local targetDir = [ on $(target) FDirName $(LOCATE[1]) $(target:D) ] ;
|
||||
local sourceDir = [ on $(source) FDirName $(LOCATE[1]) $(source:D) ] ;
|
||||
local sourcePath = $(source:G=) ;
|
||||
sourcePath = $(sourcePath:D=$(sourceDir)) ;
|
||||
local targetDirComponents = [ FSplitPath $(targetDir) ] ;
|
||||
local sourceComponents = [ FSplitPath $(sourcePath) ] ;
|
||||
|
||||
SymLink $(target)
|
||||
: [ FRelPath $(targetDirComponents) : $(sourceComponents) ]
|
||||
: $(makeDefaultDependencies) ;
|
||||
NOUPDATE $(target) ;
|
||||
Depends $(target) : $(source) ;
|
||||
}
|
||||
|
||||
rule AbsSymLink
|
||||
{
|
||||
# AbsSymLink <link> : <link target> : <link dir>
|
||||
# : <makeDefaultDependencies> ;
|
||||
# Creates an absolute symbolic link from <link> to <link target>.
|
||||
# <link> and <link target> must be usual targets. If <link dir> is
|
||||
# given, then it is set as LOCATE directory on <link>.
|
||||
# <makeDefaultDependencies> If true (which is the default), <link> will be
|
||||
# made a dependency of the `files' pseudo target, i.e. it will be made by
|
||||
# default, and removed on `jam clean'.
|
||||
|
||||
local makeDefaultDependencies = $(4) ;
|
||||
if ! $(makeDefaultDependencies) {
|
||||
makeDefaultDependencies = true ;
|
||||
}
|
||||
|
||||
Depends $(1) : $(2) ;
|
||||
if $(3) {
|
||||
MakeLocate $(1) : $(3) ;
|
||||
}
|
||||
SEARCH on $(2) += $(SEARCH_SOURCE) ;
|
||||
if $(makeDefaultDependencies) = true {
|
||||
LocalDepends files : $(1) ;
|
||||
LocalClean clean : $(1) ;
|
||||
}
|
||||
}
|
||||
|
||||
actions AbsSymLink
|
||||
{
|
||||
target="$(2)"
|
||||
case "$target" in
|
||||
/*) ;;
|
||||
*) target=`pwd`/"$target";;
|
||||
esac
|
||||
$(RM) "$(1)" && $(LN) -s "$target" "$(1)"
|
||||
}
|
||||
|
||||
rule HaikuInstall
|
||||
{
|
||||
# Usage: HaikuInstall <[ install [ and uninstall ] pseudotarget ]>
|
||||
# : <directory> : <sources to install>
|
||||
# : [ <installgrist> ] : [ <install rule> ] ;
|
||||
local install = $(1[1]) ;
|
||||
install ?= install ;
|
||||
local uninstall = $(1[2]) ;
|
||||
uninstall ?= un$(install) ;
|
||||
local dir = $(2) ;
|
||||
local sources = $(3) ;
|
||||
local installgrist = $(4) ;
|
||||
installgrist ?= $(INSTALLGRIST) ;
|
||||
local installRule = $(5) ;
|
||||
installRule ?= Install ;
|
||||
local targets = $(sources:G=$(installgrist)) ;
|
||||
|
||||
NotFile $(install) ;
|
||||
NotFile $(uninstall) ;
|
||||
Depends $(install) : $(targets) ;
|
||||
Clean $(uninstall) : $(targets) ;
|
||||
|
||||
SEARCH on $(sources) += $(SEARCH_SOURCE) ;
|
||||
MakeLocate $(targets) : $(dir) ;
|
||||
|
||||
local source ;
|
||||
for source in $(sources) {
|
||||
local target = $(source:G=$(installgrist)) ;
|
||||
|
||||
Depends $(target) : $(source) ;
|
||||
$(installRule) $(target) : $(source) ;
|
||||
|
||||
if [ on $(target) return $(MODE) ] {
|
||||
Chmod $(target) ;
|
||||
}
|
||||
|
||||
if $(OWNER) && $(CHOWN) {
|
||||
Chown $(target) ;
|
||||
OWNER on $(target) = $(OWNER) ;
|
||||
}
|
||||
|
||||
if $(GROUP) && $(CHGRP) {
|
||||
Chgrp $(target) ;
|
||||
GROUP on $(target) = $(GROUP) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rule InstallAbsSymLinkAdapter
|
||||
{
|
||||
# InstallAbsSymLinkAdapter <link> : <link target>
|
||||
if ! [ on $(2) return $(TARGET) ] {
|
||||
TARGET on $(2) = [ on $(2) return $(SEARCH) ] ;
|
||||
}
|
||||
AbsSymLink $(1) : $(2) : : false ;
|
||||
}
|
||||
|
||||
rule HaikuInstallAbsSymLink
|
||||
{
|
||||
# Usage: HaikuInstallAbsSymLink <[ install [ and uninstall ] pseudotarget ]>
|
||||
# : <directory> : <sources to install>
|
||||
# : [ <installgrist> ] ;
|
||||
HaikuInstall $(1) : $(2) : $(3) : $(4) : InstallAbsSymLinkAdapter ;
|
||||
}
|
||||
|
||||
rule InstallRelSymLinkAdapter
|
||||
{
|
||||
# InstallRelSymLinkAdapter <link> : <link target>
|
||||
if ! [ on $(2) return $(TARGET) ] {
|
||||
TARGET on $(2) = [ on $(2) return $(SEARCH) ] ;
|
||||
}
|
||||
RelSymLink $(1) : $(2) : false ;
|
||||
}
|
||||
|
||||
rule HaikuInstallRelSymLink
|
||||
{
|
||||
# Usage: HaikuInstallRelSymLink <[ install [ and uninstall ] pseudotarget ]>
|
||||
# : <directory> : <sources to install>
|
||||
# : [ <installgrist> ] ;
|
||||
HaikuInstall $(1) : $(2) : $(3) : $(4) : InstallRelSymLinkAdapter ;
|
||||
}
|
||||
|
||||
|
||||
rule UnarchiveObjects
|
||||
{
|
||||
# UnarchiveObjects <target objects> : <static object>
|
||||
|
||||
MakeLocateArch $(1) ;
|
||||
Depends $(1) : $(2) ;
|
||||
SEARCH on $(2) = $(SEARCH_SOURCE) ;
|
||||
}
|
||||
|
||||
actions UnarchiveObjects
|
||||
{
|
||||
( cd $(1[1]:D) && $(TARGET_AR) $(TARGET_UNARFLAGS) "$(2)" $(1:BS) )
|
||||
}
|
||||
|
||||
|
||||
rule ObjectReference
|
||||
{
|
||||
# ObjectReference <reference object> : <source object>
|
||||
# Makes <reference object> refer to the same file as <source object>.
|
||||
# The filenames must of course be identical.
|
||||
# <source object> must have already been LOCATEd.
|
||||
|
||||
local ref = $(1) ;
|
||||
local source = $(2) ;
|
||||
if $(ref) != $(source) {
|
||||
Depends $(ref) : $(source) ;
|
||||
LOCATE on $(ref) = [ on $(source) return $(LOCATE) ] ;
|
||||
}
|
||||
}
|
||||
|
||||
rule ObjectReferences
|
||||
{
|
||||
# ObjectReferences <source objects>
|
||||
# Creates local references to <source objects>, i.e. identifiers with the
|
||||
# current grist referring to the same files. <source objects> must have
|
||||
# already been LOCATEd.
|
||||
|
||||
local source ;
|
||||
for source in $(1) {
|
||||
ObjectReference [ FGristFiles $(source) ] : $(source) ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
#-------------------------------------------------------------------------------
|
||||
# FreeType 2 specific rules and variables
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
FT2_INCLUDE = [ FDirName $(HAIKU_TOP) headers libs freetype2 ] ;
|
||||
FT2_SRC = [ FDirName $(HAIKU_TOP) src libs freetype2 ] ;
|
||||
|
||||
FT2_LIB = freetype ;
|
||||
|
||||
FT2_COMPONENTS ?= gzip # support for gzip-compressed files.
|
||||
autohint # auto-hinter
|
||||
autofit
|
||||
base # base component (public APIs)
|
||||
bdf # BDF font driver
|
||||
cache # cache sub-system
|
||||
cff # CFF/CEF font driver
|
||||
cid # Postscript CID-keyed font driver
|
||||
lzw # LZW routines
|
||||
otvalid
|
||||
pcf # PCF font driver
|
||||
pfr # PFR/TrueDoc font driver
|
||||
psaux # Common Postscript routines module
|
||||
pshinter # Postscript hinter module
|
||||
psnames # Postscript names handling
|
||||
raster # Monochrome rasterizer
|
||||
smooth # Anti-aliased rasterizer
|
||||
sfnt # SFNT-based format support routines
|
||||
truetype # TrueType font driver
|
||||
type1 # Postscript Type 1 font driver
|
||||
type42 # Postscript Type 42 (embedded TrueType) driver
|
||||
winfonts # Windows FON/FNT font driver
|
||||
;
|
||||
|
||||
rule UseFreeTypeHeaders
|
||||
{
|
||||
SubDirSysHdrs $(FT2_INCLUDE) ;
|
||||
}
|
||||
|
||||
rule UseFreeTypeObjectHeaders
|
||||
{
|
||||
# UseFreeTypeObjectHeaders <sources> [ : <objects> ] ;
|
||||
SourceSysHdrs $(1) : $(FT2_INCLUDE) : $(2) ;
|
||||
}
|
||||
|
||||
rule FT2_SubDir
|
||||
{
|
||||
# FT2_SubDir <dir>
|
||||
# <dir>: Components of a directory in the original hierarchy.
|
||||
local dir = $(1) ;
|
||||
local topDir ;
|
||||
switch $(dir[1])
|
||||
{
|
||||
case "include" : topDir = $(FT2_INCLUDE) ;
|
||||
case src : topDir = $(FT2_SRC) ;
|
||||
case * : ECHO "Unknown FreeType2 directory: " $(dir) ;
|
||||
}
|
||||
return [ FDirName $(topDir) $(dir[2-]) ] ;
|
||||
}
|
||||
|
||||
rule FT2_Library
|
||||
{
|
||||
# FT2_Library <libname> : <sources>
|
||||
# Builds objects from sources and adds the objects to the list of objects
|
||||
# to be linked into the library.
|
||||
# <libname> The name of the library.
|
||||
# <sources> The sources.
|
||||
|
||||
local library = lib$(1).so ;
|
||||
local sources = $(2) ;
|
||||
|
||||
Objects $(sources) ;
|
||||
LIBRARY_OBJECTS on $(library) += [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
|
||||
}
|
||||
|
||||
rule FT2_LinkLibrary
|
||||
{
|
||||
# FT2_LinkLibrary <libname>
|
||||
# Links the library from the objects build with FT2_LIBRARY before.
|
||||
|
||||
local library = lib$(1).so ;
|
||||
local objects = [ on $(library) return $(LIBRARY_OBJECTS) ] ;
|
||||
ObjectReferences $(objects) ;
|
||||
objects = [ FGristFiles $(objects) ] ;
|
||||
SharedLibraryFromObjects $(library) : $(objects) ;
|
||||
}
|
||||
@@ -0,0 +1,303 @@
|
||||
|
||||
# create directories that will remain empty
|
||||
AddDirectoryToHaikuImage home Desktop ;
|
||||
AddDirectoryToHaikuImage var log ;
|
||||
AddDirectoryToHaikuImage var tmp ;
|
||||
|
||||
# TODO: Remove the variables we don't need.
|
||||
BEOS_BIN = touch sync ln listarea listattr listsem listport
|
||||
true false ls df mount unmount cp mv ps sh mkdir sleep
|
||||
grep cat less clockconfig du rm date find locate xargs
|
||||
isvolume shutdown safemode sysinfo kill diff cmp
|
||||
renice rmattr addattr listdev pwd chmod chown chgrp dd
|
||||
tee md5sum catattr query lsindex mkindex roster listimage
|
||||
quit open translate setvolume waitfor uname iroster keymap
|
||||
strace rmdir error ifconfig ping traceroute arp pppconfig
|
||||
ppp_up gdb tail head zip unzip mountvolume top finddir groups
|
||||
id env basename factor tty dstcheck comm modifiers version
|
||||
csplit cut beep screen_blanker fortune play eject uptime sed gawk mimeset
|
||||
dirname
|
||||
;
|
||||
|
||||
BEOS_APPS = MiniTerminal Terminal Expander People ShowImage Clock Pulse
|
||||
Playground SoundRecorder BitmapDrawing Magnify DiskProbe AboutHaiku
|
||||
StyledEdit CDPlayer
|
||||
;
|
||||
BEOS_PREFERENCES = Backgrounds DataTranslations FileTypes Fonts Media Menu
|
||||
Mouse Keyboard Keymap Screen ScrollBar Sounds Time VirtualMemory
|
||||
Workspaces ScreenSaver
|
||||
;
|
||||
BEOS_SYSTEM_LIB = libbe.so libstdc++.r4.so libnet.so libmedia.so libtracker.so
|
||||
libtranslation.so libbind.so libnetapi.so libsocket.so libdebug.so
|
||||
libtextencoding.so libz.so libfreetype.so libpng.so libappserver.so
|
||||
libdevice.so libgame.so libscreensaver.so libroot.so
|
||||
;
|
||||
BEOS_SYSTEM_SERVERS = registrar debug_server syslog_daemon media_server
|
||||
media_addon_server input_server app_server fake_app_server
|
||||
;
|
||||
|
||||
BEOS_NETWORK_CORE = core ;
|
||||
BEOS_NETWORK_INTERFACES = ethernet loopback ppp ;
|
||||
BEOS_NETWORK_PPP = ipcp modem pap pppoe ;
|
||||
BEOS_NETWORK_PROTOCOLS = icmp ipv4 raw route tcp udp ;
|
||||
|
||||
BEOS_ADD_ONS_ACCELERANTS = radeon.accelerant nv.accelerant mga.accelerant
|
||||
nm.accelerant vesa.accelerant
|
||||
;
|
||||
BEOS_ADD_ONS_TRANSLATORS = STXTTranslator RTF-Translator PNGTranslator
|
||||
JPEGTranslator GIFTranslator
|
||||
;
|
||||
BEOS_ADD_ONS_MEDIA = mixer.media_addon legacy.media_addon
|
||||
multi_audio.media_addon
|
||||
;
|
||||
BEOS_ADD_ONS_MEDIA_PLUGINS = aiff_reader avcodec mp3_decoder musepack
|
||||
raw_decoder wav_reader mov_reader au_reader avi_reader mp3_reader ogg
|
||||
speex vorbis
|
||||
# ac3_decoder theora matroska
|
||||
;
|
||||
BEOS_ADD_ONS_INPUT = <input>keyboard <input>mouse canna screen_saver ;
|
||||
BEOS_ADD_ONS_SCREENSAVERS = Haiku ;
|
||||
BEOS_ADD_ONS_DRIVERS_AUDIO = ich_ac97 auvia emuxki ;
|
||||
BEOS_ADD_ONS_DRIVERS_GRAPHICS = radeon.driver nv.driver nm.driver mga.driver
|
||||
vesa
|
||||
;
|
||||
BEOS_ADD_ONS_DRIVERS_MISC = keyboard scsi_dsk scsi_cd dprintf null zero random
|
||||
ps2_hid <driver>tty console <driver>config
|
||||
;
|
||||
BEOS_ADD_ONS_DRIVERS_NET = ipro1000 rtl8139 rtl8169 sis900
|
||||
via-rhine wb840 net_stack_driver
|
||||
# bcm440x bcm570x (only available with GPLd add-ons)
|
||||
;
|
||||
BEOS_ADD_ONS_BUS_MANAGERS = pci isa ide scsi config_manager ;
|
||||
BEOS_ADD_ONS_KERNEL_MISC = ide_isa generic_ide_pci block_io fast_log
|
||||
ide_adapter locked_pool scsi_periph intel keyboard vga_text
|
||||
;
|
||||
BEOS_ADD_ONS_FILESYSTEMS = bfs ;
|
||||
BEOS_DATA_FILES = timezone_files keymap_files ;
|
||||
|
||||
|
||||
# modules
|
||||
AddFilesToHaikuImage beos system add-ons kernel bus_managers
|
||||
: $(BEOS_ADD_ONS_BUS_MANAGERS) ;
|
||||
AddFilesToHaikuImage beos system add-ons kernel busses ide
|
||||
: generic_ide_pci ide_isa ;
|
||||
AddFilesToHaikuImage beos system add-ons kernel console : vga_text ;
|
||||
AddFilesToHaikuImage beos system add-ons kernel file_systems : bfs ;
|
||||
AddFilesToHaikuImage beos system add-ons kernel generic
|
||||
: block_io fast_log ide_adapter locked_pool scsi_periph ;
|
||||
AddFilesToHaikuImage beos system add-ons kernel partitioning_systems : intel ;
|
||||
|
||||
# drivers
|
||||
AddDriversToHaikuImage : console dprintf keyboard null random
|
||||
<driver>tty zero ;
|
||||
AddDriversToHaikuImage audio multi : $(BEOS_ADD_ONS_DRIVERS_AUDIO) ;
|
||||
AddDriversToHaikuImage disk scsi : scsi_cd scsi_dsk ;
|
||||
AddDriversToHaikuImage graphics : $(BEOS_ADD_ONS_DRIVERS_GRAPHICS) ;
|
||||
AddDriversToHaikuImage input : ps2_hid ;
|
||||
AddDriversToHaikuImage misc : <driver>config ;
|
||||
AddDriversToHaikuImage net : $(BEOS_ADD_ONS_DRIVERS_NET) ;
|
||||
|
||||
# kernel
|
||||
AddFilesToHaikuImage beos system : kernel_$(TARGET_ARCH) ;
|
||||
|
||||
# libs
|
||||
AddFilesToHaikuImage beos system lib : $(BEOS_SYSTEM_LIB) rld.so ;
|
||||
|
||||
# servers
|
||||
AddFilesToHaikuImage beos system servers : $(BEOS_SYSTEM_SERVERS) ;
|
||||
|
||||
# apps
|
||||
AddFilesToHaikuImage beos : Deskbar Tracker ;
|
||||
AddFilesToHaikuImage beos bin : $(BEOS_BIN) consoled <bin>route ;
|
||||
AddFilesToHaikuImage beos apps : $(BEOS_APPS) ;
|
||||
AddFilesToHaikuImage beos preferences : $(BEOS_PREFERENCES) ;
|
||||
|
||||
AddSymlinkToHaikuImage beos bin : more : less ;
|
||||
|
||||
|
||||
# scripts and data files
|
||||
local bootScripts = Bootscript SetupEnvironment Netscript ;
|
||||
SEARCH on $(bootScripts) = [ FDirName $(HAIKU_TOP) data system boot ] ;
|
||||
AddFilesToHaikuImage beos system boot : $(bootScripts) ;
|
||||
|
||||
# TODO: Use data/etc/termcap or src/libs/termcap.src?
|
||||
local etcFiles = fortunes profile termcap ;
|
||||
etcFiles = $(etcFiles:G=etc) ;
|
||||
SEARCH on $(etcFiles) = [ FDirName $(HAIKU_TOP) data etc ] ;
|
||||
AddFilesToHaikuImage beos etc : $(etcFiles) ;
|
||||
|
||||
local fontDir = [ FDirName $(HAIKU_TOP) data etc fonts ] ;
|
||||
local psFonts = [ Glob $(fontDir)/psfonts : *.afm *.pfb ] ;
|
||||
local ttFonts = [ Glob $(fontDir)/ttfonts : *.ttf ] ;
|
||||
AddFilesToHaikuImage beos etc fonts psfonts : $(psFonts) ;
|
||||
AddFilesToHaikuImage beos etc fonts ttfonts : $(ttFonts) ;
|
||||
|
||||
local kanbeDir = [ FDirName $(HAIKU_TOP) data etc KanBe ] ;
|
||||
local kanbeDefault = [ Glob $(kanbeDir)/default : *.canna *.gz ] ;
|
||||
local kanbeDic = [ Glob $(kanbeDir)/dic : *.cbp ] ;
|
||||
local kanbeDicCanna = [ Glob $(kanbeDir)/dic/canna
|
||||
: *.cld *.ctd *.cbd *.dir ] ;
|
||||
AddFilesToHaikuImage beos etc KanBe default : $(kanbeDefault) ;
|
||||
AddFilesToHaikuImage beos etc KanBe dic : $(kanbeDic) ;
|
||||
AddFilesToHaikuImage beos etc KanBe dic canna : $(kanbeDicCanna) ;
|
||||
AddDirectoryToHaikuImage beos etc KanBe dic group ;
|
||||
AddDirectoryToHaikuImage beos etc KanBe dic user ;
|
||||
|
||||
# TODO: We must get rid of this earlier or later.
|
||||
#
|
||||
# if [ -e /boot/beos/etc/fonts/ttfonts/Swiss721.ttf ]; then
|
||||
# $cp ${sPrefix}/boot/beos/etc/fonts/ttfonts/Courier10Pitch.ttf $targetDir/beos/etc/fonts/ttfonts/
|
||||
# $cp ${sPrefix}/boot/beos/etc/fonts/ttfonts/Swiss721_Bold.ttf $targetDir/beos/etc/fonts/ttfonts/
|
||||
# $cp ${sPrefix}/boot/beos/etc/fonts/ttfonts/Swiss721.ttf $targetDir/beos/etc/fonts/ttfonts/
|
||||
# fi
|
||||
|
||||
local libnetFiles = networks protocols resolv.conf services ;
|
||||
libnetFiles = $(libnetFiles:G=libnet-files) ;
|
||||
SEARCH on $(libnetFiles) = [ FDirName $(HAIKU_TOP) src kits network libnet ] ;
|
||||
AddFilesToHaikuImage beos etc : $(libnetFiles) ;
|
||||
|
||||
local keymapFiles = [ GLOB $(SUBDIR) : *.keymap ] ;
|
||||
keymapFiles = $(keymapFiles:BG=keymap) ;
|
||||
AddFilesToHaikuImage beos etc Keymap : $(libnetFiles) ;
|
||||
|
||||
local timezones = [ FTimeZoneBinaries $(HAIKU_TIME_ZONE_SOURCES) : : true ] ;
|
||||
for timezone in $(timezones) {
|
||||
local dir = [ on $(timezone) return $(RELATIVE_TIMEZONE_DIR) ] ;
|
||||
AddFilesToHaikuImage beos etc timezones $(dir) : $(timezone) ;
|
||||
}
|
||||
|
||||
local driverSettingsFiles = <driver-settings>kernel ;
|
||||
SEARCH on $(driverSettingsFiles)
|
||||
= [ FDirName $(HAIKU_TOP) data settings kernel drivers ] ;
|
||||
AddFilesToHaikuImage home config settings kernel drivers
|
||||
: $(driverSettingsFiles) ;
|
||||
# TODO: This looks like it belongs to someones UserBuildConfig.
|
||||
# if [ -e data/settings/kernel/drivers/vesa ]; then
|
||||
# $cp ${sPrefix}data/settings/kernel/drivers/vesa \
|
||||
# $targetDir/home/config/settings/kernel/drivers/
|
||||
# fi
|
||||
|
||||
AddSymlinkToHaikuImage home config settings
|
||||
: /boot/beos/etc/timezones/Europe/Paris : timezone ;
|
||||
|
||||
AddFilesToHaikuImage home config settings kernel drivers
|
||||
: <keymap>US-International : Key_map ;
|
||||
|
||||
# boot loader
|
||||
AddFilesToHaikuImage beos system : zbeos ;
|
||||
|
||||
# boot module links
|
||||
AddBootModuleSymlinks config_manager bfs block_io fast_log generic_ide_pci isa
|
||||
ide ide_adapter ide_isa intel locked_pool pci scsi scsi_cd scsi_dsk
|
||||
scsi_periph
|
||||
;
|
||||
|
||||
# add-ons
|
||||
AddFilesToHaikuImage beos system add-ons accelerants
|
||||
: $(BEOS_ADD_ONS_ACCELERANTS) ;
|
||||
AddFilesToHaikuImage beos system add-ons Translators
|
||||
: $(BEOS_ADD_ONS_TRANSLATORS) ;
|
||||
AddFilesToHaikuImage beos system add-ons media : $(BEOS_ADD_ONS_MEDIA) ;
|
||||
AddFilesToHaikuImage beos system add-ons media plugins
|
||||
: $(BEOS_ADD_ONS_MEDIA_PLUGINS) ;
|
||||
AddFilesToHaikuImage beos system add-ons input_server devices
|
||||
: <input>keyboard <input>mouse ;
|
||||
AddFilesToHaikuImage beos system add-ons input_server filters : screen_saver ;
|
||||
AddFilesToHaikuImage beos system add-ons input_server methods : canna ;
|
||||
AddFilesToHaikuImage beos system add-ons kernel network
|
||||
: $(BEOS_NETWORK_CORE) ;
|
||||
AddFilesToHaikuImage beos system add-ons kernel network interfaces
|
||||
: $(BEOS_NETWORK_INTERFACES) ;
|
||||
AddFilesToHaikuImage beos system add-ons kernel network ppp
|
||||
: $(BEOS_NETWORK_PPP) ;
|
||||
AddFilesToHaikuImage beos system add-ons kernel network protocols
|
||||
: $(BEOS_NETWORK_PROTOCOLS) ;
|
||||
AddFilesToHaikuImage beos system add-ons Screen\ Savers
|
||||
: $(BEOS_ADD_ONS_SCREENSAVERS) ;
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
# Set image name and directory defaults and locate the image.
|
||||
HAIKU_IMAGE_NAME ?= haiku.image ;
|
||||
HAIKU_IMAGE_DIR ?= $(HAIKU_OUTPUT_DIR) ;
|
||||
HAIKU_IMAGE ?= $(HAIKU_IMAGE_NAME) ;
|
||||
HAIKU_IMAGE_SIZE ?= 80 ; # 80 MB
|
||||
MakeLocate $(HAIKU_IMAGE) : $(HAIKU_IMAGE_DIR) ;
|
||||
|
||||
# Set the default installation directory.
|
||||
HAIKU_INSTALL_DIR ?= /haiku ;
|
||||
|
||||
# the pseudo target all image contents is attached to
|
||||
NotFile haiku-image-contents ;
|
||||
|
||||
# prepare the script that initializes the shell variables
|
||||
HAIKU_IMAGE_INIT_VARIABLES_SCRIPT = <HaikuImage>haiku.image-init-vars ;
|
||||
local script = $(HAIKU_IMAGE_INIT_VARIABLES_SCRIPT) ;
|
||||
MakeLocate $(script) : $(HAIKU_OUTPUT_DIR) ;
|
||||
Always $(script) ;
|
||||
|
||||
AddVariableToScript $(script) : sourceDir : $(HAIKU_TOP) ;
|
||||
AddVariableToScript $(script) : outputDir : $(HAIKU_OUTPUT_DIR) ;
|
||||
AddVariableToScript $(script) : tmpDir : $(HAIKU_TMP_DIR) ;
|
||||
AddVariableToScript $(script) : installDir : $(HAIKU_INSTALL_DIR) ;
|
||||
#AddVariableToScript $(script) : isImage : 1 ;
|
||||
AddVariableToScript $(script) : imageSize : $(HAIKU_IMAGE_SIZE) ;
|
||||
AddVariableToScript $(script) : addBuildCompatibilityLibDir
|
||||
: $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) ;
|
||||
AddTargetVariableToScript $(script) : bfs_shell : bfsShell ;
|
||||
AddTargetVariableToScript $(script) : fs_shell_command : fsShellCommand ;
|
||||
AddTargetVariableToScript $(script) : <build>copyattr ;
|
||||
AddTargetVariableToScript $(script) : <build>makebootable ;
|
||||
AddTargetVariableToScript $(script) : <build>rc ;
|
||||
AddTargetVariableToScript $(script) : <build>resattr ;
|
||||
#AddTargetVariableToScript $(script) : $(HAIKU_IMAGE) : imagePath ;
|
||||
# causes a cyclic dependency
|
||||
AddVariableToScript $(script) : imagePath
|
||||
: [ FDirName $(HAIKU_IMAGE_DIR) $(HAIKU_IMAGE_NAME) ] ;
|
||||
|
||||
# create the other scripts
|
||||
HAIKU_IMAGE_MAKE_DIRS_SCRIPT = <HaikuImage>haiku.image-make-dirs ;
|
||||
HAIKU_IMAGE_COPY_FILES_SCRIPT = <HaikuImage>haiku.image-copy-files ;
|
||||
MakeLocate $(HAIKU_IMAGE_MAKE_DIRS_SCRIPT) $(HAIKU_IMAGE_COPY_FILES_SCRIPT)
|
||||
: $(HAIKU_OUTPUT_DIR) ;
|
||||
|
||||
CreateHaikuImageMakeDirectoriesScript $(HAIKU_IMAGE_MAKE_DIRS_SCRIPT) ;
|
||||
CreateHaikuImageCopyFilesScript $(HAIKU_IMAGE_COPY_FILES_SCRIPT) ;
|
||||
|
||||
# Convenience wrapper rule around BuildHaikuImage.
|
||||
rule _BuildHaikuImage
|
||||
{
|
||||
# _BuildHaikuImage <image target> : <isImage> ;
|
||||
#
|
||||
local image = $(1) ;
|
||||
local isImage = $(2) ;
|
||||
|
||||
# build the image
|
||||
# HAIKU_IMAGE_EARLY_USER_SCRIPTS, HAIKU_IMAGE_LATE_USER_SCRIPTS can be
|
||||
# specified by the user.
|
||||
BuildHaikuImage $(image) :
|
||||
$(HAIKU_IMAGE_INIT_VARIABLES_SCRIPT)
|
||||
$(HAIKU_IMAGE_EARLY_USER_SCRIPTS)
|
||||
$(HAIKU_IMAGE_MAKE_DIRS_SCRIPT)
|
||||
$(HAIKU_IMAGE_COPY_FILES_SCRIPT)
|
||||
$(HAIKU_IMAGE_LATE_USER_SCRIPTS)
|
||||
: $(isImage)
|
||||
;
|
||||
|
||||
# remove the scripts we have generated
|
||||
RmTemps $(image) :
|
||||
$(HAIKU_IMAGE_INIT_VARIABLES_SCRIPT)
|
||||
$(HAIKU_IMAGE_MAKE_DIRS_SCRIPT)
|
||||
$(HAIKU_IMAGE_COPY_FILES_SCRIPT)
|
||||
;
|
||||
}
|
||||
|
||||
# build the image
|
||||
_BuildHaikuImage $(HAIKU_IMAGE) : true ;
|
||||
NotFile haiku-image ;
|
||||
Depends haiku-image : $(HAIKU_IMAGE) ;
|
||||
|
||||
# install Haiku into a directory
|
||||
NotFile install-haiku ;
|
||||
_BuildHaikuImage install-haiku : 0 ;
|
||||
@@ -0,0 +1,358 @@
|
||||
|
||||
# FSysIncludes <dirs> ;
|
||||
#
|
||||
# Counterpart of FIncludes for system include search paths.
|
||||
#
|
||||
#if $(OSPLAT) = X86 {
|
||||
rule FSysIncludes { return -I$(<) ; }
|
||||
HDRS_INCLUDES_SEPARATOR = -I- ;
|
||||
# } else {
|
||||
# rule FSysIncludes { return "-i "$(<) ; }
|
||||
# HDRS_INCLUDES_SEPARATOR = -i- ;
|
||||
# }
|
||||
# mwcc support commented out
|
||||
|
||||
rule SubDirSysHdrs
|
||||
{
|
||||
# SubDirSysHdrs <dirs> ;
|
||||
#
|
||||
# Adds directories to the system include search paths for the current
|
||||
# subdirectory. Counterpart of SubDirHdrs which adds non-system include
|
||||
# search paths.
|
||||
#
|
||||
# <dirs>: The directories to be added to the current subdir's system
|
||||
# include search paths.
|
||||
#
|
||||
SUBDIRSYSHDRS += [ FDirName $(1) ] ;
|
||||
}
|
||||
|
||||
rule ObjectSysHdrs
|
||||
{
|
||||
# ObjectSysHdrs <sources or objects> : <headers> : <gristed objects>
|
||||
#
|
||||
# Adds directories to the system include search paths for the given
|
||||
# sources or objects. Counterpart of ObjectHdrs which adds non-system
|
||||
# include search paths.
|
||||
#
|
||||
# NOTE: With this incarnation of the Haiku build system this rule doesn't
|
||||
# need to be invoked *after* the rule that generates the objects anymore.
|
||||
# Actually it is even encouraged to do that *before*. Same for ObjectHdrs.
|
||||
#
|
||||
# <sources or objects>: The targets for which to add system include
|
||||
# search paths.
|
||||
# <dirs>: The directories to be added to the given objects' system
|
||||
# include search paths.
|
||||
#
|
||||
|
||||
local objects = [ FGristFiles $(1:S=$(SUFOBJ)) ] $(3) ;
|
||||
local headers = $(2) ;
|
||||
|
||||
local file ;
|
||||
for file in $(objects) {
|
||||
on $(file) {
|
||||
local sysHeaders = $(SYSHDRS) $(headers) ;
|
||||
SYSHDRS on $(file) = $(sysHeaders) ;
|
||||
|
||||
# reformat ASHDRS and CCHDRS
|
||||
local fileHeaders = [ FIncludes $(HDRS) ]
|
||||
$(HDRS_INCLUDES_SEPARATOR) [ FIncludes $(sysHeaders) ] ;
|
||||
ASHDRS on $(file) = $(fileHeaders) ;
|
||||
CCHDRS on $(file) = $(fileHeaders) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rule SourceHdrs
|
||||
{
|
||||
# SourceHdrs <sources> : <headers> [ : <gristed objects> ] ;
|
||||
#
|
||||
# Is a wrapper for ObjectHdrs, that passes <sources> and <headers> or,
|
||||
# if supplied <objects> and <headers>, and also adjusts HDRSEARCH (not
|
||||
# done by ObjectHdrs).
|
||||
|
||||
local sources = [ FGristFiles $(1) ] ;
|
||||
local headers = $(2) ;
|
||||
local objects = $(3) ;
|
||||
|
||||
ObjectHdrs $(sources) : $(headers) : $(objects) ;
|
||||
|
||||
# Also add the header search dirs to HDRSEARCH. Note, that these dirs
|
||||
# will be listed after the STDHDRS (if any), but that's better than not
|
||||
# being listed at all.
|
||||
HDRSEARCH on $(sources) += $(headers) ;
|
||||
}
|
||||
|
||||
rule SourceSysHdrs
|
||||
{
|
||||
# SourceSysHdrs <sources> : <headers> [ : <gristed objects> ] ;
|
||||
#
|
||||
# Is a wrapper for ObjectSysHdrs, that passes <sources> and <headers> or,
|
||||
# if supplied <objects> and <headers>, and also adjusts HDRSEARCH (not
|
||||
# done by ObjectSysHdrs).
|
||||
|
||||
local sources = [ FGristFiles $(1) ] ;
|
||||
local headers = $(2) ;
|
||||
local objects = $(3) ;
|
||||
|
||||
ObjectSysHdrs $(sources) : $(headers) : $(objects) ;
|
||||
|
||||
# Also add the header search dirs to HDRSEARCH. Note, that these dirs
|
||||
# will be listed after the STDHDRS (if any), but that's better than not
|
||||
# being listed at all.
|
||||
HDRSEARCH on $(sources) += $(headers) ;
|
||||
}
|
||||
|
||||
rule PublicHeaders
|
||||
{
|
||||
# PublicHeaders <group list>
|
||||
#
|
||||
# Returns the directory names for the public header dirs identified by
|
||||
# <group list>.
|
||||
|
||||
local list = $(1) ;
|
||||
local dirs = [ FDirName $(HAIKU_TOP) headers os ] ;
|
||||
|
||||
for i in $(list) {
|
||||
dirs += [ FDirName $(HAIKU_TOP) headers os $(i) ] ;
|
||||
}
|
||||
return $(dirs) ;
|
||||
}
|
||||
|
||||
rule PrivateHeaders
|
||||
{
|
||||
# PrivateHeaders <group list>
|
||||
#
|
||||
# Returns the directory names for the private header dirs identified by
|
||||
# <group list>.
|
||||
|
||||
local list = $(1) ;
|
||||
local dirs ;
|
||||
for i in $(list) {
|
||||
dirs += [ FDirName $(HAIKU_TOP) headers private $(i) ] ;
|
||||
}
|
||||
return $(dirs) ;
|
||||
}
|
||||
|
||||
rule LibraryHeaders
|
||||
{
|
||||
# LibraryHeaders <group list>
|
||||
#
|
||||
# Returns the directory names for the library header dirs identified by
|
||||
# <group list>.
|
||||
|
||||
local list = $(1) ;
|
||||
local dirs ;
|
||||
for i in $(list) {
|
||||
dirs += [ FDirName $(HAIKU_TOP) headers libs $(i) ] ;
|
||||
}
|
||||
return $(dirs) ;
|
||||
}
|
||||
|
||||
rule ArchHeaders
|
||||
{
|
||||
# usage: ArchHeaders <arch> ;
|
||||
#
|
||||
# <arch> specifies the architecture (e.g. x86).
|
||||
|
||||
return [ FDirName $(HAIKU_TOP) headers private kernel arch $(1) ] ;
|
||||
}
|
||||
|
||||
rule UseHeaders
|
||||
{
|
||||
# UseHeaders <headers> [ : <system> ] ;
|
||||
#
|
||||
# Adds the C header dirs <headers> to the header search
|
||||
# dirs of the subdirectory.
|
||||
# If <system> is "true", the dirs are added as system otherwise local
|
||||
# search dirs.
|
||||
# NOTE: This rule must be invoked *before* the rule that builds the objects.
|
||||
|
||||
local header ;
|
||||
if $(2) = true {
|
||||
for header in $(1) {
|
||||
SubDirSysHdrs $(header) ;
|
||||
}
|
||||
} else {
|
||||
for header in $(1) {
|
||||
SubDirHdrs $(header) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rule UsePublicHeaders
|
||||
{
|
||||
# UsePublicHeaders <group list> ;
|
||||
#
|
||||
# Adds the public C header dirs given by <group list> to the header search
|
||||
# dirs of the subdirectory.
|
||||
# NOTE: This rule must be invoked *before* the rule that builds the
|
||||
# objects.
|
||||
|
||||
UseHeaders [ PublicHeaders $(1) ] : true ;
|
||||
}
|
||||
|
||||
rule UsePublicObjectHeaders
|
||||
{
|
||||
# UsePublicObjectHeaders <sources> : <group list> [ : <objects> ] ;
|
||||
#
|
||||
# Adds the public C header dirs given by <group list> to the header search
|
||||
# dirs of either the object targets of <sources> or if supplied to
|
||||
# <objects>. Also adjusts HDRSEARCH of <sources>.
|
||||
# NOTE: This rule must be invoked *after* the rule that builds the objects.
|
||||
|
||||
SourceSysHdrs $(1) : [ PublicHeaders $(2) ] : $(3) ;
|
||||
}
|
||||
|
||||
rule UsePrivateHeaders
|
||||
{
|
||||
# UsePrivateHeaders <group list> [ : <system> ] ;
|
||||
#
|
||||
# Adds the private C header dirs given by <group list> to the header search
|
||||
# dirs of the subdirectory.
|
||||
# <system> specifies whether to add the dirs as system or local header
|
||||
# search dirs. Defaults to "true".
|
||||
# NOTE: This rule must be invoked *before* the rule that builds the objects.
|
||||
|
||||
local system = $(2) ;
|
||||
system ?= true ;
|
||||
|
||||
UseHeaders [ PrivateHeaders $(1) ] : $(system) ;
|
||||
}
|
||||
|
||||
rule UsePrivateObjectHeaders
|
||||
{
|
||||
# UsePrivateObjectHeaders <sources> : <group list> [ : <objects>
|
||||
# [ : <system> ] ] ;
|
||||
#
|
||||
# Adds the private C header dirs given by <group list> to the header search
|
||||
# dirs of either the object targets of <sources> or if supplied to
|
||||
# <objects>. Also adjusts HDRSEARCH of <sources>.
|
||||
# <system> specifies whether to add the dirs as system or local header
|
||||
# search dirs. Defaults to "true".
|
||||
# NOTE: This rule must be invoked *after* the rule that builds the objects.
|
||||
|
||||
local system = $(4) ;
|
||||
system ?= true ;
|
||||
|
||||
if $(system) = true {
|
||||
SourceSysHdrs $(1) : [ PrivateHeaders $(2) ] : $(3) ;
|
||||
} else {
|
||||
SourceHdrs $(1) : [ PrivateHeaders $(2) ] : $(3) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule UseCppUnitHeaders
|
||||
{
|
||||
SubDirSysHdrs [ FDirName $(HAIKU_TOP) headers tools cppunit ] ;
|
||||
}
|
||||
|
||||
rule UseCppUnitObjectHeaders
|
||||
{
|
||||
# UseCppUnitObjectHeaders <sources> [ : <objects> ] ;
|
||||
SourceSysHdrs $(1) : [ FDirName $(HAIKU_TOP) headers tools cppunit ]
|
||||
: $(2) ;
|
||||
}
|
||||
|
||||
rule UseArchHeaders
|
||||
{
|
||||
# usage: UseArchHeaders <arch> ;
|
||||
#
|
||||
# <arch> specifies the architecture (e.g. x86).
|
||||
# NOTE: This rule must be invoked *before* the rule that builds the objects.
|
||||
|
||||
local headers = [ ArchHeaders $(1) ] ;
|
||||
|
||||
UseHeaders $(headers) : true ;
|
||||
}
|
||||
|
||||
rule UseArchObjectHeaders
|
||||
{
|
||||
# usage: UseArchObjectHeaders <sources> : <arch> : [ <objects> ] ;
|
||||
#
|
||||
# <arch> specifies the architecture (e.g. x86).
|
||||
# <sources_or_objects> Source or object files.
|
||||
# NOTE: This rule must be invoked *after* the rule that builds the objects.
|
||||
|
||||
local sources = $(1) ;
|
||||
local headers = [ ArchHeaders $(2) ] ;
|
||||
local objects = $(3) ;
|
||||
local targets ;
|
||||
if $(objects) {
|
||||
targets = $(objects) ;
|
||||
} else {
|
||||
targets = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
|
||||
}
|
||||
|
||||
SourceSysHdrs $(sources) : $(headers) : $(objects) ;
|
||||
}
|
||||
|
||||
rule UsePosixObjectHeaders
|
||||
{
|
||||
# UsePosixObjectHeaders <sources> [ : <objects> ] ;
|
||||
#
|
||||
# Adds the POSIX header dir to the header search
|
||||
# dirs of either the object targets of <sources> or if supplied to
|
||||
# <objects>. Also adjusts HDRSEARCH of <sources>.
|
||||
# NOTE: This rule must be invoked *after* the rule that builds the objects.
|
||||
|
||||
SourceSysHdrs $(1) : [ FDirName $(HAIKU_TOP) headers posix ] : $(2) ;
|
||||
}
|
||||
|
||||
rule UseLibraryHeaders
|
||||
{
|
||||
# UseLibraryHeaders <group list> ;
|
||||
#
|
||||
# Adds the library header dirs given by <group list> to the header search
|
||||
# dirs of the subdirectory.
|
||||
# NOTE: This rule must be invoked *before* the rule that builds the objects.
|
||||
|
||||
UseHeaders [ LibraryHeaders $(1) ] : true ;
|
||||
}
|
||||
|
||||
rule FStandardOSHeaders
|
||||
{
|
||||
local osIncludes = add-ons add-ons/file_system add-ons/graphics
|
||||
add-ons/input_server add-ons/screen_saver
|
||||
add-ons/tracker app device drivers game interface
|
||||
kernel media mail midi midi2 net opengl storage support
|
||||
translation ;
|
||||
|
||||
return [ PublicHeaders $(osIncludes) ] ;
|
||||
}
|
||||
|
||||
rule FStandardHeaders
|
||||
{
|
||||
local osIncludes = add-ons add-ons/file_system add-ons/graphics
|
||||
add-ons/input_server add-ons/screen_saver
|
||||
add-ons/tracker app device drivers game interface
|
||||
kernel media mail midi midi2 net opengl storage support
|
||||
translation ;
|
||||
|
||||
# Use headers directory, to allow to do things like include <posix/string.h>
|
||||
local headers = [ FDirName $(HAIKU_TOP) headers ] ;
|
||||
|
||||
# Use posix headers directory
|
||||
headers += [ FDirName $(HAIKU_TOP) headers posix ] ;
|
||||
|
||||
# Use GNU headers directory
|
||||
headers += [ FDirName $(HAIKU_TOP) headers gnu ] ;
|
||||
|
||||
# Use glibc headers
|
||||
headers += [ FDirName $(HAIKU_TOP) headers glibc ] ;
|
||||
|
||||
headers += [ FDirName $(HAIKU_TOP) headers cpp ] ;
|
||||
|
||||
# Use public OS header directories
|
||||
headers += [ PublicHeaders $(osIncludes) ] ;
|
||||
|
||||
# Use the root of the private headers -- not so nice, but simplifies things.
|
||||
headers += [ PrivateHeaders $(DOT) ] ;
|
||||
|
||||
# The platform (compiler actually) dependent headers.
|
||||
headers += $(HAIKU_GCC_HEADERS_DIR) ;
|
||||
|
||||
return $(headers) ;
|
||||
}
|
||||
|
||||
# SUBDIRSYSHDRS shall be reset automatically for each subdir
|
||||
SUBDIRRESET += SYSHDRS ;
|
||||
@@ -0,0 +1,248 @@
|
||||
# Rules without side effects.
|
||||
|
||||
# Vanilla Jam compatibility
|
||||
if ! $(INVOCATION_SUBDIR_SET) {
|
||||
rule FIsPrefix
|
||||
{
|
||||
# FIsPrefix <a> : <b> ;
|
||||
# Returns true, if list <a> is a prefix (a proper one or equal) of
|
||||
# list <b>, an empty list otherwise.
|
||||
local a = $(1) ;
|
||||
local b = $(2) ;
|
||||
while $(a) && $(a[1]) = $(b[1]) {
|
||||
a = $(a[2-]) ;
|
||||
b = $(b[2-]) ;
|
||||
}
|
||||
|
||||
if $(a) {
|
||||
return ;
|
||||
} else {
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
|
||||
rule LocalClean { Clean $(1) : $(2) ; }
|
||||
|
||||
rule LocalDepends { Depends $(1) : $(2) ; }
|
||||
|
||||
} # vanilla Jam compatibility
|
||||
|
||||
rule FFilter
|
||||
{
|
||||
# FFilter <list> : <excludes> ;
|
||||
# Removes all occurrences of <excludes> in <list>.
|
||||
|
||||
local list = $(1) ;
|
||||
local excludes = $(2) ;
|
||||
local newList ;
|
||||
local item ;
|
||||
for item in $(list) {
|
||||
local skip ;
|
||||
local exclude ;
|
||||
for exclude in $(excludes) {
|
||||
if $(item) = $(exclude) {
|
||||
skip = true ;
|
||||
}
|
||||
}
|
||||
if ! $(skip) {
|
||||
newList += $(item) ;
|
||||
}
|
||||
}
|
||||
return $(newList) ;
|
||||
}
|
||||
|
||||
rule FSplitPath
|
||||
{
|
||||
# SplitPath <path> ;
|
||||
# Decomposes a path into its components.
|
||||
local path = $(1:G=) ;
|
||||
local components ;
|
||||
# $(path:D) for "/" is "/". Therefore the second condition.
|
||||
while $(path:D) && $(path:D) != $(path)
|
||||
{
|
||||
# Note: $(path:B) returns "." for "..", but $(path:D=) is fine.
|
||||
components = $(path:D=) $(components) ;
|
||||
path = $(path:D) ;
|
||||
}
|
||||
components = $(path) $(components) ;
|
||||
return $(components) ;
|
||||
}
|
||||
|
||||
rule FTimeZoneBinaries
|
||||
{
|
||||
local sources = $(1:G=timezone-source) ;
|
||||
local locate = $(2) ;
|
||||
local setRelativeTimezoneDir = $(3) ;
|
||||
|
||||
local gristedBinaries ;
|
||||
|
||||
local source ;
|
||||
for source in $(sources) {
|
||||
local binaries = [ on $(source) return $(TZ_OBJECTS) ] ;
|
||||
|
||||
local targetDir = [ FDirName $(TARGET_COMMON_DEBUG_OBJECT_DIR)
|
||||
data etc timezones ] ;
|
||||
|
||||
local binary ;
|
||||
for binary in $(binaries) {
|
||||
local dir = $(binary:D) ;
|
||||
if $(dir) {
|
||||
binary = $(binary:BSG=timezone!$(dir)) ;
|
||||
if $(locate) {
|
||||
LOCATE on $(binary) = [ FDirName $(targetDir) $(dir) ] ;
|
||||
}
|
||||
} else {
|
||||
binary = $(binary:BSG=timezone) ;
|
||||
if $(locate) {
|
||||
LOCATE on $(binary) = $(targetDir) ;
|
||||
}
|
||||
}
|
||||
|
||||
if $(setRelativeTimezoneDir) {
|
||||
RELATIVE_TIMEZONE_DIR on $(binary) = $(dir) ;
|
||||
}
|
||||
|
||||
gristedBinaries += $(binary) ;
|
||||
}
|
||||
}
|
||||
|
||||
return $(gristedBinaries) ;
|
||||
}
|
||||
|
||||
|
||||
rule SetPlatformCompatibilityFlagVariables
|
||||
{
|
||||
# SetPlatformCompatibilityFlagVariables <platform var> : <var prefix>
|
||||
# : <platform kind> [ : other platforms ] ;
|
||||
|
||||
local platformVar = $(1) ;
|
||||
local platform = $($(platformVar)) ;
|
||||
local varPrefix = $(2) ;
|
||||
local platformKind = $(3) ;
|
||||
local otherPlatforms = $(4) ;
|
||||
|
||||
if ! $(platform) {
|
||||
ECHO "Variable $(platformVar) not set. Please run ./configure or" ;
|
||||
EXIT "specify it manually." ;
|
||||
}
|
||||
|
||||
$(varPrefix)_PLATFORM_BEOS_COMPATIBLE = ;
|
||||
$(varPrefix)_PLATFORM_BONE_COMPATIBLE = ;
|
||||
$(varPrefix)_PLATFORM_DANO_COMPATIBLE = ;
|
||||
$(varPrefix)_PLATFORM_HAIKU_COMPATIBLE = ;
|
||||
|
||||
switch $(platform)
|
||||
{
|
||||
case r5 :
|
||||
{
|
||||
$(varPrefix)_PLATFORM_BEOS_COMPATIBLE = true ;
|
||||
}
|
||||
|
||||
case bone :
|
||||
{
|
||||
$(varPrefix)_PLATFORM_BONE_COMPATIBLE = true ;
|
||||
}
|
||||
|
||||
case dano :
|
||||
{
|
||||
$(varPrefix)_PLATFORM_DANO_COMPATIBLE = true ;
|
||||
}
|
||||
|
||||
case haiku :
|
||||
{
|
||||
$(varPrefix)_PLATFORM_HAIKU_COMPATIBLE = true ;
|
||||
}
|
||||
|
||||
case * :
|
||||
{
|
||||
if ! ( $(platform) in $(otherPlatforms) ) {
|
||||
Exit Unsupported $(platformKind) platform: $(platform) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# set lesser flags, e.g. "DANO" for "HAIKU" and "BEOS" for "BONE"
|
||||
$(varPrefix)_PLATFORM_DANO_COMPATIBLE
|
||||
?= $($(varPrefix)_PLATFORM_HAIKU_COMPATIBLE) ;
|
||||
$(varPrefix)_PLATFORM_BONE_COMPATIBLE
|
||||
?= $($(varPrefix)_PLATFORM_DANO_COMPATIBLE) ;
|
||||
$(varPrefix)_PLATFORM_BEOS_COMPATIBLE
|
||||
?= $($(varPrefix)_PLATFORM_BONE_COMPATIBLE) ;
|
||||
|
||||
# set the machine friendly flags
|
||||
$(varPrefix)_PLATFORM_(haiku)_COMPATIBLE
|
||||
?= $($(varPrefix)_PLATFORM_HAIKU_COMPATIBLE) ;
|
||||
$(varPrefix)_PLATFORM_(dano)_COMPATIBLE
|
||||
?= $($(varPrefix)_PLATFORM_DANO_COMPATIBLE) ;
|
||||
$(varPrefix)_PLATFORM_(bone)_COMPATIBLE
|
||||
?= $($(varPrefix)_PLATFORM_BONE_COMPATIBLE) ;
|
||||
$(varPrefix)_PLATFORM_(r5)_COMPATIBLE
|
||||
?= $($(varPrefix)_PLATFORM_BEOS_COMPATIBLE) ;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
rule SetPlatformForTarget
|
||||
{
|
||||
# SetPlatformForTarget <target> : <platform> ;
|
||||
|
||||
PLATFORM on $(1) = $(2) ;
|
||||
}
|
||||
|
||||
rule SetSubDirPlatform
|
||||
{
|
||||
# SetSubDirPlatform <platform> ;
|
||||
|
||||
PLATFORM = $(1) ;
|
||||
}
|
||||
|
||||
rule SetSupportedPlatformsForTarget
|
||||
{
|
||||
# SetSupportedPlatformsForTarget <target> : <platforms> ;
|
||||
|
||||
SUPPORTED_PLATFORMS on $(1) = $(2) ;
|
||||
}
|
||||
|
||||
rule SetSubDirSupportedPlatforms
|
||||
{
|
||||
# SetSubDirSupportedPlatforms <platforms> ;
|
||||
|
||||
SUPPORTED_PLATFORMS = $(1) ;
|
||||
}
|
||||
|
||||
rule SetSubDirSupportedPlatformsBeOSCompatible
|
||||
{
|
||||
# SetSubDirSupportedPlatformsBeOSCompatible ;
|
||||
|
||||
SUPPORTED_PLATFORMS = $(HAIKU_BEOS_COMPATIBLE_PLATFORMS) ;
|
||||
}
|
||||
|
||||
rule IsPlatformSupportedForTarget
|
||||
{
|
||||
# IsPlatformSupportedForTarget <target> [ : <platform> ]
|
||||
#
|
||||
|
||||
on $(1) {
|
||||
if $(PLATFORM) in $(SUPPORTED_PLATFORMS) {
|
||||
return true ;
|
||||
} else {
|
||||
return ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rule InheritPlatform
|
||||
{
|
||||
# InheritPlatform <children> : <parent> ;
|
||||
# PLATFORM and SUPPORTED_PLATFORMS are set on <children> to their value
|
||||
# on <parent>.
|
||||
#
|
||||
local children = $(1) ;
|
||||
local parent = $(2) ;
|
||||
|
||||
on $(parent) {
|
||||
PLATFORM on $(children) = $(PLATFORM) ;
|
||||
SUPPORTED_PLATFORMS on $(children) = $(SUPPORTED_PLATFORMS) ;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,341 @@
|
||||
rule FSameTargetWithPrependedGrist
|
||||
{
|
||||
# SameTargetWithPrependedGrist <target> : <grist to prepend> ;
|
||||
#
|
||||
local target = $(1) ;
|
||||
local gristToPrepend = $(2) ;
|
||||
local grist = $(target:G) ;
|
||||
|
||||
if $(grist) {
|
||||
grist = $(gristToPrepend)!$(grist) ;
|
||||
} else {
|
||||
grist = $(gristToPrepend) ;
|
||||
}
|
||||
|
||||
return $(target:G=$(grist)) ;
|
||||
}
|
||||
|
||||
rule InitScript
|
||||
{
|
||||
# Note: The script must have been LOCATEd before.
|
||||
local script = $(1) ;
|
||||
local initScript
|
||||
= [ FSameTargetWithPrependedGrist $(script) : init-script ] ;
|
||||
|
||||
if ! [ on $(script) return $(__is_initialized) ] {
|
||||
__is_initialized on $(script) = true ;
|
||||
|
||||
MakeLocate $(initScript) : [ on $(script) return $(LOCATE) ] ;
|
||||
Always $(initScript) ;
|
||||
Depends $(script) : $(initScript) ;
|
||||
|
||||
InitScript1 $(initScript) ;
|
||||
}
|
||||
|
||||
return $(initScript) ;
|
||||
}
|
||||
|
||||
actions InitScript1
|
||||
{
|
||||
rm -f $(1)
|
||||
echo -n > $(1)
|
||||
}
|
||||
|
||||
rule AddVariableToScript
|
||||
{
|
||||
# AddVariableToScript <script> : <variable> : <value> ;
|
||||
#
|
||||
local script = $(1) ;
|
||||
local variable = $(2) ;
|
||||
local value = $(3) ;
|
||||
|
||||
InitScript $(script) ;
|
||||
|
||||
VARIABLE_DEFS on $(script) += "echo $(variable)=\\\"$(value)\\\" >> " ;
|
||||
|
||||
AddVariableToScript1 $(script) ;
|
||||
}
|
||||
|
||||
actions together AddVariableToScript1
|
||||
{
|
||||
$(VARIABLE_DEFS)$(1);
|
||||
}
|
||||
|
||||
rule AddTargetVariableToScript
|
||||
{
|
||||
# AddTargetVariableToScript <script> : <target> [ : <variable> ] ;
|
||||
#
|
||||
local script = $(1) ;
|
||||
local target = $(2) ;
|
||||
local variable = $(3:E=$(target:BS)) ;
|
||||
|
||||
InitScript $(script) ;
|
||||
|
||||
# That's not completely save, if one has more than on target with the
|
||||
# same base name. A unique pseudo target would have to be introduced
|
||||
# to do it more correctly.
|
||||
VARIABLE_NAME($(target:BS)) on $(script) = $(variable) ;
|
||||
|
||||
Depends $(script) : $(target) ;
|
||||
AddTargetVariableToScript1 $(script) : $(target) ;
|
||||
}
|
||||
|
||||
actions AddTargetVariableToScript1
|
||||
{
|
||||
echo "$(VARIABLE_NAME($(2:BS)))=\"$(2)\"" >> $(1)
|
||||
}
|
||||
|
||||
|
||||
rule AddDirectoryToHaikuImage
|
||||
{
|
||||
# AddDirectoryToHaikuImage <directory>
|
||||
local directoryTokens = $(1) ;
|
||||
local directory = [ FDirName $(directoryTokens) ] ;
|
||||
directory = $(directory:G=HaikuImage) ;
|
||||
|
||||
if ! [ on $(directory) return $(__is_on_image) ] {
|
||||
INSTALL_DIRECTORIES on haiku-image-contents += $(directory) ;
|
||||
__is_on_image on $(directory) = true ;
|
||||
NotFile $(directory) ;
|
||||
|
||||
# mark the parent dir as not to be created
|
||||
local parent = [ FReverse $(directoryTokens) ] ;
|
||||
parent = [ FReverse $(parent[2-]) ] ;
|
||||
if $(parent) {
|
||||
parent = [ FDirName $(parent) ] ;
|
||||
parent = $(parent:G=HaikuImage) ;
|
||||
DONT_CREATE on $(parent) = true ;
|
||||
}
|
||||
}
|
||||
|
||||
return $(directory) ;
|
||||
}
|
||||
|
||||
rule AddFilesToHaikuImage
|
||||
{
|
||||
# AddFilesToHaikuImage <directory> : <targets> [ : dest name ]
|
||||
#
|
||||
local directory = [ AddDirectoryToHaikuImage $(1) ] ;
|
||||
local targets = $(2) ;
|
||||
local destName = $(3) ;
|
||||
|
||||
INSTALL_DIR on $(targets) = $(directory) ;
|
||||
TARGETS_TO_INSTALL on $(directory) += $(targets) ;
|
||||
|
||||
if $(destName) {
|
||||
INSTALL_TARGET_NAME on $(targets) = $(destName) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule AddSymlinkToHaikuImage
|
||||
{
|
||||
# AddSymlinkToHaikuImage <directory> : <link target> [ : <link name> ] ;
|
||||
#
|
||||
local directory = [ AddDirectoryToHaikuImage $(1) ] ;
|
||||
local linkTarget = $(2) ;
|
||||
local linkName = $(3) ;
|
||||
|
||||
if ! $(linkName) {
|
||||
local path = [ FReverse [ FSplitPath $(linkTarget) ] ] ;
|
||||
linkName = $(path[1]) ;
|
||||
}
|
||||
|
||||
local link = $(directory)/$(linkName) ;
|
||||
SYMLINK_TARGET on $(link) = $(linkTarget) ;
|
||||
SYMLINKS_TO_INSTALL on $(directory) += $(link) ;
|
||||
}
|
||||
|
||||
rule AddDriversToHaikuImage
|
||||
{
|
||||
# AddDriversToHaikuImage <relative directory> : <targets> ;
|
||||
#
|
||||
local relativeDirectoryTokens = $(1) ;
|
||||
local targets = $(2) ;
|
||||
local directoryTokens = beos system add-ons kernel drivers dev
|
||||
$(relativeDirectoryTokens) ;
|
||||
|
||||
AddFilesToHaikuImage beos system add-ons kernel drivers bin : $(targets) ;
|
||||
|
||||
# get the relative symlink path prefix
|
||||
local linkPrefix = ;
|
||||
for i in $(relativeDirectoryTokens) {
|
||||
linkPrefix += .. ;
|
||||
}
|
||||
linkPrefix += .. bin ;
|
||||
|
||||
# add the symlinks
|
||||
local name ;
|
||||
for name in $(targets:BS) {
|
||||
AddSymlinkToHaikuImage $(directoryTokens)
|
||||
: [ FDirName $(linkPrefix) $(name) ] : $(name) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule AddBootModuleSymlinks
|
||||
{
|
||||
# AddBootModuleSymlinks <targets> ;
|
||||
#
|
||||
local targets = $(1) ;
|
||||
|
||||
# add the symlinks
|
||||
local target ;
|
||||
for target in $(targets) {
|
||||
local installDir = [ on $(target) return $(INSTALL_DIR) ] ;
|
||||
|
||||
if ! $(installDir) {
|
||||
Echo "ERROR: AddBootModuleSymlinks: Can't create a symlink to"
|
||||
"target" \"$(target)"\"." ;
|
||||
Exit "ERROR: Add*ToHaikuImage has not been invoked for it yet." ;
|
||||
}
|
||||
|
||||
local name = $(target:BS) ;
|
||||
local linkTarget = [ FDirName /boot $(installDir:G=) $(name) ] ;
|
||||
|
||||
AddSymlinkToHaikuImage beos system add-ons kernel boot
|
||||
: $(linkTarget) : $(name) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule CreateHaikuImageMakeDirectoriesScript
|
||||
{
|
||||
local script = $(1) ;
|
||||
MakeLocate $(script) : $(HAIKU_OUTPUT_DIR) ;
|
||||
Always $(script) ;
|
||||
|
||||
local initScript = [ InitScript $(script) ] ;
|
||||
|
||||
local scriptBody
|
||||
= [ FSameTargetWithPrependedGrist $(script) : script-body ] ;
|
||||
LOCATE on $(scriptBody) = [ on $(script) return $(LOCATE) ] ;
|
||||
Depends $(scriptBody) : $(initScript) ;
|
||||
Depends $(script) : $(scriptBody) ;
|
||||
|
||||
local dirsToCreate ;
|
||||
local dir ;
|
||||
for dir in [ on haiku-image-contents return $(INSTALL_DIRECTORIES) ] {
|
||||
if ! [ on $(dir) return $(DONT_CREATE) ] {
|
||||
dirsToCreate += $(dir) ;
|
||||
}
|
||||
}
|
||||
|
||||
Depends $(scriptBody) : $(dirsToCreate) ;
|
||||
CreateHaikuImageMakeDirectoriesScript1 $(scriptBody) : $(dirsToCreate) ;
|
||||
}
|
||||
|
||||
actions piecemeal CreateHaikuImageMakeDirectoriesScript1
|
||||
{
|
||||
echo \$mkdir -p "\"\${tPrefix}$(2:G=)\"" >> $(1)
|
||||
}
|
||||
|
||||
rule CreateHaikuImageCopyFilesScript
|
||||
{
|
||||
local script = $(1) ;
|
||||
MakeLocate $(script) : $(HAIKU_OUTPUT_DIR) ;
|
||||
Always $(script) ;
|
||||
|
||||
local initScript = [ InitScript $(script) ] ;
|
||||
|
||||
local scriptBody
|
||||
= [ FSameTargetWithPrependedGrist $(script) : script-body ] ;
|
||||
LOCATE on $(scriptBody) = [ on $(script) return $(LOCATE) ] ;
|
||||
Depends $(scriptBody) : $(initScript) ;
|
||||
Depends $(script) : $(scriptBody) ;
|
||||
|
||||
local dir ;
|
||||
for dir in [ on haiku-image-contents return $(INSTALL_DIRECTORIES) ] {
|
||||
local targets = [ on $(dir) return $(TARGETS_TO_INSTALL) ] ;
|
||||
|
||||
# filter the targets that shall be renamed; they have to be copied
|
||||
# individually
|
||||
local remainingTargets ;
|
||||
local target ;
|
||||
for target in $(targets) {
|
||||
local destName = [ on $(target) return $(INSTALL_TARGET_NAME) ] ;
|
||||
if $(destName) {
|
||||
# use a unique dummy target for this file, on which we
|
||||
# can define the TARGET_DIR variable
|
||||
local dummyTarget = $(script)-dummy-$(dir:G=)-$(target) ;
|
||||
NotFile $(dummyTarget) ;
|
||||
TARGET_DIR on $(dummyTarget) = $(dir:G=) ;
|
||||
INSTALL_TARGET_NAME on $(dummyTarget) = $(destName) ;
|
||||
|
||||
Depends $(dummyTarget) : $(initScript) $(target) ;
|
||||
Depends $(script) : $(dummyTarget) ;
|
||||
|
||||
AppendToHaikuImageCopyFilesScriptSingleFile $(dummyTarget)
|
||||
: $(initScript) $(target) ;
|
||||
} else {
|
||||
remainingTargets += $(target) ;
|
||||
}
|
||||
}
|
||||
targets = $(remainingTargets) ;
|
||||
|
||||
if $(targets) {
|
||||
# use a unique dummy target for this directory, on which we
|
||||
# can define the TARGET_DIR variable
|
||||
local dummyTarget = $(script)-dummy-$(dir:G=) ;
|
||||
NotFile $(dummyTarget) ;
|
||||
TARGET_DIR on $(dummyTarget) = $(dir:G=) ;
|
||||
|
||||
Depends $(dummyTarget) : $(initScript) $(targets) ;
|
||||
Depends $(script) : $(dummyTarget) ;
|
||||
|
||||
OUTPUT_SCRIPT on $(dummyTarget) = $(initScript) ;
|
||||
AppendToHaikuImageCopyFilesScript $(dummyTarget) : $(targets) ;
|
||||
}
|
||||
|
||||
local symlinks = [ on $(dir) return $(SYMLINKS_TO_INSTALL) ] ;
|
||||
local symlink ;
|
||||
for symlink in $(symlinks) {
|
||||
NotFile $(symlink) ;
|
||||
|
||||
Depends $(script) : $(symlink) ;
|
||||
Depends $(symlink) : $(initScript) ;
|
||||
|
||||
AddSymlinkToHaikuImageCopyFilesScript $(symlink) : $(initScript) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
actions piecemeal AppendToHaikuImageCopyFilesScript bind OUTPUT_SCRIPT
|
||||
{
|
||||
echo \$cp "\"\${sPrefix}$(2)\"" "\"\${tPrefix}$(TARGET_DIR)\"" >> $(OUTPUT_SCRIPT)
|
||||
}
|
||||
|
||||
actions AppendToHaikuImageCopyFilesScriptSingleFile
|
||||
{
|
||||
echo \$cp "\"\${sPrefix}$(2[2])\"" \
|
||||
"\"\${tPrefix}$(TARGET_DIR)/$(INSTALL_TARGET_NAME)\"" >> $(2[1])
|
||||
}
|
||||
|
||||
actions AddSymlinkToHaikuImageCopyFilesScript
|
||||
{
|
||||
echo \$ln -sf "\"$(SYMLINK_TARGET)\"" "\"\${tPrefix}$(1:G=)\"" >> $(2[1])
|
||||
}
|
||||
|
||||
rule BuildHaikuImage
|
||||
{
|
||||
# BuildHaikuImage <haiku image> : <scripts> : <is image> ;
|
||||
#
|
||||
local haikuImage = $(1) ;
|
||||
local scripts = $(2) ;
|
||||
local isImage = $(3) ;
|
||||
|
||||
if $(isImage) = 1 || $(isImage) = true {
|
||||
IS_IMAGE on $(haikuImage) = 1 ;
|
||||
} else {
|
||||
IS_IMAGE on $(haikuImage) = "" ;
|
||||
}
|
||||
|
||||
local mainScript = build_haiku_image ;
|
||||
SEARCH on $(mainScript) = [ FDirName $(HAIKU_TOP) build scripts ] ;
|
||||
|
||||
Depends $(haikuImage) : $(mainScript) $(scripts) ;
|
||||
BuildHaikuImage1 $(haikuImage) : $(mainScript) $(scripts) ;
|
||||
}
|
||||
|
||||
actions BuildHaikuImage1
|
||||
{
|
||||
export isImage="$(IS_IMAGE)"
|
||||
$(2[1]) $(2[2-])
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
|
||||
rule SetupKernel
|
||||
{
|
||||
# Usage SetupKernel <sources_or_objects> : <extra_cc_flags>;
|
||||
#
|
||||
# <sources_or_objects> - Ideally sources, otherwise HDRSEARCH can not be
|
||||
# set for the sources and the sources some header
|
||||
# dependencies might be missing.
|
||||
|
||||
local sources = [ FGristFiles $(1) ] ;
|
||||
local objects = $(sources:S=$(SUFOBJ)) ;
|
||||
|
||||
# add private kernel headers
|
||||
SourceSysHdrs $(sources) : $(TARGET_PRIVATE_KERNEL_HEADERS) ;
|
||||
|
||||
local object ;
|
||||
for object in $(objects) {
|
||||
# add kernel flags for the object
|
||||
ObjectCcFlags $(object) : $(TARGET_KERNEL_CCFLAGS) $(2) ;
|
||||
ObjectC++Flags $(object) : $(TARGET_KERNEL_C++FLAGS) $(2) ;
|
||||
|
||||
# override warning flags
|
||||
TARGET_WARNING_CCFLAGS on $(object) = $(TARGET_KERNEL_WARNING_CCFLAGS) ;
|
||||
TARGET_WARNING_C++FLAGS on $(object)
|
||||
= $(TARGET_KERNEL_WARNING_C++FLAGS) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule KernelObjects
|
||||
{
|
||||
SetupKernel $(1) : $(2) ;
|
||||
Objects $(1) ;
|
||||
}
|
||||
|
||||
rule KernelLd
|
||||
{
|
||||
# KernelLd <name> : <objs> : <linkerscript> : <args> ;
|
||||
|
||||
LINK on $(1) = $(TARGET_LD) ;
|
||||
|
||||
LINKFLAGS on $(1) = $(4) ;
|
||||
if $(3) { LINKFLAGS on $(1) += --script=$(3) ; }
|
||||
|
||||
# Remove any preset LINKLIBS, but link against libgcc.a
|
||||
LINKLIBS on $(1) = $(TARGET_GCC_LIBGCC) ;
|
||||
|
||||
# TODO: Do we really want to invoke SetupKernel here? The objects should
|
||||
# have been compiled with KernelObjects anyway, so we're doing that twice.
|
||||
SetupKernel $(2) ;
|
||||
|
||||
# Show that we depend on the libraries we need
|
||||
LocalClean clean : $(1) ;
|
||||
LocalDepends all : $(1) ;
|
||||
Depends $(1) : $(2) ;
|
||||
|
||||
MakeLocateDebug $(1) ;
|
||||
}
|
||||
|
||||
actions KernelLd
|
||||
{
|
||||
$(LINK) $(LINKFLAGS) -o "$(1)" "$(2)" $(LINKLIBS) ;
|
||||
}
|
||||
|
||||
rule KernelAddon
|
||||
{
|
||||
# KernelAddon <name> : <relpath> : <sources> : <static-libraries> ;
|
||||
|
||||
local sources = $(3) ;
|
||||
|
||||
# platform supported?
|
||||
on $(1) {
|
||||
if ! $(PLATFORM) in $(SUPPORTED_PLATFORMS) {
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
||||
# When building for Haiku, we link against kernel.so, otherwise
|
||||
# against the system kernel.
|
||||
local kernel ;
|
||||
if [ on $(1) return $(PLATFORM) ] = haiku {
|
||||
kernel = <nogrist>kernel.so ;
|
||||
} else {
|
||||
kernel = /boot/develop/lib/x86/_KERNEL_ ;
|
||||
}
|
||||
|
||||
SetupKernel $(sources) : -fno-pic ;
|
||||
|
||||
Addon $(1) : $(2) : $(sources) ;
|
||||
LINKFLAGS on $(1) = [ on $(1) return $(LINKFLAGS) ] -nostdlib ;
|
||||
LinkAgainst $(1) : $(4) $(kernel) ;
|
||||
}
|
||||
|
||||
rule KernelMergeObject
|
||||
{
|
||||
# KernelMergeObject <name> : <sources> : <extra CFLAGS> : <other objects> ;
|
||||
# Compiles source files and merges the object files to an object file.
|
||||
# <name>: Name of the object file to create. No grist will be added.
|
||||
# <sources>: Sources to be compiled. Grist will be added.
|
||||
# <extra CFLAGS>: Additional flags for compilation.
|
||||
# <other objects>: Object files or static libraries to be merged. No grist
|
||||
# will be added.
|
||||
#
|
||||
|
||||
SetupKernel $(2) : $(3) ;
|
||||
Objects $(2) ;
|
||||
MergeObjectFromObjects $(1) : $(2:S=$(SUFOBJ)) : $(4) ;
|
||||
}
|
||||
|
||||
rule KernelStaticLibrary
|
||||
{
|
||||
# Usage KernelStaticLibrary <name> : <sources> : <extra cc flags> ;
|
||||
# This is designed to take a set of sources and libraries and create
|
||||
# a file called lib<name>.a
|
||||
|
||||
SetupKernel $(2) : $(3) ;
|
||||
Library $(1) : $(2) ;
|
||||
}
|
||||
|
||||
rule KernelStaticLibraryObjects
|
||||
{
|
||||
# Usage KernelStaticLibrary <name> : <sources> ;
|
||||
# This is designed to take a set of sources and libraries and create
|
||||
# a file called <name>
|
||||
|
||||
# Show that we depend on the libraries we need
|
||||
SetupKernel $(2) ;
|
||||
LocalClean clean : $(1) ;
|
||||
LocalDepends all : $(1) ;
|
||||
Depends $(1) : $(2) ;
|
||||
|
||||
MakeLocateDebug $(1) ;
|
||||
}
|
||||
|
||||
actions KernelStaticLibraryObjects
|
||||
{
|
||||
$(HAIKU_AR) -r "$(1)" "$(2)" ;
|
||||
}
|
||||
@@ -0,0 +1,463 @@
|
||||
|
||||
rule AddSharedObjectGlueCode
|
||||
{
|
||||
# AddSharedObjectGlueCode <target> : <isExecutable> ;
|
||||
|
||||
# we link with -nostdlib and add the required libs manually, when building
|
||||
# for Haiku
|
||||
if [ on $(1) return $(PLATFORM) ] = haiku {
|
||||
local stdLibs = libroot.so ;
|
||||
local beginGlue ;
|
||||
local endGlue ;
|
||||
if $(2) = true {
|
||||
beginGlue += $(HAIKU_EXECUTABLE_BEGIN_GLUE_CODE) ;
|
||||
endGlue += $(HAIKU_EXECUTABLE_END_GLUE_CODE) ;
|
||||
} else {
|
||||
beginGlue += $(HAIKU_LIBRARY_BEGIN_GLUE_CODE) ;
|
||||
endGlue += $(HAIKU_LIBRARY_END_GLUE_CODE) ;
|
||||
|
||||
# special case for libroot: don't link it against itself
|
||||
if $(1) = libroot.so {
|
||||
stdLibs = ;
|
||||
}
|
||||
}
|
||||
|
||||
LINK_BEGIN_GLUE on $(1) = $(beginGlue) ;
|
||||
LINK_END_GLUE on $(1) = $(endGlue) ;
|
||||
|
||||
NEEDLIBS on $(1) = $(stdLibs) [ on $(1) return $(NEEDLIBS) ] ;
|
||||
Depends $(1) : $(stdLibs) $(beginGlue) $(endGlue) ;
|
||||
LINKFLAGS on $(1) = [ on $(1) return $(LINKFLAGS) ] -nostdlib ;
|
||||
}
|
||||
}
|
||||
|
||||
rule Executable
|
||||
{
|
||||
# Executable <name> : <sources> : <libraries> : <res> ;
|
||||
#
|
||||
if ! [ IsPlatformSupportedForTarget $(1) ] {
|
||||
return ;
|
||||
}
|
||||
|
||||
AddResources $(1) : $(4) ;
|
||||
Main $(1) : $(2) ;
|
||||
LinkAgainst $(1) : $(3) ;
|
||||
LINKFLAGS on $(1) = [ on $(1) return $(LINKFLAGS) ]
|
||||
-Xlinker -soname=_APP_ ;
|
||||
|
||||
# we link with -nostdlib and add the required libs manually, when building
|
||||
# for Haiku
|
||||
AddSharedObjectGlueCode $(1) : true ;
|
||||
}
|
||||
|
||||
rule Application
|
||||
{
|
||||
# Application <name> : <sources> : <libraries> : <res> ;
|
||||
Executable $(1) : $(2) : $(3) : $(4) ;
|
||||
}
|
||||
|
||||
rule BinCommand
|
||||
{
|
||||
# BinCommand <name> : <sources> : <libraries> : <res> ;
|
||||
Executable $(1) : $(2) : $(3) : $(4) ;
|
||||
}
|
||||
|
||||
rule StdBinCommands
|
||||
{
|
||||
# StdBinCommands <sources> : <libs> : <res> ;
|
||||
local libs = $(2) ;
|
||||
local ress = $(3) ;
|
||||
local source ;
|
||||
for source in $(1)
|
||||
{
|
||||
local target = $(source:S=) ;
|
||||
|
||||
BinCommand $(target) : $(source) : $(libs) : $(ress) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule Preference
|
||||
{
|
||||
# Preference <name> : <sources> : <libraries> : <res> ;
|
||||
Executable $(1) : $(2) : $(3) : $(4) ;
|
||||
}
|
||||
|
||||
rule Server
|
||||
{
|
||||
# Server <name> : <sources> : <libraries> : <res> ;
|
||||
|
||||
Executable $(1) : $(2) : $(3) : $(4) ;
|
||||
}
|
||||
|
||||
rule Addon
|
||||
{
|
||||
# Addon <name> : <relpath> : <sources> : <is executable> : <libraries> ;
|
||||
# <name>: Name of the add-on.
|
||||
# <relpath>: Path where the add-on shall live relative to the add-on dir.
|
||||
# <sources>: Source files.
|
||||
# <is executable>: true, if the target shall be executable as well.
|
||||
# <libraries>: Libraries to be linked against.
|
||||
# TODO: <relpath> is no longer needed
|
||||
|
||||
if ! [ IsPlatformSupportedForTarget $(1) ] {
|
||||
return ;
|
||||
}
|
||||
|
||||
local isExecutable = $(4) ;
|
||||
|
||||
Main $(1) : $(3) ;
|
||||
|
||||
local linkFlags = -Xlinker -soname=\"$(1)\" ;
|
||||
if $(isExecutable) != true {
|
||||
linkFlags = -nostart $(linkFlags) ;
|
||||
}
|
||||
LINKFLAGS on $(1) = [ on $(1) return $(LINKFLAGS) ] $(linkFlags) ;
|
||||
LinkAgainst $(1) : $(5) ;
|
||||
|
||||
AddSharedObjectGlueCode $(1) : $(isExecutable) ;
|
||||
}
|
||||
|
||||
rule Translator
|
||||
{
|
||||
# Translator <name> : <sources> : <libraries> ;
|
||||
# TODO: Although they currently all are, translators don't need to be
|
||||
# executable. Introduce a flag as for Addon.
|
||||
Addon $(1) : Translators : $(2) : true : $(3) ;
|
||||
}
|
||||
|
||||
rule ScreenSaver
|
||||
{
|
||||
# ScreenSaver <name> : <sources> : <libraries> ;
|
||||
Addon $(1) : screen_savers : $(2) : false : $(3) ;
|
||||
}
|
||||
|
||||
rule StaticLibrary
|
||||
{
|
||||
# StaticLibrary <lib> : <sources> ;
|
||||
# Creates a static library from sources.
|
||||
# <lib>: The static library to be built.
|
||||
# <source>: List of source files.
|
||||
#
|
||||
local lib = $(1) ;
|
||||
local sources = [ FGristFiles $(2) ] ;
|
||||
local objects = $(sources:S=$(SUFOBJ)) ;
|
||||
|
||||
if ! [ IsPlatformSupportedForTarget $(1) ] {
|
||||
return ;
|
||||
}
|
||||
|
||||
InheritPlatform $(objects) : $(lib) ;
|
||||
|
||||
StaticLibraryFromObjects $(lib) : $(objects) ;
|
||||
Objects $(2) ;
|
||||
}
|
||||
|
||||
rule StaticLibraryFromObjects
|
||||
{
|
||||
if ! [ IsPlatformSupportedForTarget $(1) ] {
|
||||
return ;
|
||||
}
|
||||
|
||||
LibraryFromObjects $(1) : $(2) ;
|
||||
}
|
||||
|
||||
rule MergeObjectFromObjects
|
||||
{
|
||||
# MergeObjectFromObjects <name> : <objects> : <other objects> ;
|
||||
# Merges object files to an object file.
|
||||
# <name>: Name of the object file to create. No grist will be added.
|
||||
# <objects>: Object files to be merged. Grist will be added.
|
||||
# <other objects>: Object files or static libraries to be merged. No grist
|
||||
# will be added.
|
||||
#
|
||||
local objects = [ FGristFiles $(2) ] ;
|
||||
|
||||
on $(1) {
|
||||
if ! $(PLATFORM) in $(SUPPORTED_PLATFORMS) {
|
||||
return ;
|
||||
}
|
||||
|
||||
if $(PLATFORM) = host {
|
||||
LINK on $(1) = $(HOST_LD) ;
|
||||
} else {
|
||||
LINK on $(1) = $(TARGET_LD) ;
|
||||
}
|
||||
}
|
||||
|
||||
MakeLocateDebug $(1) ;
|
||||
Depends $(1) : $(objects) ;
|
||||
Depends $(1) : $(3) ;
|
||||
LocalDepends obj : $(1) ;
|
||||
MergeObjectFromObjects1 $(1) : $(objects) $(3) ;
|
||||
}
|
||||
|
||||
actions MergeObjectFromObjects1
|
||||
{
|
||||
$(LINK) -r $(2) -o $(1) ;
|
||||
}
|
||||
|
||||
rule MergeObject
|
||||
{
|
||||
# MergeObject <name> : <sources> : <other objects> ;
|
||||
# Compiles source files and merges the object files to an object file.
|
||||
# <name>: Name of the object file to create. No grist will be added.
|
||||
# <sources>: Sources to be compiled. Grist will be added.
|
||||
# <other objects>: Object files or static libraries to be merged. No grist
|
||||
# will be added.
|
||||
#
|
||||
local target = $(1) ;
|
||||
local sources = [ FGristFiles $(2) ] ;
|
||||
local otherObjects = $(3) ;
|
||||
local objects = $(sources:S=$(SUFOBJ)) ;
|
||||
|
||||
if ! [ IsPlatformSupportedForTarget $(1) ] {
|
||||
return ;
|
||||
}
|
||||
|
||||
InheritPlatform $(objects) : $(target) ;
|
||||
Objects $(sources) ;
|
||||
MergeObjectFromObjects $(target) : $(objects) : $(otherObjects) ;
|
||||
}
|
||||
|
||||
rule SharedLibraryFromObjects
|
||||
{
|
||||
# SharedLibraryFromObjects <lib> : <objects> : <libraries> ;
|
||||
#
|
||||
local _lib = $(1) ;
|
||||
|
||||
if ! [ IsPlatformSupportedForTarget $(1) ] {
|
||||
return ;
|
||||
}
|
||||
|
||||
MainFromObjects $(_lib) : $(2) ;
|
||||
LINKFLAGS on $(_lib) = [ on $(_lib) return $(LINKFLAGS) ]
|
||||
-nostart -Xlinker -soname=\"$(_lib)\" ;
|
||||
LinkAgainst $(_lib) : $(3) ;
|
||||
|
||||
AddSharedObjectGlueCode $(_lib) : false ;
|
||||
}
|
||||
|
||||
rule SharedLibrary
|
||||
{
|
||||
# SharedLibrary <lib> : <sources> : <libraries> ;
|
||||
local lib = $(1) ;
|
||||
local sources = [ FGristFiles $(2) ] ;
|
||||
local objects = $(sources:S=$(SUFOBJ)) ;
|
||||
local libs = $(3) ;
|
||||
|
||||
if ! [ IsPlatformSupportedForTarget $(1) ] {
|
||||
return ;
|
||||
}
|
||||
|
||||
InheritPlatform $(objects) : $(lib) ;
|
||||
Objects $(sources) ;
|
||||
SharedLibraryFromObjects $(lib) : $(objects) : $(libs) ;
|
||||
}
|
||||
|
||||
rule LinkAgainst
|
||||
{
|
||||
# LinkAgainst <name> : <libs> ;
|
||||
# Valid elements for <libs> are e.g. "be" or "libopenbeos.so" or
|
||||
# "/boot/.../libfoo.so". If the basename starts with "lib" or the thingy
|
||||
# has a dirname or grist, it is added to the NEEDLIBS variable (i.e. the
|
||||
# file will be bound!), otherwise it is prefixed "-l" and added to
|
||||
# LINKLIBS. If you want to specify a target that isn't a library and
|
||||
# also has neither grist nor a dirname, you can prepend "<nogrist>" as
|
||||
# grist; it will be stripped by this rule.
|
||||
#
|
||||
local target = $(1) ;
|
||||
local libs = $(2) ;
|
||||
local mapLibs = $(3) ;
|
||||
|
||||
on $(target) {
|
||||
# map libraries, if desired and target platform is Haiku
|
||||
if $(PLATFORM) = haiku {
|
||||
local mappedLibs ;
|
||||
|
||||
for i in $(libs) {
|
||||
local mapped = $(HAIKU_LIBRARY_NAME_MAP_$(i)) ;
|
||||
mapped ?= $(i) ;
|
||||
mappedLibs += $(mapped) ;
|
||||
}
|
||||
|
||||
libs = $(mappedLibs) ;
|
||||
}
|
||||
|
||||
local linkLibs ;
|
||||
local needLibs ;
|
||||
|
||||
for i in $(libs)
|
||||
{
|
||||
local isfile = ;
|
||||
if $(i:D) || $(i:G) {
|
||||
isfile = true ;
|
||||
if $(i:G) = <nogrist> {
|
||||
i = $(i:G=) ;
|
||||
}
|
||||
} else {
|
||||
switch $(i:B)
|
||||
{
|
||||
# XXX: _APP_ and _KERNEL_ should not be needed for ELF.
|
||||
case _APP_ : isfile = true ;
|
||||
case _KERNEL_ : isfile = true ;
|
||||
case lib* : isfile = true ;
|
||||
case * : isfile = ;
|
||||
}
|
||||
if ! $(isfile) && ( $(i:S) = .so || $(i:S) = .a ) {
|
||||
isfile = true ;
|
||||
}
|
||||
}
|
||||
|
||||
if $(isfile) {
|
||||
needLibs += $(i) ;
|
||||
} else {
|
||||
linkLibs += $(i) ;
|
||||
}
|
||||
}
|
||||
|
||||
NEEDLIBS on $(1) = $(NEEDLIBS) $(needLibs) ;
|
||||
LINKLIBS on $(1) = $(LINKLIBS) -l$(linkLibs) ;
|
||||
|
||||
if $(needLibs) && ! $(NO_LIBRARY_DEPENDENCIES) {
|
||||
Depends $(1) : $(needLibs) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rule AddResources
|
||||
{
|
||||
# AddResources <name> : <resourcefiles> ;
|
||||
|
||||
# add grist to the resource files which don't have any yet
|
||||
local resfiles ;
|
||||
local file ;
|
||||
for file in $(2) {
|
||||
if ! $(file:G) {
|
||||
file = [ FGristFiles $(file) ] ;
|
||||
}
|
||||
resfiles += $(file) ;
|
||||
}
|
||||
|
||||
SEARCH on $(resfiles) += $(SEARCH_SOURCE) ;
|
||||
|
||||
for file in $(resfiles) {
|
||||
if $(file:S) = .rdef {
|
||||
local rdef = $(file) ;
|
||||
file = $(rdef:S=.rsrc) ;
|
||||
ResComp $(file) : $(rdef) ;
|
||||
}
|
||||
RESFILES on $(1) += $(file) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule BuildPlatformObjects
|
||||
{
|
||||
# Usage BuildPlatformObjects <sources> ;
|
||||
# <sources> The sources.
|
||||
#
|
||||
local sources = [ FGristFiles $(1) ] ;
|
||||
local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
|
||||
|
||||
PLATFORM on $(objects) = host ;
|
||||
SUPPORTED_PLATFORMS on $(objects) = host ;
|
||||
|
||||
Objects $(sources) ;
|
||||
}
|
||||
|
||||
rule BuildPlatformMain
|
||||
{
|
||||
# Usage BuildPlatformMain <target> : <sources> : <libraries> ;
|
||||
# <target> The executable/library.
|
||||
# <sources> The sources.
|
||||
# <libraries> Libraries to link against.
|
||||
#
|
||||
local target = $(1) ;
|
||||
local sources = $(2) ;
|
||||
local libs = $(3) ;
|
||||
local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
|
||||
|
||||
PLATFORM on $(target) = host ;
|
||||
SUPPORTED_PLATFORMS on $(target) = host ;
|
||||
DONT_USE_BEOS_RULES on $(target) = true ;
|
||||
|
||||
local usesBeAPI = [ on $(target) return $(USES_BE_API) ] ;
|
||||
if $(usesBeAPI) {
|
||||
# propagate the flag to the objects
|
||||
USES_BE_API on $(objects) = $(usesBeAPI) ;
|
||||
|
||||
# add the build libroot
|
||||
if ! $(HOST_PLATFORM_BEOS_COMPATIBLE) {
|
||||
Depends $(target) : $(HOST_LIBROOT) ;
|
||||
NEEDLIBS on $(target) += $(HOST_LIBROOT) ;
|
||||
}
|
||||
}
|
||||
|
||||
Main $(target) : $(sources) ;
|
||||
LinkAgainst $(target) : $(libs) ;
|
||||
}
|
||||
|
||||
rule BuildPlatformSharedLibrary
|
||||
{
|
||||
# Usage BuildPlatformSharedLibrary <target> : <sources> : <libraries> ;
|
||||
# <target> The library.
|
||||
# <sources> The sources.
|
||||
# <libraries> Libraries to link against.
|
||||
#
|
||||
local target = $(1) ;
|
||||
local sources = $(2) ;
|
||||
local libs = $(3) ;
|
||||
|
||||
BuildPlatformMain $(target) : $(sources) : $(libs) ;
|
||||
LINKFLAGS on $(target) = [ on $(target) return $(LINKFLAGS) ]
|
||||
-shared -Xlinker -soname=\"$(target)\" ;
|
||||
}
|
||||
|
||||
rule BuildPlatformMergeObject
|
||||
{
|
||||
# BuildPlatformMergeObject <name> : <sources> : <other objects> ;
|
||||
# Compiles source files and merges the object files to an object file.
|
||||
# <name>: Name of the object file to create. No grist will be added.
|
||||
# <sources>: Sources to be compiled. Grist will be added.
|
||||
# <other objects>: Object files or static libraries to be merged. No grist
|
||||
# will be added.
|
||||
#
|
||||
local target = $(1) ;
|
||||
local sources = $(2) ;
|
||||
local otherObjects = $(3) ;
|
||||
local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
|
||||
|
||||
PLATFORM on $(target) = host ;
|
||||
SUPPORTED_PLATFORMS on $(target) = host ;
|
||||
|
||||
local usesBeAPI = [ on $(target[1]) return $(USES_BE_API) ] ;
|
||||
if $(usesBeAPI) {
|
||||
# propagate the flag to the objects
|
||||
USES_BE_API on $(objects) = $(usesBeAPI) ;
|
||||
}
|
||||
|
||||
MergeObject $(target) : $(sources) : $(otherObjects) ;
|
||||
}
|
||||
|
||||
rule BuildPlatformStaticLibrary
|
||||
{
|
||||
# BuildPlatformStaticLibrary <lib> : <sources> ;
|
||||
# Creates a static library from sources.
|
||||
# <lib>: The library.
|
||||
# <sources>: List of source files.
|
||||
|
||||
local lib = $(1) ;
|
||||
local sources = $(2) ;
|
||||
local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
|
||||
|
||||
PLATFORM on $(lib) = host ;
|
||||
SUPPORTED_PLATFORMS on $(lib) = host ;
|
||||
|
||||
local usesBeAPI = [ on $(lib) return $(USES_BE_API) ] ;
|
||||
if $(usesBeAPI) {
|
||||
# propagate the flag to the objects
|
||||
USES_BE_API on $(objects) = $(usesBeAPI) ;
|
||||
}
|
||||
|
||||
StaticLibrary $(lib) : $(sources) ;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
|
||||
rule SetupObjectsDir
|
||||
{
|
||||
local relPath = [ FDirName $(SUBDIR_TOKENS[2-]) ] ;
|
||||
COMMON_PLATFORM_LOCATE_TARGET =
|
||||
[ FDirName $(HAIKU_COMMON_PLATFORM_OBJECT_DIR) $(relPath) ] ;
|
||||
|
||||
local var ;
|
||||
for var in COMMON_ARCH COMMON_DEBUG DEBUG_$(HAIKU_DEBUG_LEVELS) {
|
||||
HOST_$(var)_LOCATE_TARGET
|
||||
= [ FDirName $(HOST_$(var)_OBJECT_DIR) $(relPath) ] ;
|
||||
TARGET_$(var)_LOCATE_TARGET
|
||||
= [ FDirName $(TARGET_$(var)_OBJECT_DIR) $(relPath) ] ;
|
||||
}
|
||||
|
||||
LOCATE_TARGET = $(COMMON_PLATFORM_LOCATE_TARGET) ;
|
||||
LOCATE_SOURCE = $(LOCATE_TARGET) ;
|
||||
SEARCH_SOURCE = $(SUBDIR) $(LOCATE_SOURCE)
|
||||
$(HOST_COMMON_DEBUG_LOCATE_TARGET) # Also add the standard output
|
||||
$(TARGET_COMMON_DEBUG_LOCATE_TARGET) # dirs for generated sources.
|
||||
;
|
||||
}
|
||||
|
||||
rule SubIncludeGPL
|
||||
{
|
||||
# SubInclude rule that can be used to conditionally include GPL licensed
|
||||
# add-ons
|
||||
if $(INCLUDE_GPL_ADDONS) = 1 {
|
||||
SubInclude $(1) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule MakeLocateCommonPlatform
|
||||
{
|
||||
MakeLocate $(1) : $(COMMON_PLATFORM_LOCATE_TARGET) ;
|
||||
}
|
||||
|
||||
rule MakeLocatePlatform
|
||||
{
|
||||
local files = $(1) ;
|
||||
local file ;
|
||||
for file in $(files) {
|
||||
if [ on $(file) return $(PLATFORM) ] = host {
|
||||
MakeLocate $(file) : $(HOST_COMMON_ARCH_LOCATE_TARGET) ;
|
||||
} else {
|
||||
MakeLocate $(file) : $(TARGET_COMMON_ARCH_LOCATE_TARGET) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rule MakeLocateArch
|
||||
{
|
||||
local files = $(1) ;
|
||||
local file ;
|
||||
for file in $(files) {
|
||||
if [ on $(file) return $(PLATFORM) ] = host {
|
||||
MakeLocate $(file) : $(HOST_COMMON_DEBUG_LOCATE_TARGET) ;
|
||||
} else {
|
||||
MakeLocate $(file) : $(TARGET_COMMON_DEBUG_LOCATE_TARGET) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rule MakeLocateDebug
|
||||
{
|
||||
local files = $(1) ;
|
||||
local file ;
|
||||
for file in $(files) {
|
||||
on $(file) {
|
||||
if $(PLATFORM) = host {
|
||||
MakeLocate $(file) : $(HOST_DEBUG_$(DEBUG)_LOCATE_TARGET) ;
|
||||
} else {
|
||||
MakeLocate $(file) : $(TARGET_DEBUG_$(DEBUG)_LOCATE_TARGET) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,598 @@
|
||||
# Overridden to allow spaces in file names.
|
||||
actions Chmod1
|
||||
{
|
||||
$(CHMOD) "$(MODE)" "$(1)"
|
||||
}
|
||||
|
||||
# Overridden to allow spaces in file names.
|
||||
actions piecemeal together existing Clean
|
||||
{
|
||||
$(RM) "$(>)"
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Link rule/action are overwritten as they don't handle linking files who's name
|
||||
# contain spaces very well. Also adds resources and version to executable.
|
||||
#-------------------------------------------------------------------------------
|
||||
rule Link
|
||||
{
|
||||
# Note: RESFILES must be set before invocation.
|
||||
|
||||
if [ on $(1) return $(PLATFORM) ] = host {
|
||||
LINK on $(1) = $(HOST_LINK) ;
|
||||
LINKFLAGS on $(1) = $(HOST_LINKFLAGS) [ on $(1) return $(LINKFLAGS) ] ;
|
||||
} else {
|
||||
LINK on $(1) = $(TARGET_LINK) ;
|
||||
LINKFLAGS on $(1) = $(TARGET_LINKFLAGS)
|
||||
[ on $(1) return $(LINKFLAGS) ] ;
|
||||
}
|
||||
|
||||
NEEDLIBS on $(1) = [ on $(1) return $(NEEDLIBS) ] ;
|
||||
LINKLIBS on $(1) = [ on $(1) return $(LINKLIBS) ] ;
|
||||
|
||||
MODE on $(<) = $(EXEMODE) ;
|
||||
on $(1) XRes $(1) : $(RESFILES) ;
|
||||
Chmod $(<) ;
|
||||
if ! [ on $(1) return $(DONT_USE_BEOS_RULES) ] {
|
||||
SetType $(1) ;
|
||||
MimeSet $(1) ;
|
||||
SetVersion $(1) ;
|
||||
}
|
||||
}
|
||||
|
||||
actions Link bind NEEDLIBS LINK_BEGIN_GLUE LINK_END_GLUE
|
||||
{
|
||||
$(LINK) $(LINKFLAGS) -o "$(1)" $(UNDEFS) "$(LINK_BEGIN_GLUE)" "$(2)" "$(NEEDLIBS)" $(LINKLIBS) "$(LINK_END_GLUE)" ;
|
||||
}
|
||||
|
||||
rule Object
|
||||
{
|
||||
# find out which headers and defines to use
|
||||
local headers ;
|
||||
local sysHeaders ;
|
||||
local defines ;
|
||||
|
||||
on $(1) { # use on $(1) variable values
|
||||
if ! $(PLATFORM) in $(SUPPORTED_PLATFORMS) {
|
||||
return ;
|
||||
}
|
||||
|
||||
# Save HDRS for -I$(HDRS) on compile.
|
||||
# We shouldn't need -I$(SEARCH_SOURCE) as cc can find headers
|
||||
# in the .c file's directory, but generated .c files (from
|
||||
# yacc, lex, etc) are located in $(LOCATE_TARGET), possibly
|
||||
# different from $(SEARCH_SOURCE).
|
||||
|
||||
headers = $(SEARCH_SOURCE) $(SUBDIRHDRS) $(HDRS) ;
|
||||
sysHeaders = $(SUBDIRSYSHDRS) $(SYSHDRS) ;
|
||||
defines = $(DEFINES) ;
|
||||
|
||||
if $(PLATFORM) = host {
|
||||
sysHeaders += $(HOST_HDRS) ;
|
||||
defines += $(HOST_DEFINES) ;
|
||||
|
||||
if $(USES_BE_API) {
|
||||
sysHeaders += $(HOST_BE_API_HEADERS) ;
|
||||
}
|
||||
|
||||
} else {
|
||||
sysHeaders += $(TARGET_HDRS) ;
|
||||
defines += $(TARGET_DEFINES) ;
|
||||
}
|
||||
}
|
||||
|
||||
# locate object and search for source
|
||||
|
||||
LocalClean clean : $(<) ;
|
||||
|
||||
MakeLocateDebug $(<) ;
|
||||
SEARCH on $(>) = $(SEARCH_SOURCE) ;
|
||||
|
||||
HDRS on $(<) = $(headers) ;
|
||||
SYSHDRS on $(<) = $(sysHeaders) ;
|
||||
|
||||
# handle #includes for source: Jam scans for headers with
|
||||
# the regexp pattern $(HDRSCAN) and then invokes $(HDRRULE)
|
||||
# with the scanned file as the target and the found headers
|
||||
# as the sources. HDRSEARCH is the value of SEARCH used for
|
||||
# the found header files. Finally, if jam must deal with
|
||||
# header files of the same name in different directories,
|
||||
# they can be distinguished with HDRGRIST.
|
||||
|
||||
# $(SEARCH_SOURCE:E) is where cc first looks for #include
|
||||
# "foo.h" files. If the source file is in a distant directory,
|
||||
# look there. Else, look in "" (the current directory).
|
||||
|
||||
HDRRULE on $(>) = HdrRule ;
|
||||
HDRSCAN on $(>) = $(HDRPATTERN) ;
|
||||
HDRSEARCH on $(>) = $(headers) $(sysHeaders) $(STDHDRS) ;
|
||||
HDRGRIST on $(>) = $(HDRGRIST) ;
|
||||
|
||||
# propagate target specific-defines
|
||||
|
||||
DEFINES on $(1) = $(defines) ;
|
||||
|
||||
# if source is not .c, generate .c with specific rule
|
||||
|
||||
switch $(>:S)
|
||||
{
|
||||
case .asm : As $(<) : $(>) ;
|
||||
case .c : Cc $(<) : $(>) ;
|
||||
case .C : C++ $(<) : $(>) ;
|
||||
case .cc : C++ $(<) : $(>) ;
|
||||
case .cpp : C++ $(<) : $(>) ;
|
||||
case .f : Fortran $(<) : $(>) ;
|
||||
case .l : if [ on $(2) return $(GENERATE_C++) ] {
|
||||
C++ $(<) : $(<:S=.cpp) ;
|
||||
Lex $(<:S=.cpp) : $(>) ;
|
||||
} else {
|
||||
Cc $(<) : $(<:S=.c) ;
|
||||
Lex $(<:S=.c) : $(>) ;
|
||||
}
|
||||
case *.o : return ;
|
||||
case .s : As $(<) : $(>) ;
|
||||
case .S : As $(<) : $(>) ;
|
||||
case .y : if [ on $(2) return $(GENERATE_C++) ] {
|
||||
C++ $(1) : $(1:S=.cpp) ;
|
||||
Yacc $(1:S=.cpp) $(1:S=.hpp) : $(2) ;
|
||||
} else {
|
||||
Cc $(1) : $(1:S=.c) ;
|
||||
Yacc $(1:S=.c) $(1:S=.h) : $(2) ;
|
||||
}
|
||||
case * : UserObject $(<) : $(>) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule As
|
||||
{
|
||||
local flags ;
|
||||
if [ on $(1) return $(PLATFORM) ] = host {
|
||||
flags = [ on $(1) return $(HOST_ASFLAGS) $(ASFLAGS) ] ;
|
||||
|
||||
CC on $(1) = $(HOST_CC) ;
|
||||
|
||||
} else {
|
||||
flags = [ on $(1) return $(TARGET_ASFLAGS) $(ASFLAGS) ] ;
|
||||
|
||||
CC on $(1) = $(TARGET_CC) ;
|
||||
}
|
||||
|
||||
Depends $(<) : $(>) ;
|
||||
ASFLAGS on $(<) += $(flags) $(SUBDIRASFLAGS) ;
|
||||
ASHDRS on $(<) = [ on $(<) FIncludes $(HDRS) ]
|
||||
$(HDRS_INCLUDES_SEPARATOR) [ on $(<) FSysIncludes $(SYSHDRS) ] ;
|
||||
ASDEFS on $(<) = [ on $(<) FDefines $(DEFINES) ] ;
|
||||
}
|
||||
|
||||
# TODO: The KERNEL_CCFLAGS were used here before. Check whether we need any
|
||||
# flags we don't have now.
|
||||
actions As
|
||||
{
|
||||
$(CC) -c "$(2)" -O2 $(ASFLAGS) -D_ASSEMBLER $(ASDEFS) $(ASHDRS) -o "$(1)" ;
|
||||
}
|
||||
|
||||
rule Lex
|
||||
{
|
||||
Depends $(1) : $(2) ;
|
||||
MakeLocateArch $(1) ;
|
||||
LocalClean clean : $(1) ;
|
||||
}
|
||||
|
||||
actions Lex
|
||||
{
|
||||
$(LEX) -o$(1) $(2)
|
||||
}
|
||||
|
||||
rule Yacc
|
||||
{
|
||||
local source = $(1[1]) ;
|
||||
local header = $(1[2]) ;
|
||||
local yaccSource = $(2) ;
|
||||
|
||||
MakeLocateArch $(source) $(header) ;
|
||||
|
||||
Depends $(source) $(header) : $(yaccSource) ;
|
||||
Yacc1 $(source) $(header) : $(yaccSource) ;
|
||||
LocalClean clean : $(source) $(header) ;
|
||||
|
||||
# make sure someone includes $(header) else it will be
|
||||
# a deadly independent target
|
||||
|
||||
Includes $(source) : $(header) ;
|
||||
}
|
||||
|
||||
actions Yacc1
|
||||
{
|
||||
bison $(YACCFLAGS) -o $(1[1]) $(2)
|
||||
[ -f $(1[1]).h ] && mv $(1[1]).h $(1[2]) || true
|
||||
}
|
||||
|
||||
rule Cc
|
||||
{
|
||||
Depends $(<) : $(>) ;
|
||||
|
||||
on $(1) {
|
||||
local flags ;
|
||||
|
||||
# optimization flags
|
||||
if $(DEBUG) = 0 {
|
||||
flags += $(OPTIM) ;
|
||||
} else {
|
||||
flags += -O0 ;
|
||||
}
|
||||
|
||||
if $(PLATFORM) = host {
|
||||
# warning flags
|
||||
if $(WARNINGS) != 0 {
|
||||
flags += $(HOST_WARNING_CCFLAGS) ;
|
||||
}
|
||||
|
||||
# debug and other flags
|
||||
flags += $(HOST_CCFLAGS) $(HOST_DEBUG_$(DEBUG)_CCFLAGS)
|
||||
$(SUBDIRCCFLAGS) $(CCFLAGS) ;
|
||||
|
||||
if $(USES_BE_API) {
|
||||
flags += $(HOST_BE_API_CCFLAGS) ;
|
||||
}
|
||||
|
||||
CC on $(1) = $(HOST_CC) ;
|
||||
|
||||
} else {
|
||||
# warning flags
|
||||
if $(WARNINGS) != 0 {
|
||||
flags += $(TARGET_WARNING_CCFLAGS) ;
|
||||
}
|
||||
|
||||
# debug and other flags
|
||||
flags += $(TARGET_CCFLAGS) $(TARGET_DEBUG_$(DEBUG)_CCFLAGS)
|
||||
$(SUBDIRCCFLAGS) $(CCFLAGS) ;
|
||||
|
||||
CC on $(1) = $(TARGET_CC) ;
|
||||
}
|
||||
|
||||
CCFLAGS on $(<) = $(flags) ;
|
||||
CCHDRS on $(<) = [ FIncludes $(HDRS) ] $(HDRS_INCLUDES_SEPARATOR)
|
||||
[ FSysIncludes $(SYSHDRS) ] ;
|
||||
CCDEFS on $(<) = [ FDefines $(DEFINES) ] ;
|
||||
}
|
||||
}
|
||||
|
||||
actions Cc
|
||||
{
|
||||
$(CC) $(CCFLAGS) -c "$(2)" $(CCDEFS) $(CCHDRS) -o "$(1)" ;
|
||||
}
|
||||
|
||||
rule C++
|
||||
{
|
||||
Depends $(<) : $(>) ;
|
||||
|
||||
on $(1) {
|
||||
local flags ;
|
||||
|
||||
# optimization flags
|
||||
if $(DEBUG) = 0 {
|
||||
flags += $(OPTIM) ;
|
||||
} else {
|
||||
flags += -O0 ;
|
||||
}
|
||||
|
||||
if $(PLATFORM) = host {
|
||||
# warning flags
|
||||
if $(WARNINGS) != 0 {
|
||||
flags += $(HOST_WARNING_C++FLAGS) ;
|
||||
}
|
||||
|
||||
# debug and other flags
|
||||
flags += $(HOST_C++FLAGS) $(HOST_DEBUG_$(DEBUG)_C++FLAGS)
|
||||
$(SUBDIRC++FLAGS) $(C++FLAGS) ;
|
||||
|
||||
if $(USES_BE_API) {
|
||||
flags += $(HOST_BE_API_C++FLAGS) ;
|
||||
}
|
||||
|
||||
C++ on $(1) = $(HOST_C++) ;
|
||||
|
||||
} else {
|
||||
# warning flags
|
||||
if $(WARNINGS) != 0 {
|
||||
flags += $(TARGET_WARNING_C++FLAGS) ;
|
||||
}
|
||||
|
||||
# debug and other flags
|
||||
flags += $(TARGET_C++FLAGS) $(TARGET_DEBUG_$(DEBUG)_C++FLAGS)
|
||||
$(SUBDIRC++FLAGS) $(C++FLAGS) ;
|
||||
|
||||
C++ on $(1) = $(TARGET_C++) ;
|
||||
}
|
||||
|
||||
C++FLAGS on $(<) = $(flags) ;
|
||||
CCHDRS on $(<) = [ FIncludes $(HDRS) ] $(HDRS_INCLUDES_SEPARATOR)
|
||||
[ FSysIncludes $(SYSHDRS) ] ;
|
||||
CCDEFS on $(<) = [ FDefines $(DEFINES) ] ;
|
||||
}
|
||||
}
|
||||
|
||||
actions C++
|
||||
{
|
||||
$(C++) -c "$(2)" $(C++FLAGS) $(CCDEFS) $(CCHDRS) -o "$(1)" ;
|
||||
}
|
||||
|
||||
rule Library
|
||||
{
|
||||
local lib = $(1) ;
|
||||
local sources = [ FGristFiles $(2) ] ;
|
||||
local objects = $(sources:S=$(SUFOBJ)) ;
|
||||
|
||||
InheritPlatform $(objects) : $(lib) ;
|
||||
LibraryFromObjects $(lib) : $(objects) ;
|
||||
Objects $(sources) ;
|
||||
}
|
||||
|
||||
rule LibraryFromObjects
|
||||
{
|
||||
local _i _l _s ;
|
||||
|
||||
# Add grist to file names
|
||||
# bonefish: No, don't. The Library rule does that anyway, and when we
|
||||
# have an object from another dir, we certainly don't want that.
|
||||
|
||||
_s = $(>) ;
|
||||
_l = $(<:S=$(SUFLIB)) ;
|
||||
|
||||
on $(_l) {
|
||||
# set the tools according to the platform
|
||||
if $(PLATFORM) = host {
|
||||
AR on $(1) = $(HOST_AR) $(HOST_ARFLAGS) ;
|
||||
RANLIB on $(1) = $(HOST_RANLIB) ;
|
||||
} else {
|
||||
AR on $(1) = $(TARGET_AR) $(TARGET_ARFLAGS) ;
|
||||
RANLIB on $(1) = $(TARGET_RANLIB) ;
|
||||
}
|
||||
|
||||
# library depends on its member objects
|
||||
|
||||
if $(KEEPOBJS)
|
||||
{
|
||||
LocalDepends obj : $(_s) ;
|
||||
}
|
||||
|
||||
LocalDepends lib : $(_l) ;
|
||||
|
||||
# Set LOCATE for the library and its contents. The bound
|
||||
# value shows up as $(NEEDLIBS) on the Link actions.
|
||||
# For compatibility, we only do this if the library doesn't
|
||||
# already have a path.
|
||||
|
||||
if ! $(_l:D)
|
||||
{
|
||||
# locate the library only, if it hasn't been located yet
|
||||
local dir = $(LOCATE[1]) ;
|
||||
if ! $(dir) {
|
||||
MakeLocateDebug $(_l) ;
|
||||
dir = [ on $(_l) return $(LOCATE[1]) ] ;
|
||||
# Note: The "on ..." is necessary, since our environment
|
||||
# isn't changed by MakeLocateDebug.
|
||||
}
|
||||
MakeLocate $(_l)($(_s:BS)) : $(dir) ;
|
||||
}
|
||||
|
||||
if $(NOARSCAN)
|
||||
{
|
||||
# If we can't scan the library to timestamp its contents,
|
||||
# we have to just make the library depend directly on the
|
||||
# on-disk object files.
|
||||
|
||||
Depends $(_l) : $(_s) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
# If we can scan the library, we make the library depend
|
||||
# on its members and each member depend on the on-disk
|
||||
# object file.
|
||||
|
||||
Depends $(_l) : $(_l)($(_s:BS)) ;
|
||||
|
||||
for _i in $(_s)
|
||||
{
|
||||
Depends $(_l)($(_i:BS)) : $(_i) ;
|
||||
}
|
||||
}
|
||||
|
||||
LocalClean clean : $(_l) ;
|
||||
|
||||
# bonefish: Not needed on the supported platforms. Maybe later...
|
||||
# if $(CRELIB) { CreLib $(_l) : $(_s[1]) ; }
|
||||
|
||||
Archive $(_l) : $(_s) ;
|
||||
|
||||
if $(RANLIB) { Ranlib $(_l) ; }
|
||||
|
||||
# If we can't scan the library, we have to leave the .o's around.
|
||||
|
||||
if ! ( $(KEEPOBJS) || $(NOARSCAN) || $(NOARUPDATE) ) {
|
||||
RmTemps $(_l) : $(_s) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rule Main
|
||||
{
|
||||
local target = $(1) ;
|
||||
local sources = [ FGristFiles $(2) ] ;
|
||||
local objects = $(sources:S=$(SUFOBJ)) ;
|
||||
|
||||
InheritPlatform $(objects) : $(target) ;
|
||||
MainFromObjects $(target) : $(objects) ;
|
||||
Objects $(sources) ;
|
||||
}
|
||||
|
||||
rule MainFromObjects
|
||||
{
|
||||
local _s _t ;
|
||||
|
||||
# Add grist to file names
|
||||
# Add suffix to exe
|
||||
|
||||
_s = [ FGristFiles $(>) ] ;
|
||||
_t = [ FAppendSuffix $(<) : $(SUFEXE) ] ;
|
||||
|
||||
# so 'jam foo' works when it's really foo.exe
|
||||
|
||||
if $(_t) != $(<)
|
||||
{
|
||||
Depends $(<) : $(_t) ;
|
||||
NotFile $(<) ;
|
||||
}
|
||||
|
||||
# make compiled sources a dependency of target
|
||||
|
||||
LocalDepends exe : $(_t) ;
|
||||
Depends $(_t) : $(_s) ;
|
||||
MakeLocateDebug $(_t) ;
|
||||
|
||||
LocalClean clean : $(_t) ;
|
||||
|
||||
Link $(_t) : $(_s) ;
|
||||
}
|
||||
|
||||
# Override Jam 2.5rc3 MakeLocate and MkDir to deal more intelligently
|
||||
# with grist set on the supplied directory name.
|
||||
rule MakeLocate
|
||||
{
|
||||
local dir = $(2[1]) ;
|
||||
|
||||
if $(dir)
|
||||
{
|
||||
if ! $(dir:G) {
|
||||
dir = $(dir:G=dir) ;
|
||||
}
|
||||
LOCATE on $(1) += $(dir:G=) ; # don't relocate once located
|
||||
Depends $(1) : $(dir) ;
|
||||
MkDir $(dir) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule MkDir
|
||||
{
|
||||
local dir = $(<) ;
|
||||
if ! $(dir:G) {
|
||||
dir = $(dir:G=dir) ;
|
||||
}
|
||||
|
||||
# make this and all super directories
|
||||
while true {
|
||||
# If dir exists, don't update it
|
||||
# Do this even for $(DOT).
|
||||
NoUpdate $(dir) ;
|
||||
|
||||
# Bail out when reaching the CWD (".") or a directory we've already
|
||||
# made.
|
||||
if $(dir:G=) = $(DOT) || $($(dir:G=)-mkdir) {
|
||||
return ;
|
||||
}
|
||||
|
||||
local s ;
|
||||
|
||||
# Cheesy gate to prevent multiple invocations on same dir
|
||||
# MkDir1 has the actions
|
||||
# Arrange for jam dirs
|
||||
|
||||
$(dir:G=)-mkdir = true ;
|
||||
MkDir1 $(dir) ;
|
||||
LocalDepends dirs : $(dir) ;
|
||||
|
||||
# Recursively make parent directories.
|
||||
# $(dir:P) = $(dir)'s parent, & we recurse until root
|
||||
|
||||
s = $(dir:P) ; # parent keeps grist
|
||||
|
||||
if $(s:G=) && $(s) != $(dir) {
|
||||
Depends $(dir) : $(s) ;
|
||||
dir = $(s) ;
|
||||
} else if $(s) {
|
||||
NotFile $(s) ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rule ObjectCcFlags
|
||||
{
|
||||
# supports inheriting the global variable value
|
||||
|
||||
local file ;
|
||||
for file in [ FGristFiles $(1:S=$(SUFOBJ)) ] {
|
||||
CCFLAGS on $(file) = [ on $(file) return $(CCFLAGS) ] $(2) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule ObjectC++Flags
|
||||
{
|
||||
# supports inheriting the global variable value
|
||||
|
||||
local file ;
|
||||
for file in [ FGristFiles $(1:S=$(SUFOBJ)) ] {
|
||||
C++FLAGS on $(file) = [ on $(file) return $(C++FLAGS) ] $(2) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule ObjectDefines
|
||||
{
|
||||
# supports inheriting the global variable value and multiple files
|
||||
|
||||
if $(2) {
|
||||
local file ;
|
||||
for file in [ FGristFiles $(1:S=$(SUFOBJ)) ] {
|
||||
DEFINES on $(file) = [ on $(file) return $(DEFINES) ] $(2) ;
|
||||
CCDEFS on $(file) = [ on $(file) FDefines $(DEFINES) ] ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rule ObjectHdrs
|
||||
{
|
||||
# ObjectHdrs <sources or objects> : <headers> : <gristed objects>
|
||||
# Note: Parameter 3 <gristed objects> is an extension.
|
||||
|
||||
local objects = [ FGristFiles $(1:S=$(SUFOBJ)) ] $(3) ;
|
||||
local headers = $(2) ;
|
||||
|
||||
local file ;
|
||||
for file in $(objects) {
|
||||
HDRS on $(file) = [ on $(file) return $(HDRS) ] $(headers) ;
|
||||
|
||||
# reformat ASHDRS and CCHDRS
|
||||
local fileHeaders = [ on $(file) FIncludes $(HDRS) ]
|
||||
$(HDRS_INCLUDES_SEPARATOR) [ on $(file) FSysIncludes $(SYSHDRS) ] ;
|
||||
ASHDRS on $(file) = $(fileHeaders) ;
|
||||
CCHDRS on $(file) = $(fileHeaders) ;
|
||||
}
|
||||
}
|
||||
|
||||
# Overridden to avoid calling SubDir for a directory twice (in SubInclude
|
||||
# and from the Jamfile in the directory).
|
||||
rule SubInclude
|
||||
{
|
||||
# SubInclude TOP d1 ... ;
|
||||
#
|
||||
# Include a subdirectory's Jamfile.
|
||||
|
||||
if ! $($(<[1]))
|
||||
{
|
||||
Exit SubInclude $(<[1]) without prior SubDir $(<[1]) ;
|
||||
}
|
||||
|
||||
# Set up the config variables for the subdirectory.
|
||||
local config = [ ConfigObject $(1) ] ;
|
||||
|
||||
__configured = ;
|
||||
if ! [ on $(config) return $(__configured) ] {
|
||||
# No custom configuration defined for the subdir. We use the variable
|
||||
# values inherited by the closest ancestor.
|
||||
config = $(HAIKU_INHERITED_SUBDIR_CONFIG) ;
|
||||
}
|
||||
|
||||
on $(config) {
|
||||
include [ FDirName $($(1[1])) $(1[2-) $(JAMFILE) ] ;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,250 @@
|
||||
#-------------------------------------------------------------------------------
|
||||
# Packages for OBOS alpha/beta testers
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
rule Copy
|
||||
{
|
||||
if $(2) {
|
||||
SEARCH on $(2) = $(SEARCH_SOURCE) ;
|
||||
Depends $(1) : <build>copyattr $(2) ;
|
||||
Copy1 $(1) : <build>copyattr $(2) ;
|
||||
}
|
||||
}
|
||||
|
||||
actions Copy1
|
||||
{
|
||||
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
|
||||
"$(2[1])" -d "$(2[2-])" "$(1)"
|
||||
}
|
||||
|
||||
rule Packages
|
||||
{
|
||||
local packagenames = $(1) ;
|
||||
local packagefiles = $(2) ;
|
||||
local path = $(3) ;
|
||||
for name in $(packagenames) {
|
||||
Package $(name) : $(packagefiles) : $(path) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule FPackageConfigSubPath
|
||||
{
|
||||
# FPackageConfigSubPath <packagename>
|
||||
#
|
||||
local packagename = $(1) ;
|
||||
|
||||
local configSubPath ;
|
||||
on $(packagename) {
|
||||
if $(PLATFORM) = host {
|
||||
configSubPath = $(HOST_PLATFORM) $(HOST_ARCH) ;
|
||||
} else {
|
||||
configSubPath = $(TARGET_PLATFORM) $(TARGET_ARCH) ;
|
||||
}
|
||||
|
||||
if $(DEBUG) = 0 {
|
||||
configSubPath += release ;
|
||||
} else {
|
||||
configSubPath += debug_$(DEBUG) ;
|
||||
}
|
||||
}
|
||||
|
||||
return $(configSubPath) ;
|
||||
}
|
||||
|
||||
rule Package
|
||||
{
|
||||
local packagename = $(1) ;
|
||||
local packagefiles = $(2) ;
|
||||
local path = $(3) ;
|
||||
|
||||
local configSubPath = [ FPackageConfigSubPath $(packagename) ] ;
|
||||
local packagezip = $(packagename:S=.zip:G=_packages) ;
|
||||
local targetDir = [ FDirName $(HAIKU_PACKAGE_DIR) $(configSubPath) ] ;
|
||||
local packagedir = [ FDirName $(targetDir) $(packagename) ] ;
|
||||
|
||||
local installscript = install.sh ;
|
||||
local packageinstallscript = $(installscript:G=_packages!$(packagename)) ;
|
||||
local installzip = install.zip ;
|
||||
local packageinstallzip = $(installzip:G=_packages!$(packagename)) ;
|
||||
|
||||
local packageobjectdir = [ FDirName $(HAIKU_PACKAGE_OBJECT_DIR)
|
||||
$(configSubPath) $(packagename) ] ;
|
||||
local packagefiledir = [ FDirName $(packageobjectdir) $(path) ] ;
|
||||
local packagefileinstallzip
|
||||
= $(installzip:G=_package_objects!$(packagename)) ;
|
||||
|
||||
# add the files to the install.zip
|
||||
local packagefilegrist = [ FGrist _package_files $(packagename) $(path) ] ;
|
||||
for file in $(packagefiles) {
|
||||
if $(path[0]) = "boot" {
|
||||
local packagefile = $(file:G=$(packagefilegrist)) ;
|
||||
MakeLocate $(packagefile) : $(packagefiledir) ;
|
||||
Copy $(packagefile) : $(file) ;
|
||||
Clean cleanPackages : $(packagefile) ;
|
||||
PackageInstallZip $(packagefileinstallzip) : $(packagefile) ;
|
||||
} else {
|
||||
local packagefile = $(file:G=_packages!$(packagename)) ;
|
||||
MakeLocate $(packagefile) : $(packagedir) ;
|
||||
Copy $(packagefile) : [ FGristFiles $(file) ] ;
|
||||
Clean cleanPackages : $(packagefile) ;
|
||||
Depends $(packagezip) : $(packagefile) ;
|
||||
}
|
||||
}
|
||||
|
||||
# general setup for this package -- only on first invocation
|
||||
if ! $(_setup_$(packagename)) {
|
||||
_setup_$(packagename) = true ;
|
||||
|
||||
NotFile $(packagename) ;
|
||||
LocalDepends packages : $(packagename) ;
|
||||
|
||||
MakeLocate $(packagezip) : $(targetDir) ;
|
||||
MakeLocate $(packageinstallscript) : $(packagedir) ;
|
||||
MakeLocate $(packageinstallzip) : $(packagedir) ;
|
||||
MakeLocate $(packagefileinstallzip) : $(packageobjectdir) ;
|
||||
|
||||
PackageInstallScript $(packageinstallscript) : $(packagedir) ;
|
||||
LinkInstallZip $(packageinstallzip) : $(packagefileinstallzip) ;
|
||||
Depends $(packagename) : $(packagezip) ;
|
||||
PackageZip $(packagezip) : $(packagedir)
|
||||
: $(packageinstallscript) $(packageinstallzip) ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
rule PackageSymLink
|
||||
{
|
||||
# PackageSymLink <packageName> : <symlink path components>
|
||||
# : <symlink target>
|
||||
#
|
||||
local packagename = $(1) ;
|
||||
local symlinkPath = $(2) ;
|
||||
local symlinkTarget = $(3) ;
|
||||
|
||||
local configSubPath = [ FPackageConfigSubPath $(packagename) ] ;
|
||||
|
||||
local symlinkDir = [ FReverse $(symlinkPath) ] ;
|
||||
local symlink = $(symlinkDir[1]) ;
|
||||
symlinkDir = [ FReverse $(symlinkDir[2-]) ] ;
|
||||
local symlinkGrist = [ FGrist _package $(packagename) $(symlinkDir) ] ;
|
||||
symlink = $(symlink:G=$(symlinkGrist)) ;
|
||||
|
||||
if $(symlinkDir[1]) = boot {
|
||||
local installzip = install.zip ;
|
||||
local packagefileinstallzip
|
||||
= $(installzip:G=_package_objects!$(packagename)) ;
|
||||
|
||||
local packageobjectdir = [ FDirName $(HAIKU_PACKAGE_OBJECT_DIR)
|
||||
$(configSubPath) $(packagename) ] ;
|
||||
symlinkDir = [ FDirName $(packageobjectdir) $(symlinkDir) ] ;
|
||||
|
||||
PackageInstallZip $(packagefileinstallzip) : $(symlink) ;
|
||||
|
||||
} else {
|
||||
local packagezip = $(packagename:S=.zip:G=_packages) ;
|
||||
|
||||
local packagedir = [ FDirName $(HAIKU_PACKAGE_DIR) $(configSubPath)
|
||||
$(packagename) ] ;
|
||||
symlinkDir = [ FDirName $(packagedir) $(symlinkDir) ] ;
|
||||
|
||||
Depends $(packagezip) : $(symlink) ;
|
||||
}
|
||||
|
||||
MakeLocate $(symlink) : $(symlinkDir) ;
|
||||
SymLink $(symlink) : $(symlinkTarget) : false ;
|
||||
Clean cleanPackages : $(symlink) ;
|
||||
}
|
||||
|
||||
rule PackageDriverSymLink
|
||||
{
|
||||
# PackageDriverSymLink <packageName> : <devRelativeSymlinkComponents> ;
|
||||
# <packageName>: Package name.
|
||||
# <devRelativeSymlinkComponents>: Path components relative to the
|
||||
# /boot/home/config/add-ons/kernel/drivers/dev directory, e.g.
|
||||
# "graphics mga.driver" (no quotation, of course).
|
||||
#
|
||||
local packageName = $(1) ;
|
||||
local symlinkComponents = $(2) ;
|
||||
|
||||
# construct the symlink contents
|
||||
local symlinkPath = [ FReverse $(symlinkComponents) ] ;
|
||||
symlinkPath = bin $(symlinkPath[1]) ;
|
||||
|
||||
for i in $(symlinkComponents) {
|
||||
symlinkPath = $(DOTDOT) $(symlinkPath) ;
|
||||
}
|
||||
|
||||
PackageSymLink $(packageName)
|
||||
: boot home config add-ons kernel drivers dev $(symlinkComponents)
|
||||
: [ FDirName $(symlinkPath) ] ;
|
||||
}
|
||||
|
||||
rule PackageZip
|
||||
{
|
||||
local dir = $(2:G=dir) ;
|
||||
Depends $(1) : $(dir) $(3) ;
|
||||
Clean cleanPackages : $(1) ;
|
||||
PackageZip1 $(1) : $(dir) ;
|
||||
}
|
||||
|
||||
actions together PackageZip1 {
|
||||
cd "$(2:P)" ;
|
||||
zip -rq "$(1:BS)" "$(2:BS)" ;
|
||||
}
|
||||
|
||||
rule PackageInstallScript
|
||||
{
|
||||
MakeLocate $(1) : $(2) ;
|
||||
Clean cleanPackages : $(1) ;
|
||||
PackageInstallScript1 $(1) : $(2:G=dir) ;
|
||||
}
|
||||
|
||||
actions together PackageInstallScript1
|
||||
{
|
||||
echo '#!/bin/sh
|
||||
base=`dirname "$0"`
|
||||
cd "$base"
|
||||
if [ -n "$TTY" ]
|
||||
then
|
||||
unzip -d / install.zip
|
||||
else
|
||||
response=`alert "Would you like to automatically overwrite existing files, or receive a prompt?" "Overwrite" "Prompt"`
|
||||
if [ $response == "Overwrite" ]
|
||||
then
|
||||
unzip -od / install.zip
|
||||
alert "Finished installing" "Thanks"
|
||||
else
|
||||
if [ -e /boot/beos/apps/Terminal ]
|
||||
then
|
||||
terminal=/boot/beos/apps/Terminal
|
||||
else
|
||||
terminal=`query Terminal | head -1`
|
||||
fi
|
||||
$terminal -t "installer" /bin/sh "$0"
|
||||
fi
|
||||
fi' > "$(1)" ;
|
||||
chmod 755 "$(1)" ;
|
||||
}
|
||||
|
||||
rule PackageInstallZip
|
||||
{
|
||||
Depends $(1) : $(2) ;
|
||||
Clean cleanPackages : $(1) ;
|
||||
}
|
||||
|
||||
actions together PackageInstallZip
|
||||
{
|
||||
cd "$(1:P)" ;
|
||||
zip -rqy "$(1:BS)" boot ;
|
||||
}
|
||||
|
||||
rule LinkInstallZip
|
||||
{
|
||||
Depends $(1) : $(2) ;
|
||||
Clean cleanPackages : $(1) ;
|
||||
}
|
||||
|
||||
actions together LinkInstallZip
|
||||
{
|
||||
ln -sf "`pwd`/$(2)" "$(1)" ;
|
||||
}
|
||||
@@ -0,0 +1,303 @@
|
||||
# test pseudo targets
|
||||
NOTFILE obostests ;
|
||||
NOTFILE r5tests ;
|
||||
|
||||
rule CommonTestLib
|
||||
{
|
||||
# CommonTestLib <target> : <sources> : <obos libraries>
|
||||
# : <r5 libraries> : <test libraries> : <public headers>;
|
||||
# Builds a unit test for both OBOS and R5 modules.
|
||||
# <target> The name of the target.
|
||||
# <sources> The list of sources.
|
||||
# <obos libraries> A list of link libraries for the OBOS tests (as passed
|
||||
# to LinkAgainst).
|
||||
# <r5 libraries> A list of link libraries for the R5 tests (as passed
|
||||
# to LinkAgainst).
|
||||
# <test libraries> A list of link libraries for both OBOS tests and R5 tests
|
||||
# that have a common name (i.e. specify libx.so and the OBOS tests will link
|
||||
# to libx.so and the R5 tests will link to libx_r5.so).
|
||||
# <public headers> A list of public header dirs (as passed to
|
||||
# UsePublicHeaders).
|
||||
|
||||
TestLib $(1) : $(2) : [ FDirName $(HAIKU_TEST_DIR) unittester lib ] : $(3) $(5) : $(6) ;
|
||||
R5TestLib $(1) : $(2) : [ FDirName $(HAIKU_TEST_DIR) unittester_r5 lib ] : $(4) [ R5SharedLibraryNames $(5) ] ;
|
||||
}
|
||||
|
||||
rule TestLib
|
||||
{
|
||||
# TestLib <target> : <sources> : <dest> : <libraries> : <public headers>
|
||||
# Builds a unit test library for an OBOS module.
|
||||
# <target> The name of the target.
|
||||
# <sources> The list of sources.
|
||||
# <dest> The directory for the target (as passed to FDirName).
|
||||
# <libraries> A list of link libraries (as passed to LinkAgainst).
|
||||
# <public headers> A list of public header dirs (as passed to
|
||||
# UsePublicHeaders).
|
||||
|
||||
local target = $(1) ;
|
||||
local sources = $(2) ;
|
||||
local dest = $(3) ;
|
||||
local libraries = $(4) ;
|
||||
local headerDirs = $(5) ;
|
||||
local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
|
||||
|
||||
# Our Main replacement.
|
||||
MakeLocate $(target) : $(dest) ;
|
||||
MainFromObjects $(target) : $(objects) ;
|
||||
TestObjects $(sources) : $(headerDirs) ;
|
||||
|
||||
Depends $(target) : libcppunit.so ;
|
||||
Depends obostests : $(target) ;
|
||||
LinkAgainst $(target) : libcppunit.so $(libraries) ;
|
||||
LINKFLAGS on $(target) = $(LINKFLAGS) -nostart -Xlinker -soname=\"$(target)\" ;
|
||||
}
|
||||
|
||||
rule R5TestLib
|
||||
{
|
||||
# R5TestLib <target> : <sources> : <dest> : <libraries>
|
||||
# Builds a unit test for an R5 module. "_r5" is appended to the object
|
||||
# and the target name.
|
||||
# <target> The name of the target.
|
||||
# <sources> The list of sources.
|
||||
# <dest> The directory for the target (as passed to FDirName).
|
||||
# <libraries> A list of link libraries (as passed to LinkAgainst).
|
||||
|
||||
local target = $(1:B)_r5$(1:S) ;
|
||||
local sources = $(2) ;
|
||||
local dest = $(3) ;
|
||||
local libraries = $(4) ;
|
||||
local objects = [ R5ObjectNames $(sources) ] ;
|
||||
|
||||
# Our Main replacement.
|
||||
MakeLocate $(target) : $(dest) ;
|
||||
MainFromObjects $(target) : $(objects) ;
|
||||
TestObjects $(sources) : : true ;
|
||||
|
||||
Depends $(target) : libcppunit.so ;
|
||||
Depends r5tests : $(target) ;
|
||||
LinkAgainst $(target) : libcppunit.so $(libraries) ;
|
||||
LINKFLAGS on $(target) = $(LINKFLAGS) -nostart -Xlinker -soname=\"$(target)\" ;
|
||||
}
|
||||
|
||||
rule CommonUnitTest
|
||||
{
|
||||
# CommonUnitTest <target> : <sources> : <dest> : <obos libraries>
|
||||
# : <r5 libraries> : <public headers>;
|
||||
# Builds a unit test for both OBOS and R5 modules.
|
||||
# <target> The name of the target.
|
||||
# <sources> The list of sources.
|
||||
# <dest> The directory for the target (as passed to FDirName).
|
||||
# <obos libraries> A list of link libraries for the OBOS tests (as passed
|
||||
# to LinkAgainst).
|
||||
# <r5 libraries> A list of link libraries for the R5 tests (as passed
|
||||
# to LinkAgainst).
|
||||
# <public headers> A list of public header dirs (as passed to
|
||||
# UsePublicHeaders).
|
||||
|
||||
UnitTest $(1) : $(2) : $(3) : $(4) : $(6) ;
|
||||
R5UnitTest $(1) : $(2) : $(3) : $(5) ;
|
||||
}
|
||||
|
||||
rule UnitTest
|
||||
{
|
||||
# UnitTest <target> : <sources> : <dest> : <libraries> : <public headers>
|
||||
# Builds a unit test for an OBOS module.
|
||||
# <target> The name of the target.
|
||||
# <sources> The list of sources.
|
||||
# <dest> The directory for the target (as passed to FDirName).
|
||||
# <libraries> A list of link libraries (as passed to LinkAgainst).
|
||||
# <public headers> A list of public header dirs (as passed to
|
||||
# UsePublicHeaders).
|
||||
|
||||
local target = $(1) ;
|
||||
local sources = $(2) ;
|
||||
local dest = $(3) ;
|
||||
local libraries = $(4) ;
|
||||
local headerDirs = $(5) ;
|
||||
local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
|
||||
|
||||
# Our Main replacement.
|
||||
MakeLocate $(target) : [ FDirName $(HAIKU_TEST_DIR) $(dest) ] ;
|
||||
MainFromObjects $(target) : $(objects) ;
|
||||
TestObjects $(sources) : $(headerDirs) ;
|
||||
|
||||
Depends $(target) : libcppunit.so ;
|
||||
Depends obostests : $(target) ;
|
||||
LinkAgainst $(target) : libcppunit.so $(libraries) ;
|
||||
}
|
||||
|
||||
rule R5UnitTest
|
||||
{
|
||||
# R5UnitTest <target> : <sources> : <dest> : <libraries>
|
||||
# Builds a unit test for an R5 module. "_r5" is appended to the object
|
||||
# and the target name.
|
||||
# <target> The name of the target.
|
||||
# <sources> The list of sources.
|
||||
# <dest> The directory for the target (as passed to FDirName).
|
||||
# <libraries> A list of link libraries (as passed to LinkAgainst).
|
||||
|
||||
local target = $(1)_r5 ;
|
||||
local sources = $(2) ;
|
||||
local dest = $(3) ;
|
||||
local libraries = $(4) ;
|
||||
local objects = [ R5ObjectNames $(sources) ] ;
|
||||
|
||||
# Our Main replacement.
|
||||
MakeLocate $(target) : [ FDirName $(HAIKU_TEST_DIR) $(dest) ] ;
|
||||
MainFromObjects $(target) : $(objects) ;
|
||||
TestObjects $(sources) : : true ;
|
||||
|
||||
Depends $(target) : libcppunit.so ;
|
||||
Depends r5tests : $(target) ;
|
||||
LinkAgainst $(target) : libcppunit.so $(libraries) ;
|
||||
}
|
||||
|
||||
rule R5ObjectNames
|
||||
{
|
||||
# R5ObjectNames <sources> ;
|
||||
# Returns a list of gristed object names given a list of source file names.
|
||||
# Moreover each object names gets "_r5" inserted before the object suffix.
|
||||
local objects = $(1:S=)_r5 ;
|
||||
return [ FGristFiles $(objects:S=$(SUFOBJ)) ] ;
|
||||
}
|
||||
|
||||
rule R5Objects
|
||||
{
|
||||
# R5Objects <sources>
|
||||
# Similar to Objects, but appends "_r5" to the object file names and
|
||||
# removes `-nostdinc' from the CC and C++ flags to enable system headers.
|
||||
# <sources> The source files.
|
||||
|
||||
# Remove `-nostdinc' from CCFLAGS and C++FLAGS.
|
||||
local oldCCFLAGS = $(CCFLAGS) ;
|
||||
local oldC++FLAGS = $(C++FLAGS) ;
|
||||
CCFLAGS = [ FFilter $(CCFLAGS) : -nostdinc ] ;
|
||||
C++FLAGS = [ FFilter $(C++FLAGS) : -nostdinc ] ;
|
||||
|
||||
local sources = $(1) ;
|
||||
local source ;
|
||||
for source in [ FGristFiles $(sources) ]
|
||||
{
|
||||
local object = [ R5ObjectNames $(source) ] ;
|
||||
Object $(object) : $(source) ;
|
||||
LocalDepends obj : $(object) ;
|
||||
}
|
||||
|
||||
# Reset CCFLAGS and C++FLAGS to original values.
|
||||
CCFLAGS = $(oldCCFLAGS) ;
|
||||
C++FLAGS = $(oldC++FLAGS) ;
|
||||
}
|
||||
|
||||
rule TestObjects
|
||||
{
|
||||
# TestLib <sources> : <public headers> : <r5>
|
||||
# Compiles objects for tests.
|
||||
# <sources> The list of sources.
|
||||
# <public headers> A list of public header dirs (as passed to
|
||||
# UsePublicHeaders).
|
||||
# <r5> If set, "_r5" is appended to the object file names and
|
||||
# <public headers> is ignored. Furthermore the pre-processor macro
|
||||
# TEST_R5 is defined, TEST_OBOS otherwise.
|
||||
|
||||
local sources = $(1) ;
|
||||
local headerDirs = $(2) ;
|
||||
local r5 = $(3) ;
|
||||
local objects ;
|
||||
|
||||
if $(r5) {
|
||||
objects = [ R5ObjectNames $(sources) ] ;
|
||||
} else {
|
||||
objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
|
||||
}
|
||||
|
||||
# Turn optimization off, if desired.
|
||||
if ! $(NO_TEST_DEBUG) {
|
||||
OPTIM on $(objects) = ;
|
||||
}
|
||||
|
||||
# set headers/defines
|
||||
UseCppUnitObjectHeaders $(sources) : $(objects) ;
|
||||
if $(r5) {
|
||||
ObjectDefines $(sources) : TEST_R5 ;
|
||||
} else {
|
||||
UsePublicObjectHeaders $(sources) : $(headerDirs) : $(objects) ;
|
||||
ObjectDefines $(sources) : TEST_OBOS ;
|
||||
}
|
||||
|
||||
if ! $(NO_TEST_DEBUG) {
|
||||
# Turn debugging on. That is usually desired for test code.
|
||||
ObjectCcFlags $(objects) : $(DEBUG_FLAGS) ;
|
||||
ObjectC++Flags $(objects) : $(DEBUG_FLAGS) ;
|
||||
}
|
||||
|
||||
# compile
|
||||
if $(r5) {
|
||||
R5Objects $(sources) ;
|
||||
} else {
|
||||
Objects $(sources) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule R5SharedLibraryNames
|
||||
{
|
||||
# R5SharedLibraryNames <sources> ;
|
||||
# Returns a list of shared library names given a list of file names. NO
|
||||
# GRISTING IS PERFORMED :-) However, each library names gets "_r5" inserted
|
||||
# before the shared lib suffix.
|
||||
return $(1:S=)_r5.so ;
|
||||
}
|
||||
|
||||
rule SimpleTest
|
||||
{
|
||||
# UnitTest <target> : <sources> : <libraries>
|
||||
# Builds a unit test for an OBOS module.
|
||||
# <target> The name of the target.
|
||||
# <sources> The list of sources.
|
||||
# <dest> The directory for the target (as passed to FDirName).
|
||||
# <libraries> A list of link libraries (as passed to LinkAgainst).
|
||||
# <public headers> A list of public header dirs (as passed to
|
||||
# UsePublicHeaders).
|
||||
|
||||
local target = $(1) ;
|
||||
local sources = $(2) ;
|
||||
local libraries = $(3) ;
|
||||
local relPath = [ FRelPath src tests : $(SUBDIR_TOKENS) ] ;
|
||||
|
||||
# Turn optimization off.
|
||||
if ! $(NO_TEST_DEBUG) {
|
||||
local optim = $(OPTIM) ;
|
||||
OPTIM = ;
|
||||
}
|
||||
|
||||
ObjectDefines $(sources) : TEST_OBOS ;
|
||||
MakeLocate $(target) : [ FDirName $(HAIKU_TEST_DIR) $(relPath) ] ;
|
||||
Main $(target) : $(sources) ;
|
||||
Depends obostests : $(target) ;
|
||||
LinkAgainst $(target) : $(libraries) ;
|
||||
if ! $(NO_TEST_DEBUG) {
|
||||
# Turn debugging on. That is usually desired for test code.
|
||||
ObjectCcFlags $(sources) : $(DEBUG_FLAGS) ;
|
||||
ObjectC++Flags $(sources) : $(DEBUG_FLAGS) ;
|
||||
|
||||
# Turn optimization on again.
|
||||
OPTIM = $(optim) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule BuildPlatformTest
|
||||
{
|
||||
# Usage BuildPlatformTest <target> : <sources> ;
|
||||
|
||||
local target = $(1) ;
|
||||
local sources = $(2) ;
|
||||
|
||||
local relPath ;
|
||||
if [ FIsPrefix src tests : $(SUBDIR_TOKENS) ] {
|
||||
relPath = $(SUBDIR_TOKENS[3-]) ;
|
||||
} else {
|
||||
relPath = $(SUBDIR_TOKENS[2-]) ;
|
||||
}
|
||||
MakeLocate $(target) : [ FDirName $(HAIKU_TEST_DIR) $(relPath) ] ;
|
||||
|
||||
BuildPlatformMain $(target) : $(sources) ;
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
# UserBuildConfig can be used to customize the build according to your needs.
|
||||
# If existent it is included by the build system, but it is ignored by svn.
|
||||
# This file documents a few examples, what can be done.
|
||||
|
||||
# Adjusting Build Variables
|
||||
|
||||
# Turn off warnings in directory src/system/kernel. As fourth (scope) parameter
|
||||
# "local" is specified, which means, that this setting applies only to the
|
||||
# given directory, but not any of its subdirectories.
|
||||
SetConfigVar WARNINGS : HAIKU_TOP src system kernel : 0 : local ;
|
||||
|
||||
# Add "RUN_WITHOUT_REGISTRAR" to the DEFINES for the directory src/kits and
|
||||
# all its subdirectories (scope is "global").
|
||||
AppendToConfigVar DEFINES : HAIKU_TOP src kits : RUN_WITHOUT_REGISTRAR
|
||||
: global ;
|
||||
|
||||
# Set the debug level for file src/bin/gdb/gdb/haiku-nat.c (note, that
|
||||
# the object file must be specified) to 1. It is worth mentioning, that the
|
||||
# executable the object file is linked into (gdb), will still be placed in
|
||||
# generated/objects/.../release/... Only when setting DEBUG for the executable,
|
||||
# too, it will be placed in .../debug_1/...
|
||||
DEBUG on <src!bin!gdb!gdb!>haiku-nat.o = 1 ;
|
||||
|
||||
|
||||
# Haiku Image Related Modifications
|
||||
|
||||
# Create a 100 MB image at /tmp/walter.image.
|
||||
HAIKU_IMAGE_NAME = walter.image ;
|
||||
HAIKU_IMAGE_DIR = /tmp ;
|
||||
HAIKU_IMAGE_SIZE = 100 ;
|
||||
|
||||
# Install Haiku in directory /Haiku.
|
||||
HAIKU_INSTALL_DIR = /Haiku ;
|
||||
|
||||
# Add "crashing_app" to the beos/bin directory of the Haiku image/installation.
|
||||
# Note, that this also makes the image depend on the target, i.e. it is
|
||||
# automatically updated when the image is built.
|
||||
AddFilesToHaikuImage beos bin : crashing_app ;
|
||||
|
||||
# Make a symlink to home/config/bin/crash.
|
||||
AddSymlinkToHaikuImage home config bin : /beos/bin/crashing_app : crash ;
|
||||
|
||||
# Specify scripts that shall be run when populating the image/installation
|
||||
# directory. The "early" script is run before anything has been copied onto
|
||||
# the image/into the installation directory. The "late" script is run after
|
||||
# everything has been copied, but before the MIME database is installed.
|
||||
HAIKU_IMAGE_EARLY_USER_SCRIPTS = $(HAIKU_TOP)/../early-image-script.sh ;
|
||||
HAIKU_IMAGE_LATE_USER_SCRIPTS = $(HAIKU_TOP)/../late-image-script.sh ;
|
||||
|
||||
|
||||
# Creating Sourceable Shell Scripts
|
||||
|
||||
# If you use shell scripts (e.g. for testing) that need to access targets or
|
||||
# build system properties, you can tell the build system to generate a
|
||||
# variables defining shell script you can source from your shell script.
|
||||
|
||||
# General setup for the shell script to generate. Name is test.inc, located
|
||||
# in the output directory.
|
||||
MakeLocate test.inc : $(HAIKU_OUTPUT_DIR) ;
|
||||
Always test.inc ;
|
||||
|
||||
# Define variable "outputDir" in the shell script, with the value of
|
||||
# HAIKU_OUTPUT_DIR.
|
||||
AddVariableToScript test.inc : outputDir : $(HAIKU_OUTPUT_DIR) ;
|
||||
|
||||
# Define variables "bfsShell" and "fsShellCommand" referring to the
|
||||
# generated bfs_shell and fs_shell_command respectively.
|
||||
AddTargetVariableToScript test.inc : bfs_shell : bfsShell ;
|
||||
AddTargetVariableToScript test.inc : fs_shell_command : fsShellCommand ;
|
||||
|
||||
# If no variable name is given, the name (without grist) of the target is
|
||||
# used, i.e. a variable "rc" referring to the rc command built for the host
|
||||
# platform is defined in the script.
|
||||
AddTargetVariableToScript test.inc : <build>rc ;
|
||||
Reference in New Issue
Block a user