2005-03-05 15:11:02 +01:00
|
|
|
# Haiku main build rules
|
|
|
|
|
2002-07-17 01:25:46 +02:00
|
|
|
# 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
|
|
|
|
|
2005-07-04 13:14:31 +02:00
|
|
|
BUILD_PLATFORM_DEFINES = $(DEFINES) ;
|
|
|
|
|
2002-11-20 01:46:04 +01:00
|
|
|
# The directory for build system specific files
|
|
|
|
OBOS_BUILD_DIR = [ FDirName $(OBOS_TOP) build ] ;
|
|
|
|
|
|
|
|
# Cache files for header scanning and jamfile caching
|
|
|
|
HCACHEFILE = header_cache ;
|
|
|
|
JCACHEFILE = jamfile_cache ;
|
|
|
|
LOCATE on $(HCACHEFILE) $(JCACHEFILE) = $(OBOS_BUILD_DIR) ;
|
2002-07-17 01:25:46 +02:00
|
|
|
|
2005-01-26 02:34:37 +01:00
|
|
|
# Include BuildConfig/Timezones/libgccObjects
|
2002-07-09 14:24:59 +02:00
|
|
|
{
|
2002-11-20 01:46:04 +01:00
|
|
|
local buildConfig = [ GLOB $(OBOS_BUILD_DIR) : BuildConfig ] ;
|
2005-01-26 02:34:37 +01:00
|
|
|
local timezones = [ GLOB $(OBOS_BUILD_DIR) : Timezones ] ;
|
|
|
|
local libgccObjects = [ GLOB $(OBOS_BUILD_DIR) : libgccObjects ] ;
|
|
|
|
|
|
|
|
if ! $(buildConfig) {
|
|
|
|
ECHO "No `BuildConfig' found in $(OBOS_BUILD_DIR)!" ;
|
2002-11-20 01:46:04 +01:00
|
|
|
EXIT "Run ./configure in the source tree's root directory first!" ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
2005-01-26 02:34:37 +01:00
|
|
|
if ! ( $(timezones) && $(libgccObjects) ) {
|
|
|
|
ECHO "No `Timezones' or `libgccObjects' found in $(OBOS_BUILD_DIR)!" ;
|
|
|
|
EXIT "Please run ./configure in the source tree's root directory again!" ;
|
|
|
|
}
|
|
|
|
|
2002-11-20 01:46:04 +01:00
|
|
|
LOCATE on BuildConfig = $(OBOS_BUILD_DIR) ;
|
2005-01-26 02:34:37 +01:00
|
|
|
LOCATE on Timezones = $(OBOS_BUILD_DIR) ;
|
|
|
|
LOCATE on libgccObjects = $(OBOS_BUILD_DIR) ;
|
|
|
|
|
2002-11-20 01:46:04 +01:00
|
|
|
include BuildConfig ;
|
2005-01-26 02:34:37 +01:00
|
|
|
include Timezones ;
|
|
|
|
include libgccObjects ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
2003-10-12 19:47:07 +02:00
|
|
|
# analyze GCC version
|
|
|
|
if ! $(GCC_RAW_VERSION) {
|
|
|
|
ECHO "Variable GCC_RAW_VERSION not set. Please run ./configure or" ;
|
|
|
|
EXIT "specify it manually." ;
|
|
|
|
}
|
|
|
|
GCC_VERSION = ;
|
|
|
|
{
|
|
|
|
# split the raw version string at `.' and `-' characters
|
|
|
|
local version = $(GCC_RAW_VERSION) ;
|
|
|
|
while $(version) {
|
|
|
|
local split = [ Match "([^.-]*)[.-](.*)" : $(version) ] ;
|
|
|
|
if $(split) {
|
|
|
|
GCC_VERSION += $(split[1]) ;
|
|
|
|
version = $(split[2]) ;
|
|
|
|
} else {
|
|
|
|
GCC_VERSION += $(version) ;
|
|
|
|
version = ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-05-11 19:28:24 +02:00
|
|
|
# Save the platform default headers.
|
|
|
|
PLATFORM_DEFAULT_HEADERS = $(HDRS) ;
|
|
|
|
|
2004-07-05 20:34:35 +02:00
|
|
|
# Add some grist to the libgcc objects
|
|
|
|
LIBGCC_OBJECTS = $(LIBGCC_OBJECTS:G=libgcc) ;
|
|
|
|
|
2002-10-23 21:23:01 +02:00
|
|
|
# We do not include any local BeOS system headers by default
|
2002-11-15 21:22:35 +01:00
|
|
|
CCFLAGS += -nostdinc ;
|
|
|
|
C++FLAGS += -nostdinc ;
|
2002-10-23 21:23:01 +02:00
|
|
|
|
2004-06-13 00:09:38 +02:00
|
|
|
# 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 ;
|
|
|
|
|
2004-11-11 11:52:14 +01:00
|
|
|
if ! $(TARGET_PLATFORM) {
|
|
|
|
ECHO "Variable TARGET_PLATFORM not set. Please run ./configure or" ;
|
|
|
|
EXIT "specify it manually." ;
|
|
|
|
}
|
2004-10-25 10:44:06 +02:00
|
|
|
switch $(TARGET_PLATFORM)
|
|
|
|
{
|
|
|
|
case r5 :
|
|
|
|
{
|
2004-11-11 11:52:14 +01:00
|
|
|
# "everything" is r5 compatible
|
2004-10-25 10:44:06 +02:00
|
|
|
}
|
|
|
|
case bone :
|
|
|
|
{
|
|
|
|
BONE_COMPATIBLE = true ;
|
|
|
|
}
|
|
|
|
case dano :
|
|
|
|
{
|
|
|
|
BONE_COMPATIBLE = true ;
|
|
|
|
DANO_COMPATIBLE = true ;
|
|
|
|
}
|
|
|
|
case haiku :
|
|
|
|
{
|
|
|
|
BONE_COMPATIBLE = true ;
|
|
|
|
DANO_COMPATIBLE = true ;
|
|
|
|
HAIKU_COMPATIBLE = true ;
|
2004-11-29 00:30:28 +01:00
|
|
|
DEFINES += __HAIKU__ ;
|
2004-10-25 10:44:06 +02:00
|
|
|
}
|
2004-10-18 05:01:19 +02:00
|
|
|
}
|
2004-11-20 22:10:54 +01:00
|
|
|
if $(BONE_COMPATIBLE) {
|
2005-04-12 06:22:55 +02:00
|
|
|
NETWORK_LIBS = libsocket.so libbind.so ;
|
2005-05-03 00:19:07 +02:00
|
|
|
NETAPI_LIB = libbnetapi.so ;
|
2004-11-29 01:19:29 +01:00
|
|
|
SELECT_UNAME_ETC_LIB = libroot.so ;
|
2004-11-20 22:10:54 +01:00
|
|
|
} else {
|
2005-04-12 06:22:55 +02:00
|
|
|
NETWORK_LIBS = libnet.so ;
|
2005-05-03 00:19:07 +02:00
|
|
|
NETAPI_LIB = libnetapi.so ;
|
2004-11-29 01:19:29 +01:00
|
|
|
SELECT_UNAME_ETC_LIB = libnet.so ;
|
2004-11-20 22:10:54 +01:00
|
|
|
}
|
2004-10-18 05:01:19 +02:00
|
|
|
|
2002-07-09 14:24:59 +02:00
|
|
|
# Determine if we're building on PPC or x86
|
|
|
|
# Determine mimetype of executable
|
|
|
|
# Cross compiling can come later
|
|
|
|
|
2003-05-03 19:01:03 +02:00
|
|
|
TARGET_CPU ?= $(OSPLAT:L) ;
|
2003-05-03 18:39:41 +02:00
|
|
|
|
|
|
|
switch $(TARGET_CPU) {
|
|
|
|
case ppc :
|
|
|
|
{
|
|
|
|
if $(METROWERKS) {
|
|
|
|
# at least parts of OpenBeOS still can be compiled with
|
|
|
|
# the Metrowerks compiler on BeOS/PPC
|
|
|
|
OBOS_TARGET_TYPE ?= "application/x-be-executable" ;
|
|
|
|
} else {
|
|
|
|
OBOS_TARGET_TYPE ?= "application/x-vnd.Be-elfexecutable" ;
|
|
|
|
}
|
2004-10-24 11:08:02 +02:00
|
|
|
DEFINES += __POWERPC__ ARCH_ppc ;
|
2003-06-25 00:54:28 +02:00
|
|
|
OBOS_BOOT_PLATFORM = openfirmware ;
|
2003-05-03 18:39:41 +02:00
|
|
|
}
|
|
|
|
case x86 :
|
|
|
|
{
|
|
|
|
# nothing special to do here...
|
2004-10-24 11:08:02 +02:00
|
|
|
DEFINES += __INTEL__ ARCH_x86 ;
|
2003-06-25 00:54:28 +02:00
|
|
|
OBOS_BOOT_PLATFORM = bios_ia32 ;
|
2003-05-03 18:39:41 +02:00
|
|
|
}
|
|
|
|
case * :
|
|
|
|
Exit "Currently unsupported build platform:" $(TARGET_CPU) ;
|
|
|
|
}
|
|
|
|
|
2005-08-20 21:54:37 +02:00
|
|
|
# We might later want to introduce debug levels or handle the whole issue
|
|
|
|
# differently. For now there's only on or off.
|
|
|
|
#
|
|
|
|
DEBUG ?= 0 ;
|
|
|
|
if $(DEBUG) != 0 {
|
|
|
|
OPTIM ?= -O0 ;
|
|
|
|
TARGET_DEBUG ?= debug_$(DEBUG) ;
|
|
|
|
} else {
|
|
|
|
OPTIM ?= -O2 ;
|
|
|
|
TARGET_DEBUG ?= release ;
|
|
|
|
}
|
|
|
|
|
2003-05-03 18:39:41 +02:00
|
|
|
# set target specific variables
|
|
|
|
{
|
|
|
|
#Echo "Building for" $(TARGET_CPU) ;
|
|
|
|
|
2005-08-20 21:54:37 +02:00
|
|
|
OBOS_TARGET ?= $(TARGET_CPU).$(TARGET_DEBUG).$(TARGET_PLATFORM) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
OBOS_TARGET_TYPE ?= "application/x-vnd.Be-elfexecutable" ;
|
2003-05-03 18:39:41 +02:00
|
|
|
OBOS_ARCH ?= $(TARGET_CPU) ;
|
|
|
|
OBOS_TARGET_DEFINE ?= "ARCH_"$(TARGET_CPU) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
2003-08-27 01:16:05 +02:00
|
|
|
# Disable warnings only if WARNINGS is set to 0
|
2002-07-12 18:47:41 +02:00
|
|
|
# Should be enabled by default later
|
2002-09-17 00:21:37 +02:00
|
|
|
#
|
2003-08-27 01:16:05 +02:00
|
|
|
WARNINGS ?= 1 ;
|
|
|
|
if $(WARNINGS) = 1 {
|
2002-07-12 18:47:41 +02:00
|
|
|
# For an explanation of the different warning options, see:
|
|
|
|
# http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_2.html
|
|
|
|
# to get even more warnings, add:
|
|
|
|
# -Wwrite-strings (doesn't work well with some Be headers)
|
|
|
|
# -Wundef (dito)
|
|
|
|
# -Wconversion (gets you many warnings about implicit conversions)
|
|
|
|
# -W (gets you even more warnigs)
|
2002-11-15 21:22:35 +01:00
|
|
|
CCFLAGS += -Wall -Wno-multichar -Wmissing-prototypes ;
|
|
|
|
CCFLAGS += -Wpointer-arith -Wcast-align -Wsign-compare ;
|
|
|
|
C++FLAGS += -Wall -Wno-multichar -Wmissing-prototypes -Wno-ctor-dtor-privacy -Woverloaded-virtual ;
|
|
|
|
C++FLAGS += -Wpointer-arith -Wcast-align -Wsign-compare ;
|
2003-05-18 18:16:09 +02:00
|
|
|
} else {
|
|
|
|
CCFLAGS += -Wno-multichar ;
|
|
|
|
C++FLAGS += -Wno-multichar ;
|
2002-07-12 18:47:41 +02:00
|
|
|
}
|
|
|
|
|
2003-05-18 18:16:09 +02:00
|
|
|
# standard kernel C/C++ flags
|
2002-11-28 15:06:11 +01:00
|
|
|
KERNEL_CCFLAGS ?= -Wall -Wno-multichar -Wmissing-prototypes -finline -nostdinc ;
|
2004-12-20 14:52:57 +01:00
|
|
|
KERNEL_CCFLAGS += -fno-builtin -D$(OBOS_TARGET_DEFINE) -D__HAIKU__ ;
|
2004-02-15 19:07:11 +01:00
|
|
|
KERNEL_CCFLAGS += -DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) -D_KERNEL_MODE ;
|
2003-05-18 18:16:09 +02:00
|
|
|
KERNEL_C++FLAGS ?= -Wall -Wno-multichar -Wmissing-prototypes -finline -nostdinc ;
|
2004-12-20 14:52:57 +01:00
|
|
|
KERNEL_C++FLAGS += -fno-builtin -fno-exceptions -D$(OBOS_TARGET_DEFINE) -D__HAIKU__ ;
|
2004-02-15 19:07:11 +01:00
|
|
|
KERNEL_C++FLAGS += -DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) -D_KERNEL_MODE ;
|
2003-10-12 23:04:53 +02:00
|
|
|
if $(GCC_VERSION[1]) >= 3 {
|
|
|
|
KERNEL_C++FLAGS += -fno-use-cxa-atexit ;
|
|
|
|
}
|
2005-03-04 00:15:44 +01:00
|
|
|
DEBUG_FLAGS ?= -g ;
|
2003-08-27 01:16:05 +02:00
|
|
|
if $(DEBUG) != 0 {
|
2005-03-04 00:15:44 +01:00
|
|
|
CCFLAGS += $(DEBUG_FLAGS) [ FDefines DEBUG=$(DEBUG) ] ;
|
|
|
|
C++FLAGS += $(DEBUG_FLAGS) [ FDefines DEBUG=$(DEBUG) ] ;
|
|
|
|
KERNEL_CCFLAGS += $(DEBUG_FLAGS) [ FDefines DEBUG=$(DEBUG) ] ;
|
|
|
|
KERNEL_C++FLAGS += $(DEBUG_FLAGS) [ FDefines DEBUG=$(DEBUG) ] ;
|
|
|
|
LINKFLAGS += $(DEBUG_FLAGS) ;
|
2002-07-17 01:25:46 +02:00
|
|
|
}
|
2005-08-20 21:54:37 +02:00
|
|
|
|
|
|
|
# define NDEBUG to a non-zero value to suppress asserts
|
|
|
|
NDEBUG ?= 0 ;
|
|
|
|
if $(NDEBUG) != 0 {
|
|
|
|
CCFLAGS += [ FDefines NDEBUG=$(NDEBUG) ] ;
|
|
|
|
C++FLAGS += [ FDefines NDEBUG=$(NDEBUG) ] ;
|
|
|
|
KERNEL_CCFLAGS += [ FDefines NDEBUG=$(NDEBUG) ] ;
|
|
|
|
KERNEL_C++FLAGS += [ FDefines NDEBUG=$(NDEBUG) ] ;
|
|
|
|
}
|
|
|
|
|
2002-09-17 00:21:37 +02:00
|
|
|
#
|
|
|
|
# To disable for the tests OPTIM and DEBUG are overridden, set the environment
|
|
|
|
# variable NO_TEST_DEBUG.
|
2002-07-17 01:25:46 +02:00
|
|
|
|
2005-01-15 22:32:51 +01:00
|
|
|
# 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) {
|
|
|
|
CCFLAGS += [ FDefines DEBUG_PRINTF=$(DEBUG_PRINTF) ] ;
|
|
|
|
C++FLAGS += [ FDefines DEBUG_PRINTF=$(DEBUG_PRINTF) ] ;
|
|
|
|
}
|
|
|
|
|
2002-07-24 19:46:02 +02:00
|
|
|
# Instructs the Library rule to not make its object files temporary.
|
2003-09-04 21:12:09 +02:00
|
|
|
# This is needed as some objects are used in a static library and for an
|
2002-07-24 19:46:02 +02:00
|
|
|
# executable.
|
|
|
|
KEEPOBJS = true ;
|
|
|
|
|
2003-06-17 20:13:22 +02:00
|
|
|
# under BeOS use copyattr instead of cp
|
|
|
|
if $(OS) = BEOS
|
|
|
|
{
|
|
|
|
CP = copyattr --data ;
|
|
|
|
}
|
|
|
|
|
2004-09-10 20:27:29 +02:00
|
|
|
# for builds of tools in the current environment
|
|
|
|
if $(OS) = BEOS {
|
|
|
|
BUILD_LIBSTDC++ = stdc++.r4 ;
|
|
|
|
} else {
|
|
|
|
BUILD_LIBSTDC++ = stdc++ ;
|
|
|
|
}
|
|
|
|
|
2005-03-04 00:15:44 +01:00
|
|
|
if $(GCC_VERSION[1]) >= 3 {
|
|
|
|
C++_SUPPORT_LIBS = supc++ ;
|
2005-03-06 18:03:29 +01:00
|
|
|
KERNEL_C++_SUPPORT_LIBS = -L/usr/lib -l$(C++_SUPPORT_LIBS) -lgcc_eh ;
|
|
|
|
# TODO: -L/usr/lib is a bit Linux specific.
|
|
|
|
STL_HEADERS = /usr/include/g++ ;
|
|
|
|
# TODO: Also a bit Linux specific.
|
2005-03-04 00:15:44 +01:00
|
|
|
} else {
|
|
|
|
C++_SUPPORT_LIBS = ;
|
2005-03-06 18:03:29 +01:00
|
|
|
KERNEL_C++_SUPPORT_LIBS = ;
|
|
|
|
STL_HEADERS = [ FDirName $(OBOS_TOP) headers cpp ] ;
|
2005-03-04 00:15:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-07-09 14:24:59 +02:00
|
|
|
# If no OBOS_OBJECT_TARGET is not defined yet, use our default directory and
|
|
|
|
# include our "OBOS_TARGET" as subdirectory in there (to prevent different
|
|
|
|
# builds mixing objects from different targets).
|
|
|
|
if ! $(OBOS_OBJECT_TARGET) {
|
|
|
|
OBOS_OBJECT_TARGET ?= [ FDirName $(OBOS_TOP) objects $(OBOS_TARGET) ] ;
|
|
|
|
}
|
|
|
|
|
|
|
|
# If no OBOS_DISTRO_TARGET is not defined yet, use our default directory and
|
|
|
|
# include our "OBOS_TARGET" as subdirectory in there (to prevent different
|
|
|
|
# builds mixing executables from different targets).
|
|
|
|
if ! $(OBOS_DISTRO_TARGET) {
|
|
|
|
OBOS_DISTRO_TARGET ?= [ FDirName $(OBOS_TOP) distro $(OBOS_TARGET) ] ;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Set our version number if not already set and mark it as a developer build
|
|
|
|
if ! $(OBOS_BUILD_VERSION) {
|
|
|
|
OBOS_BUILD_VERSION ?= "1 0 0 a 1" ;
|
|
|
|
OBOS_BUILD_DESCRIPTION ?= "Developer Build" ;
|
|
|
|
}
|
|
|
|
|
|
|
|
# If OBOS_BUILD_VERSION is set, but OBOS_BUILD_DESCRIPTION isn't, mark it as
|
|
|
|
# an unknown build.
|
|
|
|
if ! $(OBOS_BUILD_DESCRIPTION) {
|
|
|
|
OBOS_BUILD_DESCRIPTION ?= "Unknown Build" ;
|
|
|
|
}
|
|
|
|
|
2003-07-30 23:12:06 +02:00
|
|
|
# Relative subdirs for distro dir
|
|
|
|
OBOS_ADDON_DIR ?= [ FDirName $(OBOS_DISTRO_TARGET) beos system add-ons ] ;
|
2002-07-09 15:40:32 +02:00
|
|
|
OBOS_APPS_DIR ?= [ FDirName $(OBOS_DISTRO_TARGET) beos apps ] ;
|
2002-07-12 00:10:01 +02:00
|
|
|
OBOS_BIN_DIR ?= [ FDirName $(OBOS_DISTRO_TARGET) beos bin ] ;
|
2003-07-30 23:12:06 +02:00
|
|
|
OBOS_ETC_DIR ?= [ FDirName $(OBOS_DISTRO_TARGET) beos etc ] ;
|
|
|
|
OBOS_FONTS_DIR ?= [ FDirName $(OBOS_ETC_DIR) fonts ] ;
|
|
|
|
OBOS_KERNEL_DIR ?= [ FDirName $(OBOS_DISTRO_TARGET) beos system ] ;
|
2002-07-09 14:24:59 +02:00
|
|
|
OBOS_PREFS_DIR ?= [ FDirName $(OBOS_DISTRO_TARGET) beos preferences ] ;
|
|
|
|
OBOS_SERVER_DIR ?= [ FDirName $(OBOS_DISTRO_TARGET) beos system servers ] ;
|
|
|
|
OBOS_SHLIB_DIR ?= [ FDirName $(OBOS_DISTRO_TARGET) beos system lib ] ;
|
2003-09-11 22:04:13 +02:00
|
|
|
OBOS_STLIB_DIR ?= [ FDirName $(OBOS_DISTRO_TARGET) develop lib
|
|
|
|
$(OBOS_ARCH) ] ;
|
2002-07-09 14:24:59 +02:00
|
|
|
OBOS_TEST_DIR ?= [ FDirName $(OBOS_TOP) tests ] ;
|
|
|
|
|
2003-12-23 18:23:18 +01:00
|
|
|
OBOS_PACKAGE_DIR ?= [ FDirName $(OBOS_TOP) packages $(OBOS_TARGET) ] ;
|
|
|
|
OBOS_PACKAGE_OBJECT_DIR ?= [ FDirName $(OBOS_OBJECT_TARGET) packages ] ;
|
|
|
|
|
2002-07-09 14:24:59 +02:00
|
|
|
OBOS_KERNEL_CONFIG = config.$(OBOS_ARCH).ini ;
|
|
|
|
OBOS_KERNEL = kernel.$(OBOS_ARCH) ;
|
|
|
|
OBOS_FLOPPY = floppy.$(OBOS_ARCH) ;
|
|
|
|
|
|
|
|
rule SetupIncludes
|
|
|
|
{
|
2005-03-06 18:03:29 +01:00
|
|
|
local os_includes = 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
|
2005-06-26 23:52:51 +02:00
|
|
|
kernel media mail midi midi2 net opengl storage support
|
|
|
|
translation ;
|
2002-10-23 21:23:01 +02:00
|
|
|
|
2002-10-26 22:23:12 +02:00
|
|
|
# Overwrite any exiting content when changing HDRS. This rule may be invoked multiple times.
|
2002-10-23 21:23:01 +02:00
|
|
|
|
|
|
|
# Use headers directory, to allow to do things like include <posix/string.h>
|
2002-10-26 22:23:12 +02:00
|
|
|
HDRS = [ FDirName $(OBOS_TOP) headers ] ;
|
2002-10-23 21:23:01 +02:00
|
|
|
|
|
|
|
# Use posix headers directory
|
2002-10-26 22:23:12 +02:00
|
|
|
HDRS += [ FDirName $(OBOS_TOP) headers posix ] ;
|
2002-10-23 21:23:01 +02:00
|
|
|
|
2005-03-06 18:03:29 +01:00
|
|
|
# TODO: This is actually more correct. Under BeOS
|
|
|
|
# /boot/develop/headers/posix/_G_config.h is included, which is not correct,
|
|
|
|
# since we use another glibc version. This might even be a reason why STL
|
|
|
|
# string has problems (see strace sources). The problem is just that there
|
|
|
|
# are conflicts with STL/gcc headers, if we do that.
|
|
|
|
# # This is nasty, but we don't get around it, since some public headers
|
|
|
|
# # include _G_config.h which in turn includes other private headers.
|
|
|
|
# HDRS += [ FDirName $(OBOS_TOP) src kernel libroot posix glibc include ] ;
|
|
|
|
# HDRS += [ FDirName $(OBOS_TOP) src kernel libroot posix glibc include arch
|
|
|
|
# $(OBOS_ARCH) ] ;
|
|
|
|
# HDRS += [ FDirName $(OBOS_TOP) src kernel libroot posix glibc ] ;
|
|
|
|
# HDRS += [ FDirName $(OBOS_TOP) src kernel libroot posix glibc libio ] ;
|
|
|
|
# # for _G_config.h
|
|
|
|
|
|
|
|
HDRS += $(STL_HEADERS) ;
|
|
|
|
|
2002-10-23 21:23:01 +02:00
|
|
|
# Use public OS header directories
|
2002-10-26 22:23:12 +02:00
|
|
|
HDRS += [ PublicHeaders $(os_includes) ] ;
|
2002-10-23 21:23:01 +02:00
|
|
|
|
2004-10-29 03:27:11 +02:00
|
|
|
# Use the root of the private headers -- not so nice, but simplifies things.
|
|
|
|
HDRS += [ PrivateHeaders $(DOT) ] ;
|
|
|
|
|
2002-10-23 21:23:01 +02:00
|
|
|
# Used as a fallback, the R5 header directories (we should remove this as soon as possible)
|
2002-10-26 22:23:12 +02:00
|
|
|
HDRS += /boot/develop/headers/posix /boot/develop/headers/cpp ;
|
2003-05-06 00:07:33 +02:00
|
|
|
|
|
|
|
# The platform dependent headers.
|
|
|
|
HDRS += $(PLATFORM_HEADERS) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
2002-11-15 21:22:35 +01:00
|
|
|
rule SetupR5Includes
|
|
|
|
{
|
|
|
|
# Unsets HDRS, so that the OBOS headers do not `shadow' the system headers.
|
|
|
|
HDRS = ;
|
|
|
|
}
|
|
|
|
|
2003-05-11 19:28:24 +02:00
|
|
|
rule SetupDefaultIncludes
|
|
|
|
{
|
|
|
|
# Resets HDRS to the default headers for the build platform.
|
|
|
|
HDRS = $(PLATFORM_DEFAULT_HEADERS) ;
|
|
|
|
}
|
|
|
|
|
2002-07-09 14:24:59 +02:00
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# Things Jam needs in order to work :)
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
|
2003-02-17 18:08:34 +01:00
|
|
|
rule Object
|
|
|
|
{
|
|
|
|
# This is basically the original Jambase 2.4 Object rule stripped by
|
|
|
|
# comments. Only the final switch statement has been changed to allow
|
|
|
|
# intermediate C++ files for Yacc and Lex.
|
|
|
|
|
|
|
|
LocalClean clean : $(<) ;
|
|
|
|
|
|
|
|
MakeLocate $(<) : $(LOCATE_TARGET) ;
|
|
|
|
SEARCH on $(>) = $(SEARCH_SOURCE) ;
|
|
|
|
|
|
|
|
HDRS on $(<) = $(SEARCH_SOURCE) $(SUBDIRHDRS) $(HDRS) ;
|
|
|
|
|
|
|
|
HDRRULE on $(>) = HdrRule ;
|
|
|
|
HDRSCAN on $(>) = $(HDRPATTERN) ;
|
|
|
|
HDRSEARCH on $(>) =
|
|
|
|
$(SEARCH_SOURCE:E) $(SUBDIRHDRS) $(HDRS) $(STDHDRS) ;
|
|
|
|
|
|
|
|
HDRGRIST on $(>) = $(HDRGRIST) ;
|
|
|
|
|
|
|
|
DEFINES on $(<) += $(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) ;
|
|
|
|
LexC++ $(<:S=.cpp) : $(>) ;
|
|
|
|
} else {
|
|
|
|
Cc $(<) : $(<:S=.c) ;
|
|
|
|
Lex $(<:S=.c) : $(>) ;
|
|
|
|
}
|
|
|
|
case .s : As $(<) : $(>) ;
|
|
|
|
case .y : if [ on $(2) return $(GENERATE_C++) ] {
|
|
|
|
C++ $(<) : $(<:S=.cpp) ;
|
|
|
|
Bison $(<:S=.cpp) : $(>) ;
|
|
|
|
} else {
|
|
|
|
Cc $(<) : $(<:S=$(YACCGEN)) ;
|
|
|
|
Yacc $(<:S=$(YACCGEN)) : $(>) ;
|
|
|
|
}
|
|
|
|
case * : UserObject $(<) : $(>) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-09 14:24:59 +02:00
|
|
|
rule UserObject
|
|
|
|
{
|
|
|
|
switch $(2)
|
|
|
|
{
|
|
|
|
case *.S : assemble $(1) : $(2) ;
|
2002-07-13 18:50:16 +02:00
|
|
|
case *.o : return ;
|
2002-07-09 14:24:59 +02:00
|
|
|
case * : ECHO "unknown suffix on" $(2) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Override the default to give "prettier" command lines.
|
|
|
|
actions Cc
|
|
|
|
{
|
2004-12-23 22:30:32 +01:00
|
|
|
$(CC) $(CCFLAGS) -c "$(2)" $(CCDEFS) $(CCHDRS) -o "$(1)" ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
actions C++
|
|
|
|
{
|
2002-07-12 20:46:53 +02:00
|
|
|
$(C++) -c "$(2)" $(C++FLAGS) $(CCDEFS) $(CCHDRS) -o "$(1)" ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# General High-level OBOS target rules
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
|
2002-07-09 15:40:32 +02:00
|
|
|
rule App
|
|
|
|
{
|
2004-11-22 03:31:30 +01:00
|
|
|
# App <name> : <sources> : <libraries> : <res> ;
|
2002-10-23 21:23:01 +02:00
|
|
|
SetupIncludes ;
|
2002-07-09 15:40:32 +02:00
|
|
|
SetupObjectsDir ;
|
2004-11-22 03:31:30 +01:00
|
|
|
AddResources $(1) : $(4) ;
|
2003-07-16 22:56:37 +02:00
|
|
|
Main $(1) : $(2) ;
|
|
|
|
MakeLocate $(1) : $(OBOS_APPS_DIR) ;
|
|
|
|
LinkSharedOSLibs $(1) : $(3) ;
|
|
|
|
LINKFLAGS on $(1) = [ on $(1) return $(LINKFLAGS) ]
|
|
|
|
-Xlinker -soname=_APP_ ;
|
2002-07-09 15:40:32 +02:00
|
|
|
}
|
|
|
|
|
2002-07-12 00:10:01 +02:00
|
|
|
rule BinCommand
|
|
|
|
{
|
2004-06-01 11:10:21 +02:00
|
|
|
# BinCommand <name> : <sources> : <libraries> : <res> ;
|
2002-10-23 21:23:01 +02:00
|
|
|
SetupIncludes ;
|
2002-07-12 00:10:01 +02:00
|
|
|
SetupObjectsDir ;
|
2004-06-01 11:10:21 +02:00
|
|
|
AddResources $(1) : $(4) ;
|
2002-07-12 00:10:01 +02:00
|
|
|
Main $(1) : $(2) ;
|
|
|
|
MakeLocate $(1) : $(OBOS_BIN_DIR) ;
|
|
|
|
LinkSharedOSLibs $(1) : $(3) ;
|
2003-07-16 22:56:37 +02:00
|
|
|
LINKFLAGS on $(1) = [ on $(1) return $(LINKFLAGS) ]
|
|
|
|
-Xlinker -soname=_APP_ ;
|
2002-07-12 00:10:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
rule StdBinCommands
|
|
|
|
{
|
2004-06-01 11:10:21 +02:00
|
|
|
# StdBinCommands <sources> : <libs> : <res> ;
|
2002-10-23 21:23:01 +02:00
|
|
|
SetupIncludes ;
|
|
|
|
SetupObjectsDir ;
|
2002-07-12 00:10:01 +02:00
|
|
|
local libs = $(2) ;
|
2004-06-01 11:10:21 +02:00
|
|
|
local ress = $(3) ;
|
2002-08-07 00:10:59 +02:00
|
|
|
local source ;
|
2002-07-12 00:10:01 +02:00
|
|
|
for source in $(1)
|
|
|
|
{
|
|
|
|
local target = $(source:S=) ;
|
2002-10-23 21:23:01 +02:00
|
|
|
|
2004-06-01 11:10:21 +02:00
|
|
|
BinCommand $(target) : $(source) : $(libs) : $(ress) ;
|
2002-07-12 00:10:01 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-09 14:24:59 +02:00
|
|
|
rule Preference
|
|
|
|
{
|
2005-06-07 18:19:59 +02:00
|
|
|
# Preference <name> : <sources> : <libraries> : <res> ;
|
2002-10-23 21:23:01 +02:00
|
|
|
SetupIncludes ;
|
2002-07-09 14:24:59 +02:00
|
|
|
SetupObjectsDir ;
|
2005-06-07 18:19:59 +02:00
|
|
|
AddResources $(1) : $(4) ;
|
2003-07-16 22:56:37 +02:00
|
|
|
Main $(1) : $(2) ;
|
|
|
|
MakeLocate $(1) : $(OBOS_PREFS_DIR) ;
|
|
|
|
LinkSharedOSLibs $(1) : $(3) ;
|
|
|
|
LINKFLAGS on $(1) = [ on $(1) return $(LINKFLAGS) ]
|
|
|
|
-Xlinker -soname=_APP_ ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
rule Server
|
|
|
|
{
|
2003-07-16 22:56:37 +02:00
|
|
|
# Server <name> : <sources> : <libraries> ;
|
2002-07-09 14:24:59 +02:00
|
|
|
|
2002-10-23 21:23:01 +02:00
|
|
|
SetupIncludes ;
|
2002-07-09 14:24:59 +02:00
|
|
|
SetupObjectsDir ;
|
2003-07-16 22:56:37 +02:00
|
|
|
Main $(1) : $(2) ;
|
|
|
|
MakeLocate $(1) : $(OBOS_SERVER_DIR) ;
|
|
|
|
LinkSharedOSLibs $(1) : $(3) ;
|
|
|
|
LINKFLAGS on $(1) = [ on $(1) return $(LINKFLAGS) ]
|
|
|
|
-Xlinker -soname=_APP_ ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# test pseudo targets
|
|
|
|
NOTFILE obostests ;
|
|
|
|
NOTFILE r5tests ;
|
|
|
|
|
2002-07-17 12:50:55 +02:00
|
|
|
rule CommonTestLib
|
|
|
|
{
|
2002-08-11 05:45:17 +02:00
|
|
|
# CommonTestLib <target> : <sources> : <obos libraries>
|
2002-07-18 07:32:00 +02:00
|
|
|
# : <r5 libraries> : <test libraries> : <public headers>;
|
2002-07-17 12:50:55 +02:00
|
|
|
# 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 LinkSharedOSLibs).
|
|
|
|
# <r5 libraries> A list of link libraries for the R5 tests (as passed
|
|
|
|
# to LinkSharedOSLibs).
|
2002-07-18 07:32:00 +02:00
|
|
|
# <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).
|
2002-07-17 12:50:55 +02:00
|
|
|
# <public headers> A list of public header dirs (as passed to
|
|
|
|
# UsePublicHeaders).
|
|
|
|
|
2002-08-11 05:45:17 +02:00
|
|
|
TestLib $(1) : $(2) : [ FDirName $(OBOS_TEST_DIR) unittester lib ] : $(3) $(5) : $(6) ;
|
|
|
|
R5TestLib $(1) : $(2) : [ FDirName $(OBOS_TEST_DIR) unittester_r5 lib ] : $(4) [ R5SharedLibraryNames $(5) ] ;
|
2002-07-17 12:50:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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 LinkSharedOSLibs).
|
|
|
|
# <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) ;
|
2002-08-07 00:10:59 +02:00
|
|
|
local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
|
2002-07-17 12:50:55 +02:00
|
|
|
|
2002-08-07 00:10:59 +02:00
|
|
|
# Our Main replacement.
|
|
|
|
MainFromObjects $(target) : $(objects) ;
|
|
|
|
TestObjects $(sources) : $(headerDirs) ;
|
2002-07-17 12:50:55 +02:00
|
|
|
|
|
|
|
MakeLocate $(target) : $(dest) ;
|
2002-07-17 13:46:16 +02:00
|
|
|
Depends $(target) : libcppunit.so ;
|
|
|
|
Depends obostests : $(target) ;
|
2002-07-17 12:50:55 +02:00
|
|
|
LinkSharedOSLibs $(target) : libcppunit.so $(libraries) ;
|
|
|
|
LINKFLAGS on $(target) = $(LINKFLAGS) -nostart -Xlinker -soname=\"$(target)\" ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule R5TestLib
|
|
|
|
{
|
2002-08-11 05:45:17 +02:00
|
|
|
# R5TestLib <target> : <sources> : <dest> : <libraries>
|
2002-07-17 12:50:55 +02:00
|
|
|
# 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 LinkSharedOSLibs).
|
|
|
|
|
|
|
|
local target = $(1:B)_r5$(1:S) ;
|
|
|
|
local sources = $(2) ;
|
2002-08-11 05:45:17 +02:00
|
|
|
local dest = $(3) ;
|
2002-07-17 12:50:55 +02:00
|
|
|
local libraries = $(4) ;
|
|
|
|
local objects = [ R5ObjectNames $(sources) ] ;
|
|
|
|
|
|
|
|
# Our Main replacement.
|
|
|
|
MainFromObjects $(target) : $(objects) ;
|
2002-08-07 00:10:59 +02:00
|
|
|
TestObjects $(sources) : : true ;
|
2002-07-17 12:50:55 +02:00
|
|
|
|
|
|
|
MakeLocate $(target) : $(dest) ;
|
2002-07-17 13:46:16 +02:00
|
|
|
Depends $(target) : libcppunit.so ;
|
|
|
|
Depends r5tests : $(target) ;
|
2002-07-17 12:50:55 +02:00
|
|
|
LinkSharedOSLibs $(target) : libcppunit.so $(libraries) ;
|
|
|
|
LINKFLAGS on $(target) = $(LINKFLAGS) -nostart -Xlinker -soname=\"$(target)\" ;
|
|
|
|
}
|
|
|
|
|
2002-07-09 14:24:59 +02:00
|
|
|
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 LinkSharedOSLibs).
|
|
|
|
# <r5 libraries> A list of link libraries for the R5 tests (as passed
|
|
|
|
# to LinkSharedOSLibs).
|
|
|
|
# <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 LinkSharedOSLibs).
|
|
|
|
# <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) ;
|
2002-08-07 00:10:59 +02:00
|
|
|
local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
|
2002-07-09 14:24:59 +02:00
|
|
|
|
2002-08-07 00:10:59 +02:00
|
|
|
# Our Main replacement.
|
|
|
|
MainFromObjects $(target) : $(objects) ;
|
|
|
|
TestObjects $(sources) : $(headerDirs) ;
|
2002-07-10 03:54:50 +02:00
|
|
|
|
2002-07-09 14:24:59 +02:00
|
|
|
MakeLocate $(target) : [ FDirName $(OBOS_TEST_DIR) $(dest) ] ;
|
2002-07-17 01:25:46 +02:00
|
|
|
Depends $(target) : libcppunit.so ;
|
|
|
|
Depends obostests : $(target) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
LinkSharedOSLibs $(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 LinkSharedOSLibs).
|
|
|
|
|
|
|
|
local target = $(1)_r5 ;
|
|
|
|
local sources = $(2) ;
|
|
|
|
local dest = $(3) ;
|
|
|
|
local libraries = $(4) ;
|
|
|
|
local objects = [ R5ObjectNames $(sources) ] ;
|
|
|
|
|
|
|
|
# Our Main replacement.
|
|
|
|
MainFromObjects $(target) : $(objects) ;
|
2002-08-07 00:10:59 +02:00
|
|
|
TestObjects $(sources) : : true ;
|
|
|
|
|
|
|
|
MakeLocate $(target) : [ FDirName $(OBOS_TEST_DIR) $(dest) ] ;
|
|
|
|
Depends $(target) : libcppunit.so ;
|
|
|
|
Depends r5tests : $(target) ;
|
|
|
|
LinkSharedOSLibs $(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>
|
2002-11-15 21:22:35 +01:00
|
|
|
# Similar to Objects, but appends "_r5" to the object file names and
|
|
|
|
# removes `-nostdinc' from the CC and C++ flags to enable system headers.
|
2002-08-07 00:10:59 +02:00
|
|
|
# <sources> The source files.
|
|
|
|
|
2002-11-15 21:22:35 +01:00
|
|
|
# Remove `-nostdinc' from CCFLAGS and C++FLAGS.
|
|
|
|
local oldCCFLAGS = $(CCFLAGS) ;
|
|
|
|
local oldC++FLAGS = $(C++FLAGS) ;
|
|
|
|
CCFLAGS = [ Filter $(CCFLAGS) : -nostdinc ] ;
|
|
|
|
C++FLAGS = [ Filter $(C++FLAGS) : -nostdinc ] ;
|
|
|
|
|
2002-08-07 00:10:59 +02:00
|
|
|
local sources = $(1) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
local source ;
|
|
|
|
for source in [ FGristFiles $(sources) ]
|
|
|
|
{
|
|
|
|
local object = [ R5ObjectNames $(source) ] ;
|
|
|
|
Object $(object) : $(source) ;
|
2002-07-17 01:25:46 +02:00
|
|
|
LocalDepends obj : $(object) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
2002-11-15 21:22:35 +01:00
|
|
|
|
|
|
|
# Reset CCFLAGS and C++FLAGS to original values.
|
|
|
|
CCFLAGS = $(oldCCFLAGS) ;
|
|
|
|
C++FLAGS = $(oldC++FLAGS) ;
|
2002-08-07 00:10:59 +02:00
|
|
|
}
|
2002-07-09 14:24:59 +02:00
|
|
|
|
2002-08-07 00:10:59 +02:00
|
|
|
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 ;
|
|
|
|
|
|
|
|
# Turn optimization off.
|
2002-09-17 00:21:37 +02:00
|
|
|
if ! $(NO_TEST_DEBUG) {
|
|
|
|
local optim = $(OPTIM) ;
|
|
|
|
OPTIM = ;
|
|
|
|
}
|
2002-08-07 00:10:59 +02:00
|
|
|
|
|
|
|
SetupObjectsDir ;
|
|
|
|
|
|
|
|
# compile
|
|
|
|
if $(r5) {
|
2002-11-15 21:22:35 +01:00
|
|
|
SetupR5Includes ;
|
2002-08-07 00:10:59 +02:00
|
|
|
objects = [ R5ObjectNames $(sources) ] ;
|
|
|
|
R5Objects $(sources) ;
|
|
|
|
} else {
|
2002-11-15 21:22:35 +01:00
|
|
|
SetupIncludes ;
|
2002-08-07 00:10:59 +02:00
|
|
|
objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
|
|
|
|
Objects $(sources) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
# set headers/defines
|
2002-12-09 13:43:02 +01:00
|
|
|
UseCppUnitObjectHeaders $(sources) : $(objects) ;
|
2002-08-07 00:10:59 +02:00
|
|
|
if $(r5) {
|
2003-09-11 22:48:05 +02:00
|
|
|
ObjectsDefines $(objects) : TEST_R5 ;
|
2002-08-07 00:10:59 +02:00
|
|
|
} else {
|
2002-12-09 13:43:02 +01:00
|
|
|
UsePublicObjectHeaders $(sources) : $(headerDirs) : $(objects) ;
|
2003-09-11 22:48:05 +02:00
|
|
|
ObjectsDefines $(objects) : TEST_OBOS ;
|
2002-08-07 00:10:59 +02:00
|
|
|
}
|
2002-07-09 14:24:59 +02:00
|
|
|
|
2002-09-17 00:21:37 +02:00
|
|
|
if ! $(NO_TEST_DEBUG) {
|
|
|
|
# Turn debugging on. That is usually desired for test code.
|
2005-03-04 00:15:44 +01:00
|
|
|
ObjectCcFlags $(objects) : $(DEBUG_FLAGS) ;
|
|
|
|
ObjectC++Flags $(objects) : $(DEBUG_FLAGS) ;
|
2002-07-10 03:54:50 +02:00
|
|
|
|
2002-09-17 00:21:37 +02:00
|
|
|
# Turn optimization on again.
|
|
|
|
OPTIM = $(optim) ;
|
|
|
|
}
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
2002-07-18 07:32:00 +02:00
|
|
|
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 ;
|
|
|
|
}
|
|
|
|
|
2002-07-13 22:37:40 +02:00
|
|
|
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 LinkSharedOSLibs).
|
|
|
|
# <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.
|
2002-09-17 00:21:37 +02:00
|
|
|
if ! $(NO_TEST_DEBUG) {
|
|
|
|
local optim = $(OPTIM) ;
|
|
|
|
OPTIM = ;
|
|
|
|
}
|
2002-07-13 22:37:40 +02:00
|
|
|
|
2002-10-23 21:23:01 +02:00
|
|
|
SetupIncludes ;
|
2002-07-13 22:37:40 +02:00
|
|
|
SetupObjectsDir ;
|
|
|
|
MakeLocateObjects $(sources) ;
|
|
|
|
Main $(target) : $(sources) ;
|
|
|
|
MakeLocate $(target) : [ FDirName $(OBOS_TEST_DIR) $(relPath) ] ;
|
2002-07-17 01:25:46 +02:00
|
|
|
Depends obostests : $(target) ;
|
2002-07-13 22:37:40 +02:00
|
|
|
LinkSharedOSLibs $(target) : $(libraries) ;
|
2003-09-11 22:48:05 +02:00
|
|
|
ObjectsDefines $(sources) : TEST_OBOS ;
|
2002-09-17 00:21:37 +02:00
|
|
|
if ! $(NO_TEST_DEBUG) {
|
|
|
|
# Turn debugging on. That is usually desired for test code.
|
2005-03-04 00:15:44 +01:00
|
|
|
ObjectCcFlags $(sources) : $(DEBUG_FLAGS) ;
|
|
|
|
ObjectC++Flags $(sources) : $(DEBUG_FLAGS) ;
|
2002-07-13 22:37:40 +02:00
|
|
|
|
2002-09-17 00:21:37 +02:00
|
|
|
# Turn optimization on again.
|
|
|
|
OPTIM = $(optim) ;
|
|
|
|
}
|
2002-07-13 22:37:40 +02:00
|
|
|
}
|
|
|
|
|
2002-07-09 14:24:59 +02:00
|
|
|
rule Addon
|
|
|
|
{
|
2003-02-24 01:35:09 +01:00
|
|
|
# Addon <name> : <relpath> : <sources> : <is executable> : <libraries> ;
|
2002-09-27 00:31:53 +02:00
|
|
|
# <name>: Name of the add-on.
|
|
|
|
# <relpath>: Path where the add-on shall live relative to the add-on dir.
|
|
|
|
# <sources>: Source files.
|
2003-02-24 01:35:09 +01:00
|
|
|
# <is executable>: true, if the target shall be executable as well.
|
|
|
|
# <libraries>: Libraries to be linked against.
|
2002-09-27 00:31:53 +02:00
|
|
|
|
|
|
|
local isExecutable = $(4) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
|
2002-10-23 21:23:01 +02:00
|
|
|
SetupIncludes ;
|
2002-07-09 14:24:59 +02:00
|
|
|
SetupObjectsDir ;
|
|
|
|
Main $(1) : $(3) ;
|
|
|
|
|
|
|
|
# Create output dir path for addon
|
|
|
|
local targetdir;
|
|
|
|
targetdir = [ FDirName $(OBOS_ADDON_DIR) $(2) ] ;
|
|
|
|
|
|
|
|
MakeLocate $(1) : $(targetdir) ;
|
2002-09-27 00:31:53 +02:00
|
|
|
|
|
|
|
local linkFlags = -Xlinker -soname=\"$(1)\" ;
|
|
|
|
if $(isExecutable) != true {
|
|
|
|
linkFlags = -nostart $(linkFlags) ;
|
|
|
|
}
|
|
|
|
LINKFLAGS on $(1) = [ on $(1) return $(LINKFLAGS) ] $(linkFlags) ;
|
2003-02-24 01:35:09 +01:00
|
|
|
LinkSharedOSLibs $(1) : $(5) ;
|
2002-07-14 18:38:21 +02:00
|
|
|
}
|
|
|
|
|
2002-07-14 19:31:49 +02:00
|
|
|
rule R5KernelAddon
|
2002-07-14 18:38:21 +02:00
|
|
|
{
|
2004-06-07 15:55:34 +02:00
|
|
|
# R5KernelAddon <name> : <relpath> : <sources> : <static-libraries> ;
|
2002-07-14 18:38:21 +02:00
|
|
|
|
|
|
|
local sources = $(3) ;
|
|
|
|
|
|
|
|
Addon $(1) : $(2) : $(3) ;
|
2005-03-05 15:11:02 +01:00
|
|
|
ObjectCcFlags $(sources) : -D_KERNEL_MODE=1 -fno-pic ;
|
|
|
|
ObjectC++Flags $(sources) : -D_KERNEL_MODE=1 -fno-pic -fno-exceptions ;
|
2002-07-17 01:25:46 +02:00
|
|
|
LINKFLAGS on $(1) = [ on $(1) return $(LINKFLAGS) ] -nostdlib ;
|
2004-06-07 15:55:34 +02:00
|
|
|
LinkSharedOSLibs $(1) : $(4) /boot/develop/lib/x86/_KERNEL_ ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
2002-08-06 02:48:49 +02:00
|
|
|
rule Translator
|
|
|
|
{
|
2003-07-16 22:56:37 +02:00
|
|
|
# Translator <name> : <sources> : <libraries> ;
|
2002-10-23 21:23:01 +02:00
|
|
|
SetupIncludes ;
|
2002-08-06 02:48:49 +02:00
|
|
|
SetupObjectsDir ;
|
|
|
|
Main $(1) : $(2) ;
|
2003-07-16 22:56:37 +02:00
|
|
|
LinkSharedOSLibs $(1) : $(3) ;
|
2002-08-06 02:48:49 +02:00
|
|
|
|
|
|
|
# Create output dir path for translator
|
|
|
|
local targetdir;
|
2003-08-16 03:00:08 +02:00
|
|
|
targetdir = [ FDirName $(OBOS_ADDON_DIR) Translators ] ;
|
2002-08-06 02:48:49 +02:00
|
|
|
MakeLocate $(1) : $(targetdir) ;
|
|
|
|
}
|
|
|
|
|
2004-12-11 22:58:09 +01:00
|
|
|
rule ScreenSaver
|
|
|
|
{
|
|
|
|
# ScreenSaver <name> : <sources> : <libraries> ;
|
|
|
|
Addon $(1) : screen_savers : $(2) : false : $(3) ;
|
|
|
|
}
|
|
|
|
|
2002-11-04 19:52:21 +01:00
|
|
|
rule MakeLocateObjects
|
2002-07-09 14:24:59 +02:00
|
|
|
{
|
2002-10-12 17:15:38 +02:00
|
|
|
# MakeLocateObjects <sources_or_objects> ;
|
2002-07-09 14:24:59 +02:00
|
|
|
|
2002-10-12 17:15:38 +02:00
|
|
|
local _objs = [ FGristFiles $(1:S=$(SUFOBJ)) ] ;
|
2002-07-09 14:24:59 +02:00
|
|
|
|
|
|
|
for o in $(_objs)
|
|
|
|
{
|
|
|
|
local dir = $(o:D) ;
|
|
|
|
if $(dir) {
|
|
|
|
MakeLocate $(o) : [ FDirName $(LOCATE_TARGET) $(dir) ] ;
|
|
|
|
} else {
|
|
|
|
MakeLocate $(o) : $(LOCATE_TARGET) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rule StaticLibrary
|
|
|
|
{
|
2005-06-14 17:22:55 +02:00
|
|
|
# StaticLibrary <name> : <sources> [ : <target dir> [ : <static libraries> ] ] ;
|
2003-09-11 22:04:13 +02:00
|
|
|
# Creates a static library from sources.
|
|
|
|
# <name>: Basename of the library, without leading "lib" and trailing ".a".
|
2003-10-30 21:43:32 +01:00
|
|
|
# Grist is allowed -- it will be re-prepended after constructing
|
|
|
|
# the complete library name.
|
2003-09-11 22:04:13 +02:00
|
|
|
# <source>: List of source files.
|
|
|
|
# <target dir>: Directory into which the library shall be placed. Defaults
|
2003-10-30 21:43:32 +01:00
|
|
|
# to the objects directory for this subdir. If
|
|
|
|
# STATIC_LIBRARY_DIR is supplied (the literal string)
|
|
|
|
# the standard directory for static libs is used, otherwise
|
|
|
|
# the parameter is interpreted as directory path.
|
2005-06-14 17:22:55 +02:00
|
|
|
# <static libraries>: static libraries to include (ie: libmesa_x86.a)
|
|
|
|
|
2003-10-30 21:43:32 +01:00
|
|
|
local lib = lib$(1:B)$(SUFLIB) ;
|
|
|
|
lib = $(lib:G=$(1:G)) ;
|
2002-10-23 21:23:01 +02:00
|
|
|
SetupIncludes ;
|
2002-07-09 14:24:59 +02:00
|
|
|
SetupObjectsDir ;
|
|
|
|
MakeLocateObjects $(2) ;
|
2005-06-17 13:41:18 +02:00
|
|
|
StaticLibraryFromObjects $(lib) : [ FGristFiles $(2:S=$(SUFOBJ)) ] ;
|
|
|
|
Objects $(2) ;
|
2005-06-14 17:22:55 +02:00
|
|
|
if $(4) {
|
2005-06-17 13:41:18 +02:00
|
|
|
StaticLibraryFromObjects $(lib) : $(4) ;
|
2005-06-14 17:22:55 +02:00
|
|
|
}
|
2003-09-11 22:04:13 +02:00
|
|
|
local targetDir = $(3) ;
|
2003-10-30 21:43:32 +01:00
|
|
|
if $(targetDir) {
|
|
|
|
if $(targetDir) = STATIC_LIBRARY_DIR {
|
|
|
|
targetDir = $(OBOS_STLIB_DIR) ;
|
|
|
|
}
|
|
|
|
MakeLocate $(lib) : $(targetDir) ;
|
|
|
|
} else {
|
|
|
|
# nothing to do, since the Library rule already located the library
|
|
|
|
# in $(LOCATE_TARGET)
|
2003-09-11 22:04:13 +02:00
|
|
|
}
|
2003-09-04 21:12:09 +02:00
|
|
|
|
|
|
|
# If KEEPOBJS is set, Library doesn't make the library depend on
|
|
|
|
# `lib'.
|
|
|
|
if $(KEEPOBJS) {
|
|
|
|
LocalDepends lib : $(lib) ;
|
|
|
|
}
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
2005-06-17 13:41:18 +02:00
|
|
|
rule StaticLibraryFromObjects
|
|
|
|
{
|
|
|
|
local _i _l _s ;
|
|
|
|
|
|
|
|
# Add grist to file names
|
|
|
|
|
|
|
|
_s = $(>) ;
|
|
|
|
_l = $(<:S=$(SUFLIB)) ;
|
|
|
|
|
|
|
|
# library depends on its member objects
|
|
|
|
|
|
|
|
if $(KEEPOBJS)
|
|
|
|
{
|
|
|
|
LocalDepends obj : $(_s) ;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
MakeLocate $(_l) $(_l)($(_s:BS)) : $(LOCATE_TARGET) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
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) ;
|
|
|
|
|
|
|
|
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 ! ( $(NOARSCAN) || $(NOARUPDATE) ) { RmTemps $(_l) : $(_s) ; }
|
|
|
|
}
|
|
|
|
|
2003-05-17 17:51:28 +02:00
|
|
|
rule R5KernelStaticLibrary
|
|
|
|
{
|
|
|
|
# R5KernelStaticLibrary <name> : <sources> ;
|
|
|
|
|
2003-09-04 21:12:09 +02:00
|
|
|
local lib = lib$(1)$(SUFLIB) ;
|
2003-05-17 17:51:28 +02:00
|
|
|
local sources = $(2) ;
|
|
|
|
|
|
|
|
SetupIncludes ;
|
|
|
|
SetupObjectsDir ;
|
|
|
|
MakeLocateObjects $(sources) ;
|
|
|
|
Library $(lib) : $(sources) ;
|
2005-03-05 15:11:02 +01:00
|
|
|
ObjectCcFlags $(sources) : -D_KERNEL_MODE=1 -fno-pic ;
|
|
|
|
ObjectC++Flags $(sources) : -D_KERNEL_MODE=1 -fno-pic -fno-exceptions ;
|
2003-05-17 17:51:28 +02:00
|
|
|
}
|
|
|
|
|
2002-11-04 19:52:21 +01:00
|
|
|
rule MergeObjectFromObjects
|
|
|
|
{
|
2003-11-02 23:41:27 +01:00
|
|
|
# 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.
|
|
|
|
#
|
2003-05-20 01:07:08 +02:00
|
|
|
local objects = [ FGristFiles $(2) ] ;
|
2002-11-04 19:52:21 +01:00
|
|
|
MakeLocate $(1) : $(LOCATE_TARGET) ;
|
2003-05-20 01:07:08 +02:00
|
|
|
Depends $(1) : $(objects) ;
|
2003-11-02 23:41:27 +01:00
|
|
|
Depends $(1) : $(3) ;
|
2005-06-26 23:52:51 +02:00
|
|
|
LocalDepends obj : $(1) ;
|
2002-11-04 19:52:21 +01:00
|
|
|
LINK on $(1) = ld ;
|
2003-11-02 23:41:27 +01:00
|
|
|
MergeObjectFromObjects1 $(1) : $(objects) $(3) ;
|
2002-11-04 19:52:21 +01:00
|
|
|
}
|
|
|
|
|
2002-11-18 02:21:30 +01:00
|
|
|
actions MergeObjectFromObjects1
|
2002-11-04 19:52:21 +01:00
|
|
|
{
|
|
|
|
$(LINK) -r $(2) -o $(1) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule MergeObject
|
|
|
|
{
|
2003-11-02 23:41:27 +01:00
|
|
|
# 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.
|
|
|
|
#
|
2002-11-04 19:52:21 +01:00
|
|
|
SetupIncludes ;
|
|
|
|
SetupObjectsDir ;
|
|
|
|
MakeLocateObjects $(2) ;
|
|
|
|
Objects $(2) ;
|
2003-11-02 23:41:27 +01:00
|
|
|
MergeObjectFromObjects $(1) : $(2:S=$(SUFOBJ)) : $(3) ;
|
2002-11-04 19:52:21 +01:00
|
|
|
}
|
|
|
|
|
2002-10-12 17:15:38 +02:00
|
|
|
rule SharedLibraryFromObjects
|
|
|
|
{
|
2003-02-17 18:08:34 +01:00
|
|
|
# SharedLibraryFromObjects <name> : <objects> : <libraries> ;
|
2003-10-30 21:43:32 +01:00
|
|
|
local _lib = lib$(1:B).so ;
|
|
|
|
_lib = $(_lib:G=$(1:G)) ;
|
2002-10-12 17:15:38 +02:00
|
|
|
MainFromObjects $(_lib) : $(2) ;
|
|
|
|
MakeLocate $(_lib) : $(OBOS_SHLIB_DIR) ;
|
|
|
|
LINKFLAGS on $(_lib) = [ on $(_lib) return $(LINKFLAGS) ]
|
|
|
|
-nostart -Xlinker -soname=\"$(_lib)\" ;
|
2003-02-17 18:08:34 +01:00
|
|
|
LinkSharedOSLibs $(_lib) : $(3) ;
|
2002-10-12 17:15:38 +02:00
|
|
|
}
|
|
|
|
|
2002-07-09 14:24:59 +02:00
|
|
|
rule SharedLibrary
|
|
|
|
{
|
2003-02-17 18:08:34 +01:00
|
|
|
# SharedLibrary <name> : <sources> : <libraries> ;
|
2002-10-23 21:23:01 +02:00
|
|
|
SetupIncludes ;
|
2002-07-09 14:24:59 +02:00
|
|
|
SetupObjectsDir ;
|
|
|
|
MakeLocateObjects $(2) ;
|
2002-10-12 17:15:38 +02:00
|
|
|
Objects $(2) ;
|
2003-02-17 18:08:34 +01:00
|
|
|
SharedLibraryFromObjects $(1) : $(2:S=$(SUFOBJ)) : $(3) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
rule LinkSharedOSLibs
|
|
|
|
{
|
|
|
|
# LinkSharedOSLibs <name> : <libs> ;
|
|
|
|
# Valid elements for <libs> are e.g. "be" or "libopenbeos.so" or
|
2002-07-10 17:11:24 +02:00
|
|
|
# "/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
|
2003-07-13 17:23:45 +02:00
|
|
|
# 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.
|
2002-07-09 14:24:59 +02:00
|
|
|
|
|
|
|
for i in $(>)
|
|
|
|
{
|
2002-07-10 17:11:24 +02:00
|
|
|
local isfile = ;
|
|
|
|
if $(i:D) || $(i:G) {
|
|
|
|
isfile = true ;
|
2003-07-13 17:23:45 +02:00
|
|
|
if $(i:G) = <nogrist> {
|
|
|
|
i = $(i:G=) ;
|
|
|
|
}
|
2002-07-10 17:11:24 +02:00
|
|
|
} else {
|
|
|
|
switch $(i:B)
|
|
|
|
{
|
2003-07-16 22:56:37 +02:00
|
|
|
# XXX: _APP_ and _KERNEL_ should not be needed for ELF.
|
2003-01-14 22:44:58 +01:00
|
|
|
case _APP_ : isfile = true ;
|
|
|
|
case _KERNEL_ : isfile = true ;
|
2002-07-10 17:11:24 +02:00
|
|
|
case lib* : isfile = true ;
|
2003-01-14 22:44:58 +01:00
|
|
|
case * : isfile = ;
|
2002-07-10 17:11:24 +02:00
|
|
|
}
|
2003-09-15 21:58:57 +02:00
|
|
|
if ! $(isfile) && ( $(i:S) = .so || $(i:S) = .a ) {
|
|
|
|
isfile = true ;
|
|
|
|
}
|
2002-07-10 17:11:24 +02:00
|
|
|
}
|
|
|
|
if $(isfile) {
|
2002-07-17 01:25:46 +02:00
|
|
|
NEEDLIBS on $(1) = [ on $(1) return $(NEEDLIBS) ] $(i) ;
|
2005-07-06 12:03:42 +02:00
|
|
|
if ! $(NO_LIBRARY_DEPENDENCIES) {
|
|
|
|
Depends $(1) : $(i) ;
|
|
|
|
}
|
2002-07-10 17:11:24 +02:00
|
|
|
} else {
|
2002-07-17 01:25:46 +02:00
|
|
|
LINKLIBS on $(1) = [ on $(1) return $(LINKLIBS) ] -l$(i) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rule AddResources
|
|
|
|
{
|
|
|
|
# AddResources <name> : <resourcefiles> ;
|
|
|
|
|
2003-02-17 18:08:34 +01:00
|
|
|
local resfiles = [ FGristFiles $(2) ] ;
|
|
|
|
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) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-03-04 00:15:44 +01:00
|
|
|
if $(OS) = BEOS {
|
|
|
|
|
2003-02-17 18:08:34 +01:00
|
|
|
rule ResComp
|
|
|
|
{
|
|
|
|
# ResComp <resource file> : <rdef file> ;
|
|
|
|
#
|
|
|
|
# <resource file> and <rdef file> must be gristed.
|
|
|
|
|
|
|
|
SetupObjectsDir ;
|
|
|
|
|
2002-07-13 22:37:40 +02:00
|
|
|
SEARCH on $(2) += $(SEARCH_SOURCE) ;
|
2003-02-17 18:08:34 +01:00
|
|
|
MakeLocate $(1) : $(LOCATE_TARGET) ;
|
|
|
|
Depends $(1) : $(2) rc ;
|
|
|
|
LocalClean clean : $(1) ;
|
|
|
|
ResComp1 $(1) : rc $(2) ;
|
|
|
|
}
|
|
|
|
|
2005-03-04 00:15:44 +01:00
|
|
|
} else {
|
|
|
|
|
|
|
|
rule ResComp
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2003-02-17 18:08:34 +01:00
|
|
|
actions ResComp1
|
|
|
|
{
|
2003-02-17 18:15:14 +01:00
|
|
|
$(2[1]) -o $(1) $(2[2-])
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
2003-09-11 22:48:05 +02:00
|
|
|
rule ObjectsDefines
|
|
|
|
{
|
|
|
|
# Like ObjectDefines, but allows multiple files to be supplied
|
|
|
|
local file ;
|
|
|
|
for file in $(1) {
|
|
|
|
ObjectDefines $(file) : $(2) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-12-09 13:43:02 +01:00
|
|
|
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) ;
|
|
|
|
|
2003-09-11 22:48:05 +02:00
|
|
|
local file ;
|
2002-12-09 13:43:02 +01:00
|
|
|
if $(objects) {
|
2003-09-11 22:48:05 +02:00
|
|
|
for file in $(objects) {
|
|
|
|
ObjectHdrs $(file) : $(headers) ;
|
2004-10-29 03:27:11 +02:00
|
|
|
# also reformat the assembler headers
|
|
|
|
ASHDRS on $(file) = [ FIncludes $(SEARCH_SOURCE) $(SUBDIRHDRS)
|
|
|
|
[ on $(file) return $(HDRS) ] ] ;
|
2003-09-11 22:48:05 +02:00
|
|
|
}
|
2002-12-09 13:43:02 +01:00
|
|
|
} else {
|
2004-11-19 16:42:06 +01:00
|
|
|
for file in $(sources:S=$(SUFOBJ)) {
|
2003-09-11 22:48:05 +02:00
|
|
|
ObjectHdrs $(file) : $(headers) ;
|
2004-10-29 03:27:11 +02:00
|
|
|
# also reformat the assembler headers
|
|
|
|
ASHDRS on $(file) = [ FIncludes $(SEARCH_SOURCE) $(SUBDIRHDRS)
|
|
|
|
[ on $(file) return $(HDRS) ] ] ;
|
2003-09-11 22:48:05 +02:00
|
|
|
}
|
2002-12-09 13:43:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
# 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) ;
|
|
|
|
}
|
|
|
|
|
2002-07-10 18:35:13 +02:00
|
|
|
rule PublicHeaders
|
2002-07-09 14:24:59 +02:00
|
|
|
{
|
2002-07-10 18:35:13 +02:00
|
|
|
# PublicHeaders <group list>
|
2002-07-09 14:24:59 +02:00
|
|
|
#
|
2002-07-10 18:35:13 +02:00
|
|
|
# Returns the directory names for the public header dirs identified by
|
|
|
|
# <group list>.
|
2002-07-09 14:24:59 +02:00
|
|
|
|
|
|
|
local list = $(1) ;
|
2002-09-23 01:54:06 +02:00
|
|
|
local dirs = [ FDirName $(OBOS_TOP) headers os ] ;
|
|
|
|
|
2002-07-10 18:35:13 +02:00
|
|
|
for i in $(list) {
|
|
|
|
dirs += [ FDirName $(OBOS_TOP) headers os $(i) ] ;
|
|
|
|
}
|
|
|
|
return $(dirs) ;
|
|
|
|
}
|
2002-07-09 14:24:59 +02:00
|
|
|
|
2002-07-10 18:35:13 +02:00
|
|
|
rule PrivateHeaders
|
|
|
|
{
|
|
|
|
# PrivateHeaders <group list>
|
|
|
|
#
|
|
|
|
# Returns the directory names for the private header dirs identified by
|
|
|
|
# <group list>.
|
2002-07-09 14:24:59 +02:00
|
|
|
|
2002-07-10 18:35:13 +02:00
|
|
|
local list = $(1) ;
|
|
|
|
local dirs ;
|
2002-07-09 14:24:59 +02:00
|
|
|
for i in $(list) {
|
2002-07-10 18:35:13 +02:00
|
|
|
dirs += [ FDirName $(OBOS_TOP) headers private $(i) ] ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
2002-07-10 18:35:13 +02:00
|
|
|
return $(dirs) ;
|
|
|
|
}
|
|
|
|
|
2003-03-30 01:17:50 +01:00
|
|
|
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 $(OBOS_TOP) headers libs $(i) ] ;
|
|
|
|
}
|
|
|
|
return $(dirs) ;
|
|
|
|
}
|
|
|
|
|
2002-07-10 18:35:13 +02:00
|
|
|
rule ArchHeaders
|
|
|
|
{
|
|
|
|
# usage: ArchHeaders <arch> ;
|
|
|
|
#
|
|
|
|
# <arch> specifies the architecture (e.g. x86).
|
2002-07-09 14:24:59 +02:00
|
|
|
|
2002-07-10 18:35:13 +02:00
|
|
|
return [ FDirName $(OBOS_TOP) headers private kernel arch $(1) ] ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule UsePublicHeaders
|
|
|
|
{
|
2003-06-23 18:55:05 +02:00
|
|
|
# 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) ] ;
|
2002-07-10 18:35:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
rule UsePublicObjectHeaders
|
|
|
|
{
|
2002-12-09 13:43:02 +01:00
|
|
|
# UsePublicObjectHeaders <sources> : <group list> [ : <objects> ] ;
|
2002-07-10 18:35:13 +02:00
|
|
|
#
|
|
|
|
# Adds the public C header dirs given by <group list> to the header search
|
2002-12-09 13:43:02 +01:00
|
|
|
# dirs of either the object targets of <sources> or if supplied to
|
|
|
|
# <objects>. Also adjusts HDRSEARCH of <sources>.
|
2002-07-10 18:35:13 +02:00
|
|
|
# NOTE: This rule must be invoked *after* the rule that builds the objects.
|
|
|
|
|
2002-12-09 13:43:02 +01:00
|
|
|
SourceHdrs $(1) : [ PublicHeaders $(2) ] : $(3) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
rule UsePrivateHeaders
|
|
|
|
{
|
2002-07-10 18:35:13 +02:00
|
|
|
# UsePrivateHeaders <group list> ;
|
2002-07-09 14:24:59 +02:00
|
|
|
#
|
|
|
|
# Adds the private C header dirs given by <group list> to the header search
|
2002-07-10 18:35:13 +02:00
|
|
|
# dirs of the subdirectory.
|
|
|
|
# NOTE: This rule must be invoked *before* the rule that builds the objects.
|
2002-07-09 14:24:59 +02:00
|
|
|
|
2002-07-10 18:35:13 +02:00
|
|
|
UseHeaders [ PrivateHeaders $(1) ] ;
|
|
|
|
}
|
2002-07-09 14:24:59 +02:00
|
|
|
|
2002-07-10 18:35:13 +02:00
|
|
|
rule UsePrivateObjectHeaders
|
|
|
|
{
|
2002-12-09 13:43:02 +01:00
|
|
|
# UsePrivateObjectHeaders <sources> : <group list> [ : <objects> ] ;
|
2002-07-10 18:35:13 +02:00
|
|
|
#
|
|
|
|
# Adds the private C header dirs given by <group list> to the header search
|
2002-12-09 13:43:02 +01:00
|
|
|
# dirs of either the object targets of <sources> or if supplied to
|
|
|
|
# <objects>. Also adjusts HDRSEARCH of <sources>.
|
2002-07-10 18:35:13 +02:00
|
|
|
# NOTE: This rule must be invoked *after* the rule that builds the objects.
|
2002-07-09 14:24:59 +02:00
|
|
|
|
2002-12-09 13:43:02 +01:00
|
|
|
SourceHdrs $(1) : [ PrivateHeaders $(2) ] : $(3) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
rule UseHeaders
|
|
|
|
{
|
2002-07-10 18:35:13 +02:00
|
|
|
# UseHeaders <headers> ;
|
2002-07-09 14:24:59 +02:00
|
|
|
#
|
|
|
|
# Adds the C header dirs <headers> to the header search
|
2002-07-10 18:35:13 +02:00
|
|
|
# dirs of the subdirectory.
|
|
|
|
# NOTE: This rule must be invoked *before* the rule that builds the objects.
|
|
|
|
|
|
|
|
local header ;
|
|
|
|
for header in $(1) {
|
|
|
|
SubDirHdrs $(header) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rule UseCppUnitHeaders
|
|
|
|
{
|
2002-07-10 18:35:13 +02:00
|
|
|
SubDirHdrs [ FDirName $(OBOS_TOP) headers tools cppunit ] ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
2002-08-03 18:11:42 +02:00
|
|
|
rule UseCppUnitObjectHeaders
|
|
|
|
{
|
2002-12-09 13:43:02 +01:00
|
|
|
# UseCppUnitObjectHeaders <sources> [ : <objects> ] ;
|
|
|
|
SourceHdrs $(1) : [ FDirName $(OBOS_TOP) headers tools cppunit ] : $(2) ;
|
2002-08-03 18:11:42 +02:00
|
|
|
}
|
|
|
|
|
2002-07-09 14:24:59 +02:00
|
|
|
rule UseArchHeaders
|
|
|
|
{
|
2002-07-10 18:35:13 +02:00
|
|
|
# usage: UseArchHeaders <arch> ;
|
|
|
|
#
|
2002-07-09 14:24:59 +02:00
|
|
|
# <arch> specifies the architecture (e.g. x86).
|
2002-07-10 18:35:13 +02:00
|
|
|
# NOTE: This rule must be invoked *before* the rule that builds the objects.
|
|
|
|
|
|
|
|
local headers = [ ArchHeaders $(1) ] ;
|
2002-07-09 14:24:59 +02:00
|
|
|
local opt = -D$(OBOS_TARGET_DEFINE) ;
|
2002-07-09 22:11:42 +02:00
|
|
|
|
2002-07-10 18:35:13 +02:00
|
|
|
SubDirCcFlags $(opt) ;
|
|
|
|
SubDirC++Flags $(opt) ;
|
2005-02-11 05:46:14 +01:00
|
|
|
UseHeaders $(headers) ;
|
2002-07-10 18:35:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
rule UseArchObjectHeaders
|
|
|
|
{
|
2002-12-09 13:43:02 +01:00
|
|
|
# usage: UseArchObjectHeaders <sources> : <arch> : [ <objects> ] ;
|
2002-07-10 18:35:13 +02:00
|
|
|
#
|
|
|
|
# <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.
|
|
|
|
|
2002-12-09 13:43:02 +01:00
|
|
|
local sources = $(1) ;
|
2002-07-10 18:35:13 +02:00
|
|
|
local headers = [ ArchHeaders $(2) ] ;
|
2002-12-09 13:43:02 +01:00
|
|
|
local objects = $(3) ;
|
|
|
|
local targets ;
|
|
|
|
if $(objects) {
|
|
|
|
targets = $(objects) ;
|
|
|
|
} else {
|
2004-11-19 16:42:06 +01:00
|
|
|
targets = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
|
2002-12-09 13:43:02 +01:00
|
|
|
}
|
2002-07-10 18:35:13 +02:00
|
|
|
local opt = -D$(OBOS_TARGET_DEFINE) ;
|
2002-07-09 22:11:42 +02:00
|
|
|
|
2002-07-10 18:35:13 +02:00
|
|
|
ObjectCcFlags $(targets) : $(opt) ;
|
|
|
|
ObjectC++Flags $(targets) : $(opt) ;
|
2002-12-09 13:43:02 +01:00
|
|
|
SourceHdrs $(sources) : $(headers) : $(objects) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
2002-07-11 13:58:30 +02:00
|
|
|
rule UsePosixHeaders
|
|
|
|
{
|
2002-10-23 21:23:01 +02:00
|
|
|
# XXX changed to do nothing
|
2002-07-11 13:58:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
rule UsePosixObjectHeaders
|
|
|
|
{
|
2002-12-09 13:43:02 +01:00
|
|
|
# UsePosixObjectHeaders <sources> [ : <objects> ] ;
|
2002-07-11 13:58:30 +02:00
|
|
|
#
|
|
|
|
# Adds the POSIX header dir to the header search
|
2002-12-09 13:43:02 +01:00
|
|
|
# dirs of either the object targets of <sources> or if supplied to
|
|
|
|
# <objects>. Also adjusts HDRSEARCH of <sources>.
|
2002-07-11 13:58:30 +02:00
|
|
|
# NOTE: This rule must be invoked *after* the rule that builds the objects.
|
|
|
|
|
2002-12-09 13:43:02 +01:00
|
|
|
SourceHdrs $(1) : [ FDirName $(OBOS_TOP) headers posix ] : $(2) ;
|
2002-07-11 13:58:30 +02:00
|
|
|
}
|
|
|
|
|
2003-03-30 01:17:50 +01:00
|
|
|
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) ] ;
|
|
|
|
}
|
|
|
|
|
2002-07-10 03:54:50 +02:00
|
|
|
rule SplitPath
|
|
|
|
{
|
|
|
|
# SplitPath <path> ;
|
|
|
|
# Decomposes a path into its components.
|
|
|
|
local path = $(1:G=) ;
|
|
|
|
local components ;
|
2002-07-15 11:05:25 +02:00
|
|
|
# $(path:D) for "/" is "/". Therefore the second condition.
|
|
|
|
while $(path:D) && $(path:D) != $(path)
|
2002-07-10 03:54:50 +02:00
|
|
|
{
|
|
|
|
# Note: $(path:B) returns "." for "..", but $(path:D=) is fine.
|
|
|
|
components = $(path:D=) $(components) ;
|
|
|
|
path = $(path:D) ;
|
|
|
|
}
|
|
|
|
components = $(path) $(components) ;
|
|
|
|
return $(components) ;
|
|
|
|
}
|
|
|
|
|
2002-07-13 22:37:40 +02:00
|
|
|
rule PrependObjectHdrs
|
|
|
|
{
|
|
|
|
# PrependObjectHdrs <objects_or_sources> : <dirs> ;
|
|
|
|
# Prepends <dirs> to the list of header search dirs of the objects
|
|
|
|
# specified by <objects_or_sources>. The HDRS variable will not be
|
|
|
|
# changed, only CCHDRS.
|
|
|
|
# Note: A subsequent ObjectHdrs invocation will therefore undo the
|
|
|
|
# effect of this rule.
|
|
|
|
# NOTE: This is a hack.
|
|
|
|
|
|
|
|
local objects = [ FGristFiles $(1:S=$(SUFOBJ)) ] ;
|
|
|
|
local dirs = $(2) ;
|
|
|
|
for object in $(objects) {
|
|
|
|
# Don't change HDRS to avoid screwing up the header scanning.
|
|
|
|
PREPENDED_HDRS on $(object)
|
|
|
|
= $(dirs) [ on $(object) return $(PREPENDED_HDRS) ] ;
|
|
|
|
CCHDRS on $(object)
|
|
|
|
= [ FIncludes [ on $(object) return $(PREPENDED_HDRS) $(HDRS) ] ] ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-10 03:54:50 +02:00
|
|
|
rule SymLink
|
|
|
|
{
|
2003-12-02 22:59:35 +01:00
|
|
|
# SymLink <target> : <source> : <makeDefaultDependencies> ;
|
2002-07-10 03:54:50 +02:00
|
|
|
# Links <target> to <source>.
|
|
|
|
# <source> is the exact link contents. No binding is done.
|
2003-12-02 22:59:35 +01:00
|
|
|
# <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) ;
|
|
|
|
}
|
2002-07-10 03:54:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
actions SymLink1
|
|
|
|
{
|
2002-07-12 20:46:53 +02:00
|
|
|
$(RM) "$(1)" && $(LN) -s "$(LINKCONTENTS)" "$(1)"
|
|
|
|
}
|
|
|
|
|
|
|
|
rule RelSymLink
|
|
|
|
{
|
2003-12-02 22:59:35 +01:00
|
|
|
# RelSymLink <link> : <link target> : <makeDefaultDependencies> ;
|
2002-07-12 20:46:53 +02:00
|
|
|
# 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.
|
2003-12-02 22:59:35 +01:00
|
|
|
# <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'.
|
2002-07-12 20:46:53 +02:00
|
|
|
|
|
|
|
local target = $(1) ;
|
|
|
|
local source = $(2) ;
|
2003-12-02 22:59:35 +01:00
|
|
|
local makeDefaultDependencies = $(3) ;
|
2002-07-12 20:46:53 +02:00
|
|
|
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 = [ SplitPath $(targetDir) ] ;
|
|
|
|
local sourceComponents = [ SplitPath $(sourcePath) ] ;
|
|
|
|
|
|
|
|
SymLink $(target)
|
2003-12-02 22:59:35 +01:00
|
|
|
: [ FRelPath $(targetDirComponents) : $(sourceComponents) ]
|
|
|
|
: $(makeDefaultDependencies) ;
|
2002-12-09 13:43:02 +01:00
|
|
|
NOUPDATE $(target) ;
|
2002-07-17 01:25:46 +02:00
|
|
|
Depends $(target) : $(source) ;
|
2002-07-10 03:54:50 +02:00
|
|
|
}
|
|
|
|
|
2002-11-15 00:09:18 +01:00
|
|
|
rule AbsSymLink
|
|
|
|
{
|
2003-12-02 22:59:35 +01:00
|
|
|
# AbsSymLink <link> : <link target> : <link dir>
|
|
|
|
# : <makeDefaultDependencies> ;
|
2002-11-15 00:09:18 +01:00
|
|
|
# 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>.
|
2003-12-02 22:59:35 +01:00
|
|
|
# <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 ;
|
|
|
|
}
|
2002-11-15 00:09:18 +01:00
|
|
|
|
|
|
|
Depends $(1) : $(2) ;
|
|
|
|
if $(3) {
|
|
|
|
MakeLocate $(1) : $(3) ;
|
|
|
|
}
|
|
|
|
SEARCH on $(2) += $(SEARCH_SOURCE) ;
|
2003-12-02 22:59:35 +01:00
|
|
|
if $(makeDefaultDependencies) = true {
|
|
|
|
LocalDepends files : $(1) ;
|
|
|
|
LocalClean clean : $(1) ;
|
|
|
|
}
|
2002-11-15 00:09:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
actions AbsSymLink
|
|
|
|
{
|
|
|
|
target="$(2)"
|
|
|
|
case "$target" in
|
|
|
|
/*) ;;
|
|
|
|
*) target=`pwd`/"$target";;
|
|
|
|
esac
|
|
|
|
$(RM) "$(1)" && $(LN) -s "$target" "$(1)"
|
|
|
|
}
|
|
|
|
|
2003-06-17 20:13:22 +02:00
|
|
|
rule OBOSInstall
|
|
|
|
{
|
|
|
|
# Usage: OBOSInstall <[ 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)) ;
|
|
|
|
|
2003-12-30 23:26:26 +01:00
|
|
|
NotFile $(install) ;
|
|
|
|
NotFile $(uninstall) ;
|
2003-06-17 20:13:22 +02:00
|
|
|
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) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-12-02 22:59:35 +01:00
|
|
|
rule InstallAbsSymLinkAdapter
|
|
|
|
{
|
|
|
|
# InstallAbsSymLinkAdapter <link> : <link target>
|
|
|
|
if ! [ on $(2) return $(TARGET) ] {
|
|
|
|
TARGET on $(2) = [ on $(2) return $(SEARCH) ] ;
|
|
|
|
}
|
|
|
|
AbsSymLink $(1) : $(2) : : false ;
|
|
|
|
}
|
|
|
|
|
2003-06-17 20:13:22 +02:00
|
|
|
rule OBOSInstallAbsSymLink
|
|
|
|
{
|
|
|
|
# Usage: OBOSInstallAbsSymLink <[ install [ and uninstall ] pseudotarget ]>
|
|
|
|
# : <directory> : <sources to install>
|
|
|
|
# : [ <installgrist> ] ;
|
2003-12-02 22:59:35 +01:00
|
|
|
OBOSInstall $(1) : $(2) : $(3) : $(4) : InstallAbsSymLinkAdapter ;
|
2003-06-17 20:13:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
rule InstallRelSymLinkAdapter
|
|
|
|
{
|
|
|
|
# InstallRelSymLinkAdapter <link> : <link target>
|
|
|
|
if ! [ on $(2) return $(TARGET) ] {
|
|
|
|
TARGET on $(2) = [ on $(2) return $(SEARCH) ] ;
|
|
|
|
}
|
2003-12-02 22:59:35 +01:00
|
|
|
RelSymLink $(1) : $(2) : false ;
|
2003-06-17 20:13:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
rule OBOSInstallRelSymLink
|
|
|
|
{
|
|
|
|
# Usage: OBOSInstallRelSymLink <[ install [ and uninstall ] pseudotarget ]>
|
|
|
|
# : <directory> : <sources to install>
|
|
|
|
# : [ <installgrist> ] ;
|
|
|
|
OBOSInstall $(1) : $(2) : $(3) : $(4) : InstallRelSymLinkAdapter ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-07-09 14:24:59 +02:00
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# Low-level OBOS utility rules
|
|
|
|
#-------------------------------------------------------------------------------
|
2004-06-16 00:13:34 +02:00
|
|
|
rule FObjectsDir
|
|
|
|
{
|
2004-08-28 22:03:01 +02:00
|
|
|
# FObjectsDir <subdir tokens>
|
|
|
|
#
|
|
|
|
# Returns the output directory for object files the specified
|
|
|
|
# subdirectory.
|
|
|
|
#
|
|
|
|
# <subdir tokens>: The tokens of the subdir relative to the top.
|
|
|
|
#
|
|
|
|
|
|
|
|
return [ FDirName $(OBOS_OBJECT_TARGET) $(1[2-]) ] ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule FCurrentObjectsDir
|
|
|
|
{
|
|
|
|
# FCurrentObjectsDir
|
2004-06-16 00:13:34 +02:00
|
|
|
#
|
|
|
|
# Returns the output directory for object files for the current
|
|
|
|
# subdirectory.
|
|
|
|
|
2004-08-28 22:03:01 +02:00
|
|
|
return [ FObjectsDir $(SUBDIR_TOKENS) ] ;
|
2004-06-16 00:13:34 +02:00
|
|
|
}
|
|
|
|
|
2002-07-09 14:24:59 +02:00
|
|
|
rule SetupObjectsDir
|
|
|
|
{
|
2004-08-28 22:03:01 +02:00
|
|
|
LOCATE_TARGET = [ FCurrentObjectsDir ] ;
|
2003-02-17 18:08:34 +01:00
|
|
|
LOCATE_SOURCE = $(LOCATE_TARGET) ;
|
|
|
|
SEARCH_SOURCE = [ Filter $(SEARCH_SOURCE) : $(LOCATE_TARGET) ]
|
|
|
|
$(LOCATE_TARGET) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# 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.
|
|
|
|
MODE on $(<) = $(EXEMODE) ;
|
|
|
|
on $(1) XRes $(1) : $(RESFILES) ;
|
|
|
|
Chmod $(<) ;
|
|
|
|
SetType $(1) ;
|
|
|
|
MimeSet $(1) ;
|
2002-09-30 23:16:18 +02:00
|
|
|
SetVersion $(1) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
actions Link bind NEEDLIBS
|
|
|
|
{
|
2002-07-12 23:16:33 +02:00
|
|
|
$(LINK) $(LINKFLAGS) -o "$(1)" $(UNDEFS) "$(2)" "$(NEEDLIBS)" $(LINKLIBS) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
2003-02-17 18:08:34 +01:00
|
|
|
rule LexC++
|
|
|
|
{
|
|
|
|
Depends $(1) : $(2) ;
|
|
|
|
MakeLocate $(1) : $(LOCATE_SOURCE) ;
|
|
|
|
LocalClean clean : $(1) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
actions LexC++
|
|
|
|
{
|
|
|
|
$(LEX) -o$(1) $(2)
|
|
|
|
}
|
|
|
|
|
|
|
|
rule Bison
|
|
|
|
{
|
|
|
|
local _h ;
|
|
|
|
|
2004-06-28 01:37:06 +02:00
|
|
|
_h = $(1:S=.hpp) ;
|
2003-02-17 18:08:34 +01:00
|
|
|
|
|
|
|
MakeLocate $(<) $(_h) : $(LOCATE_SOURCE) ;
|
|
|
|
|
2004-06-28 01:37:06 +02:00
|
|
|
Depends $(<) $(_h) : $(>) ;
|
|
|
|
Bison1 $(<) $(_h) : $(>) ;
|
|
|
|
LocalClean clean : $(<) $(_h) ;
|
2003-02-17 18:08:34 +01:00
|
|
|
|
|
|
|
# make sure someone includes $(_h) else it will be
|
|
|
|
# a deadly independent target
|
|
|
|
|
|
|
|
Includes $(<) : $(_h) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
actions Bison1
|
|
|
|
{
|
|
|
|
bison $(YACCFLAGS) -o $(1[1]) $(2)
|
2004-06-28 01:37:06 +02:00
|
|
|
[ -f $(1[1]).h ] && mv $(1[1]).h $(1[2]) || true
|
2003-02-17 18:08:34 +01:00
|
|
|
}
|
|
|
|
|
2004-07-05 20:34:35 +02:00
|
|
|
rule UnarchiveObjects
|
|
|
|
{
|
|
|
|
# UnarchiveObjects <target objects> : <static object>
|
|
|
|
|
|
|
|
MakeLocate $(1) : $(LOCATE_TARGET) ;
|
|
|
|
Depends $(2) : $(1) ;
|
|
|
|
SEARCH on $(2) = $(SEARCH_SOURCE) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
actions UnarchiveObjects
|
|
|
|
{
|
2004-08-02 20:31:08 +02:00
|
|
|
cd $(1[1]:D)
|
2005-01-26 03:07:39 +01:00
|
|
|
ar -x "$(2)" $(1:BS)
|
2004-07-05 20:34:35 +02:00
|
|
|
cd -
|
|
|
|
}
|
|
|
|
|
2002-07-09 14:24:59 +02:00
|
|
|
# BeOS specific rules
|
|
|
|
|
|
|
|
rule XRes
|
|
|
|
{
|
|
|
|
# XRes <target> : <resource files>
|
|
|
|
if $(2)
|
|
|
|
{
|
2002-07-17 01:25:46 +02:00
|
|
|
Depends $(1) : $(2) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
XRes1 $(1) : $(2) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rule XRes1 { }
|
|
|
|
|
|
|
|
rule SetVersion
|
|
|
|
{
|
|
|
|
# SetVersion <target>
|
|
|
|
}
|
|
|
|
|
|
|
|
rule SetType
|
|
|
|
{
|
|
|
|
# SetType <target>
|
|
|
|
}
|
|
|
|
|
|
|
|
rule MimeSet
|
|
|
|
{
|
|
|
|
# SetType <target>
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if $(OS) = BEOS
|
|
|
|
{
|
|
|
|
|
|
|
|
actions XRes1
|
|
|
|
{
|
2002-07-12 20:46:53 +02:00
|
|
|
xres -o "$(1)" "$(2)" ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
actions SetVersion
|
|
|
|
{
|
|
|
|
setversion "$(1)" -system $(OBOS_BUILD_VERSION) -short "$(OBOS_BUILD_DESCRIPTION)" ;
|
|
|
|
}
|
|
|
|
|
|
|
|
actions SetType
|
|
|
|
{
|
|
|
|
settype -t $(OBOS_TARGET_TYPE) "$(1)" ;
|
|
|
|
}
|
|
|
|
|
|
|
|
actions MimeSet
|
|
|
|
{
|
|
|
|
mimeset -f "$(1)" ;
|
|
|
|
}
|
|
|
|
|
|
|
|
} # if BEOS
|
|
|
|
|
|
|
|
|
|
|
|
rule assemble
|
|
|
|
{
|
2002-07-24 20:13:59 +02:00
|
|
|
Depends $(<) : $(>) ;
|
|
|
|
ASFLAGS on $(<) += $(ASFLAGS) $(SUBDIRASFLAGS) ;
|
|
|
|
ASHDRS on $(<) = [ FIncludes $(SEARCH_SOURCE) $(SUBDIRHDRS) $(HDRS) ] ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
actions assemble
|
|
|
|
{
|
2003-01-06 09:30:40 +01:00
|
|
|
$(CC) -c "$(2)" -O2 $(ASFLAGS) -D_ASSEMBLER $(KERNEL_CCFLAGS) $(ASHDRS) -o "$(1)" ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
2002-07-12 20:46:53 +02:00
|
|
|
# Overridden to allow spaces in file names.
|
|
|
|
actions Chmod1
|
|
|
|
{
|
|
|
|
$(CHMOD) "$(MODE)" "$(1)"
|
|
|
|
}
|
|
|
|
|
2002-09-29 16:59:51 +02:00
|
|
|
# Overridden to allow spaces in file names.
|
|
|
|
actions piecemeal together existing Clean
|
|
|
|
{
|
|
|
|
$(RM) "$(>)"
|
|
|
|
}
|
|
|
|
|
2002-07-13 18:50:16 +02:00
|
|
|
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) {
|
2002-07-17 01:25:46 +02:00
|
|
|
Depends $(ref) : $(source) ;
|
2002-10-12 17:15:38 +02:00
|
|
|
LOCATE on $(ref) = [ on $(source) return $(LOCATE) ] ;
|
2002-07-13 18:50:16 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-13 22:37:40 +02:00
|
|
|
rule Filter
|
|
|
|
{
|
|
|
|
# Filter <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) {
|
2002-11-15 21:22:35 +01:00
|
|
|
newList += $(item) ;
|
2002-07-13 22:37:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return $(newList) ;
|
|
|
|
}
|
|
|
|
|
2002-07-12 20:46:53 +02:00
|
|
|
|
2002-07-09 14:24:59 +02:00
|
|
|
## Kernel stuff!
|
|
|
|
|
|
|
|
rule SetupKernel
|
|
|
|
{
|
|
|
|
# Usage SetupKernel <sources_or_objects> : <extra_cc_flags>;
|
2004-11-18 16:59:02 +01:00
|
|
|
#
|
|
|
|
# <sources_or_objects> - Ideally sources, otherwise HDRSEARCH can not be
|
|
|
|
# set for the sources and the sources some header
|
|
|
|
# dependencies might be missing.
|
2002-07-09 14:24:59 +02:00
|
|
|
|
2004-11-18 16:59:02 +01:00
|
|
|
local sources = [ FGristFiles $(1) ] ;
|
|
|
|
local _objs = $(sources:S=$(SUFOBJ)) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
|
2002-10-26 22:23:12 +02:00
|
|
|
#Setup Kernel header directories
|
2004-06-07 15:35:31 +02:00
|
|
|
local public_kernel_includes = add-ons/file_system add-ons/graphics app device drivers kernel storage support ;
|
2004-10-29 03:27:11 +02:00
|
|
|
local private_kernel_includes = $(DOT) kernel libroot kernel/boot/platform/$(OBOS_BOOT_PLATFORM) ;
|
2002-10-23 21:23:01 +02:00
|
|
|
# Use posix headers directory
|
2004-10-29 03:27:11 +02:00
|
|
|
local headers = [ FDirName $(OBOS_TOP) headers posix ] ;
|
2002-10-23 21:23:01 +02:00
|
|
|
# Use public OS header directories
|
2004-10-29 03:27:11 +02:00
|
|
|
headers += [ PublicHeaders $(public_kernel_includes) ] ;
|
2002-10-30 03:13:21 +01:00
|
|
|
# Use private directories
|
2004-10-29 03:27:11 +02:00
|
|
|
headers += [ PrivateHeaders $(private_kernel_includes) ] ;
|
2003-05-06 00:07:33 +02:00
|
|
|
# The platform dependent headers.
|
2004-10-29 03:27:11 +02:00
|
|
|
headers += $(PLATFORM_HEADERS) ;
|
2002-10-23 21:23:01 +02:00
|
|
|
|
2004-11-18 16:59:02 +01:00
|
|
|
SourceHdrs $(sources) : $(headers) ;
|
|
|
|
UseArchObjectHeaders $(sources) : $(OBOS_ARCH) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
|
2004-10-29 03:27:11 +02:00
|
|
|
local object ;
|
|
|
|
for object in $(_objs) {
|
|
|
|
ObjectCcFlags $(object) : $(KERNEL_CCFLAGS) $(2) ;
|
|
|
|
ObjectC++Flags $(object) : $(KERNEL_C++FLAGS) $(2) ;
|
|
|
|
}
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
rule KernelObjects
|
|
|
|
{
|
2004-10-29 03:27:11 +02:00
|
|
|
SetupObjectsDir ;
|
2002-07-09 14:24:59 +02:00
|
|
|
|
|
|
|
Objects $(1) ;
|
2004-10-29 03:27:11 +02:00
|
|
|
|
|
|
|
SetupKernel $(1) : $(2) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
rule KernelLd
|
|
|
|
{
|
2002-11-04 19:52:21 +01:00
|
|
|
# KernelLd <name> : <objs> : <linkerscript> : <args> : <gcc_off> : <config_section> ;
|
2002-07-09 14:24:59 +02:00
|
|
|
|
2004-10-29 03:27:11 +02:00
|
|
|
SetupObjectsDir ;
|
2002-07-09 14:24:59 +02:00
|
|
|
LINK on $(1) = ld ;
|
|
|
|
|
|
|
|
LINKFLAGS on $(1) = $(4) ;
|
|
|
|
if $(3) { LINKFLAGS on $(1) += --script=$(3) ; }
|
|
|
|
|
|
|
|
# Remove any preset LINKLIBS
|
|
|
|
LINKLIBS on $(1) = ;
|
|
|
|
|
|
|
|
# Show that we depend on the libraries we need
|
2002-07-17 01:25:46 +02:00
|
|
|
LocalClean clean : $(1) ;
|
|
|
|
LocalDepends all : $(1) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
Depends $(1) : $(2) ;
|
|
|
|
|
|
|
|
if $(6) {
|
|
|
|
for i in $(6) {
|
2002-07-13 00:53:42 +02:00
|
|
|
KernelConfigSection $(i) : elf32 : $(1) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
MakeLocate $(1) : $(LOCATE_TARGET) ;
|
|
|
|
|
2003-05-06 00:07:33 +02:00
|
|
|
# Add the platform specific static libs (libgcc.a).
|
2002-07-09 14:24:59 +02:00
|
|
|
if ! $(5) {
|
2003-05-06 00:07:33 +02:00
|
|
|
LINKLIBS on $(1) += $(PLATFORM_LINKLIBS) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
2004-10-29 03:27:11 +02:00
|
|
|
|
|
|
|
SetupKernel $(2) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
actions KernelLd
|
|
|
|
{
|
2002-07-12 23:16:33 +02:00
|
|
|
$(LINK) $(LINKFLAGS) -o "$(1)" "$(2)" $(LINKLIBS) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
2004-05-20 01:59:41 +02:00
|
|
|
rule KernelAddon
|
|
|
|
{
|
2004-06-07 15:55:34 +02:00
|
|
|
# KernelAddon <name> : <relpath> : <sources> : <static-libraries> ;
|
2004-05-20 01:59:41 +02:00
|
|
|
|
|
|
|
local sources = $(3) ;
|
|
|
|
|
2004-10-29 03:27:11 +02:00
|
|
|
SetupObjectsDir ;
|
2004-11-18 16:59:02 +01:00
|
|
|
Addon $(1) : $(2) : $(sources) ;
|
2005-03-05 15:11:02 +01:00
|
|
|
ObjectCcFlags $(sources) : -D_KERNEL_MODE=1 -fno-pic ;
|
|
|
|
ObjectC++Flags $(sources) : -D_KERNEL_MODE=1 -fno-pic -fno-exceptions ;
|
2004-05-20 01:59:41 +02:00
|
|
|
LINKFLAGS on $(1) = [ on $(1) return $(LINKFLAGS) ] -nostdlib ;
|
2005-01-15 22:32:51 +01:00
|
|
|
LinkSharedOSLibs $(1) : $(4) <nogrist>kernel.so ;
|
2004-11-18 16:59:02 +01:00
|
|
|
SetupKernel $(sources) ;
|
2004-05-20 01:59:41 +02:00
|
|
|
}
|
|
|
|
|
2002-11-04 19:52:21 +01:00
|
|
|
rule KernelMergeObject
|
|
|
|
{
|
2003-11-02 23:41:27 +01:00
|
|
|
# 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.
|
|
|
|
#
|
2002-11-04 19:52:21 +01:00
|
|
|
|
2004-10-29 03:27:11 +02:00
|
|
|
SetupObjectsDir ;
|
2002-11-04 19:52:21 +01:00
|
|
|
|
|
|
|
MakeLocateObjects $(2) ;
|
|
|
|
Objects $(2) ;
|
2003-11-02 23:41:27 +01:00
|
|
|
MergeObjectFromObjects $(1) : $(2:S=$(SUFOBJ)) : $(4) ;
|
2004-10-29 03:27:11 +02:00
|
|
|
|
|
|
|
SetupKernel $(2) : $(3) ;
|
2002-11-04 19:52:21 +01:00
|
|
|
}
|
|
|
|
|
2002-07-09 14:24:59 +02:00
|
|
|
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
|
|
|
|
|
2004-10-29 03:27:11 +02:00
|
|
|
SetupObjectsDir ;
|
2002-07-09 14:24:59 +02:00
|
|
|
|
|
|
|
MakeLocateObjects $(2) ;
|
|
|
|
Library $(1) : $(2) ;
|
2004-10-29 03:27:11 +02:00
|
|
|
|
|
|
|
SetupKernel $(2) : $(3) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
rule KernelStaticLibraryObjects
|
|
|
|
{
|
|
|
|
# Usage KernelStaticLibrary <name> : <sources> ;
|
|
|
|
# This is designed to take a set of sources and libraries and create
|
|
|
|
# a file called <name>
|
|
|
|
|
2004-10-29 03:27:11 +02:00
|
|
|
SetupObjectsDir ;
|
2002-07-09 14:24:59 +02:00
|
|
|
|
|
|
|
# Show that we depend on the libraries we need
|
2002-07-17 01:25:46 +02:00
|
|
|
LocalClean clean : $(1) ;
|
|
|
|
LocalDepends all : $(1) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
Depends $(1) : $(2) ;
|
|
|
|
|
|
|
|
MakeLocate $(1) : $(LOCATE_TARGET) ;
|
2004-10-29 03:27:11 +02:00
|
|
|
|
|
|
|
SetupKernel $(2) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
actions KernelStaticLibraryObjects
|
|
|
|
{
|
2002-07-12 20:46:53 +02:00
|
|
|
ar -r "$(1)" "$(2)" ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
2003-05-11 19:28:24 +02:00
|
|
|
rule BuildPlatformMain
|
2002-07-09 14:24:59 +02:00
|
|
|
{
|
2005-03-03 01:38:19 +01:00
|
|
|
# Usage BuildPlatformMain <target> : <sources> [ : <resetIncludes> ] ;
|
|
|
|
# <target> The executable.
|
|
|
|
# <sources> The sources.
|
|
|
|
# <resetIncludes> "false", if header search dirs shall not be reset to the
|
|
|
|
# platform defaults. Defaults to "true".
|
|
|
|
#
|
2002-07-09 14:24:59 +02:00
|
|
|
SetupObjectsDir ;
|
2005-03-03 01:38:19 +01:00
|
|
|
if $(3) != false {
|
|
|
|
SetupDefaultIncludes ;
|
|
|
|
}
|
2002-07-09 14:24:59 +02:00
|
|
|
|
2005-07-04 13:14:31 +02:00
|
|
|
# Remove `-nostdinc' from CCFLAGS and C++FLAGS. Set DEFINES back to what
|
|
|
|
# was originally defined for the build platform.
|
2003-05-11 19:28:24 +02:00
|
|
|
local oldCCFLAGS = $(CCFLAGS) ;
|
|
|
|
local oldC++FLAGS = $(C++FLAGS) ;
|
2005-07-04 13:14:31 +02:00
|
|
|
local oldDefines = $(DEFINES) ;
|
2003-05-11 19:28:24 +02:00
|
|
|
CCFLAGS = [ Filter $(CCFLAGS) : -nostdinc ] ;
|
|
|
|
C++FLAGS = [ Filter $(C++FLAGS) : -nostdinc ] ;
|
2005-07-04 13:14:31 +02:00
|
|
|
DEFINES = $(BUILD_PLATFORM_DEFINES) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
|
|
|
|
Main $(1) : $(2) ;
|
2003-05-11 19:28:24 +02:00
|
|
|
|
2005-03-04 00:15:44 +01:00
|
|
|
ObjectsDefines $(2) : _NO_INLINE_ASM ;
|
|
|
|
# Be careful with find_thread() and the like.
|
|
|
|
|
2003-05-11 19:28:24 +02:00
|
|
|
# Reset CCFLAGS and C++FLAGS to original values.
|
|
|
|
CCFLAGS = $(oldCCFLAGS) ;
|
|
|
|
C++FLAGS = $(oldC++FLAGS) ;
|
2005-07-04 13:14:31 +02:00
|
|
|
DEFINES = $(oldDefines) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
2003-06-24 18:44:00 +02:00
|
|
|
rule BuildPlatformTest
|
|
|
|
{
|
|
|
|
# Usage BuildPlatformTest <target> : <sources> ;
|
|
|
|
|
|
|
|
local target = $(1) ;
|
|
|
|
local sources = $(2) ;
|
|
|
|
|
|
|
|
BuildPlatformMain $(target) : $(sources) ;
|
|
|
|
local relPath ;
|
|
|
|
if [ FIsPrefix src tests : $(SUBDIR_TOKENS) ] {
|
|
|
|
relPath = $(SUBDIR_TOKENS[3-]) ;
|
|
|
|
} else {
|
|
|
|
relPath = $(SUBDIR_TOKENS[2-]) ;
|
|
|
|
}
|
|
|
|
MakeLocate $(target) : [ FDirName $(OBOS_TEST_DIR) $(relPath) ] ;
|
|
|
|
}
|
|
|
|
|
2002-07-09 14:24:59 +02:00
|
|
|
rule KernelConfigSection
|
|
|
|
{
|
|
|
|
# KernelConfigSection <section> : <type> : <file> ;
|
2002-07-13 00:53:42 +02:00
|
|
|
|
|
|
|
SECTION_NAMES on $(OBOS_KERNEL_CONFIG) += $(1) ;
|
|
|
|
SECTION_TYPES on $(OBOS_KERNEL_CONFIG) += $(2) ;
|
|
|
|
SECTION_FILES on $(OBOS_KERNEL_CONFIG) += $(3) ;
|
|
|
|
|
|
|
|
Depends $(OBOS_KERNEL_CONFIG) : $(3) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
rule WriteKernelConfig
|
|
|
|
{
|
|
|
|
# usage: WriteKernelConfig <target> ;
|
|
|
|
|
2002-07-17 01:25:46 +02:00
|
|
|
LocalDepends files : $(1) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
|
2002-07-13 00:53:42 +02:00
|
|
|
MakeLocate $(1) : $(OBOS_OBJECT_TARGET) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
|
2002-07-17 01:25:46 +02:00
|
|
|
LocalClean clean : $(1) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
2002-07-13 00:53:42 +02:00
|
|
|
actions WriteKernelConfig bind SECTION_FILES
|
2002-07-09 14:24:59 +02:00
|
|
|
{
|
2002-07-12 20:46:53 +02:00
|
|
|
target="$(1)"
|
|
|
|
echo "# OpenBeOS Kernel Config File" > "$target"
|
|
|
|
echo "# Automatically generated - do not edit!" >> "$target"
|
2002-07-13 00:53:42 +02:00
|
|
|
count=0
|
|
|
|
for section in "$(SECTION_NAMES)" ; do
|
|
|
|
count=`expr $count + 1`
|
|
|
|
eval section$count="$section"
|
|
|
|
done
|
|
|
|
i=1
|
|
|
|
for type in "$(SECTION_TYPES)" ; do
|
|
|
|
eval type$i="$type"
|
|
|
|
i=`expr $i + 1`
|
|
|
|
done
|
|
|
|
i=1
|
|
|
|
for file in "$(SECTION_FILES)" ; do
|
|
|
|
eval file$i="$file"
|
|
|
|
i=`expr $i + 1`
|
|
|
|
done
|
|
|
|
for i in `seq $count` ; do
|
|
|
|
eval section="\$section$i"
|
|
|
|
eval type="\$type$i"
|
|
|
|
eval file="\$file$i"
|
|
|
|
echo "" >> "$target"
|
|
|
|
echo "["$section"]" >> "$target"
|
|
|
|
echo "type="$type >> "$target"
|
|
|
|
case "$file" in
|
|
|
|
/*) ;;
|
|
|
|
*) file=`pwd`/"$file";;
|
|
|
|
esac
|
|
|
|
echo "file="$file >> "$target"
|
2002-07-09 14:24:59 +02:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
rule BuildKernel
|
|
|
|
{
|
|
|
|
# Usage BuildKernel <target> : <config_file> ;
|
2002-07-15 00:08:01 +02:00
|
|
|
local kernel = $(1) ;
|
|
|
|
local configFile = $(2) ;
|
|
|
|
local bootmaker = bootmaker ;
|
2002-07-09 14:24:59 +02:00
|
|
|
|
2002-07-17 01:25:46 +02:00
|
|
|
LocalDepends all : $(kernel) ;
|
2002-07-15 00:08:01 +02:00
|
|
|
Depends $(kernel) : $(configFile) $(bootmaker) ;
|
2002-07-17 01:25:46 +02:00
|
|
|
LocalClean clean : $(kernel) ;
|
2002-07-15 00:08:01 +02:00
|
|
|
MakeLocate $(kernel) : $(LOCATE_TARGET) ;
|
|
|
|
|
|
|
|
BOOT_MAKER on $(kernel) = $(bootmaker) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
2002-07-15 00:08:01 +02:00
|
|
|
actions BuildKernel bind BOOT_MAKER
|
2002-07-09 14:24:59 +02:00
|
|
|
{
|
2002-07-15 00:08:01 +02:00
|
|
|
"$(BOOT_MAKER)" --strip-debug --strip-binary strip "$(2)" -o "$(1)" ;
|
2002-07-09 14:24:59 +02:00
|
|
|
echo ""
|
|
|
|
echo "Kernel linked!"
|
|
|
|
echo ""
|
|
|
|
}
|
|
|
|
|
|
|
|
rule KernelFloppyImage
|
|
|
|
{
|
|
|
|
# Usage KernelFloppyImage <target> : <kernel> : <bootblock> ;
|
2002-07-15 00:08:01 +02:00
|
|
|
local floppy = $(1) ;
|
|
|
|
local kernel = $(2) ;
|
|
|
|
local bootblock = $(3) ;
|
|
|
|
local makeflop = makeflop ;
|
2002-07-09 14:24:59 +02:00
|
|
|
|
2002-07-17 01:25:46 +02:00
|
|
|
LocalDepends all : $(floppy) ;
|
2002-07-15 00:08:01 +02:00
|
|
|
Depends $(floppy) : $(kernel) $(bootblock) $(makeflop) ;
|
2002-07-17 01:25:46 +02:00
|
|
|
LocalClean clean : $(floppy) ;
|
2002-07-15 00:08:01 +02:00
|
|
|
MakeLocate $(floppy) : $(OBOS_OBJECT_TARGET) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
|
2002-07-15 00:08:01 +02:00
|
|
|
BOOT_BLOCK on $(floppy) = $(bootblock) ;
|
|
|
|
MAKE_FLOP on $(floppy) = $(makeflop) ;
|
2002-07-09 14:24:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# This may be a bit verbose, but I think it's useful to show what's
|
|
|
|
# going on, at least in this early stage of development.
|
2002-07-15 00:08:01 +02:00
|
|
|
actions KernelFloppyImage bind BOOT_BLOCK bind MAKE_FLOP
|
2002-07-09 14:24:59 +02:00
|
|
|
{
|
2002-07-19 04:38:35 +02:00
|
|
|
"$(MAKE_FLOP)" "-p $(shell expr 18 \* 2 \* 512)" "$(BOOT_BLOCK)" "$(2)" "$(1)" ;
|
2002-07-15 00:08:01 +02:00
|
|
|
|
2002-07-09 14:24:59 +02:00
|
|
|
echo ""
|
|
|
|
echo "*************************************************"
|
|
|
|
echo "* Kernel build completed! *"
|
|
|
|
echo "* Boot image for a 1.44M floppy created *"
|
|
|
|
echo "*************************************************"
|
|
|
|
echo ""
|
2002-07-15 00:08:01 +02:00
|
|
|
echo "Floppy image is $(1)"
|
2002-07-09 14:24:59 +02:00
|
|
|
echo "The following command will write it to a floppy on BeOS"
|
2002-07-15 00:08:01 +02:00
|
|
|
echo " dd if=$(1) of=/dev/disk/floppy/raw bs=18k"
|
|
|
|
echo "Alternatively you can run"
|
|
|
|
echo " ./configure --floppy /dev/disk/floppy/raw"
|
|
|
|
echo "once and build + write the image subsequently via"
|
|
|
|
echo " jam installfloppy"
|
2002-07-09 14:24:59 +02:00
|
|
|
echo ""
|
|
|
|
}
|
|
|
|
|
2002-07-15 00:08:01 +02:00
|
|
|
rule InstallFloppy
|
|
|
|
{
|
|
|
|
# InstallFloppy <target> : <floppy>
|
|
|
|
# "dd"s <floppy> to $(FLOPPY_PATH).
|
|
|
|
|
|
|
|
local target = $(1) ;
|
|
|
|
local floppy = $(2) ;
|
|
|
|
|
|
|
|
NotFile $(target) ;
|
|
|
|
Always $(target) ;
|
|
|
|
Depends $(target) : $(floppy) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
actions InstallFloppy
|
|
|
|
{
|
|
|
|
if [ -z $(FLOPPY_PATH) ] ; then
|
|
|
|
echo "Can't install floppy: FLOPPY_PATH not set."
|
|
|
|
echo "run: ./configure --floppy <floppy path>"
|
|
|
|
echo
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
dd if=$(2) of=$(FLOPPY_PATH) bs=18k
|
|
|
|
}
|
2002-07-09 14:24:59 +02:00
|
|
|
|
2002-10-12 17:15:38 +02:00
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# FreeType 2 specific rules and variables
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
FT2_INCLUDE = [ FDirName $(OBOS_TOP) headers libs freetype2 ] ;
|
|
|
|
FT2_SRC = [ FDirName $(OBOS_TOP) src libs freetype2 ] ;
|
|
|
|
|
|
|
|
FT2_LIB = freetype ;
|
|
|
|
|
2002-11-20 22:40:01 +01:00
|
|
|
FT2_COMPONENTS ?= gzip # support for gzip-compressed files.
|
|
|
|
autohint # auto-hinter
|
2005-09-01 08:40:20 +02:00
|
|
|
autofit
|
2002-11-20 22:40:01 +01:00
|
|
|
base # base component (public APIs)
|
|
|
|
bdf # BDF font driver
|
|
|
|
cache # cache sub-system
|
|
|
|
cff # CFF/CEF font driver
|
|
|
|
cid # Postscript CID-keyed font driver
|
2004-06-22 16:18:32 +02:00
|
|
|
lzw # LZW routines
|
2005-09-01 08:40:20 +02:00
|
|
|
otvalid
|
2002-11-20 22:40:01 +01:00
|
|
|
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
|
|
|
|
;
|
|
|
|
|
2002-10-12 17:15:38 +02:00
|
|
|
rule UseFreeTypeHeaders
|
|
|
|
{
|
|
|
|
SubDirHdrs $(FT2_INCLUDE) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule UseFreeTypeObjectHeaders
|
|
|
|
{
|
2002-12-09 13:43:02 +01:00
|
|
|
# UseFreeTypeObjectHeaders <sources> [ : <objects> ] ;
|
|
|
|
SourceHdrs $(1) : $(FT2_INCLUDE) : $(2) ;
|
2002-10-12 17:15:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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) ;
|
2002-10-26 22:23:12 +02:00
|
|
|
SetupIncludes ;
|
2002-10-12 17:15:38 +02:00
|
|
|
SetupObjectsDir ;
|
|
|
|
MakeLocateObjects $(sources) ;
|
|
|
|
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 $(1) : $(objects) ;
|
|
|
|
}
|
|
|
|
|
2003-12-18 17:46:57 +01:00
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# Packages for OBOS alpha/beta testers
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
rule Copy
|
|
|
|
{
|
2003-12-23 05:02:41 +01:00
|
|
|
Depends $(<) : $(>) ;
|
2003-12-18 17:46:57 +01:00
|
|
|
SEARCH on $(>) = $(SEARCH_SOURCE) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
actions Copy
|
|
|
|
{
|
2004-01-19 23:16:16 +01:00
|
|
|
cp -dp "$(>)" "$(<)" ;
|
|
|
|
if [ -f "$(>)" ] ; then copyattr "$(>)" "$(<)" ; fi ;
|
2003-12-18 17:46:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
rule Packages
|
|
|
|
{
|
|
|
|
local packagenames = $(1) ;
|
|
|
|
local packagefiles = $(2) ;
|
|
|
|
local path = $(3) ;
|
|
|
|
for name in $(packagenames) {
|
|
|
|
Package $(name) : $(packagefiles) : $(path) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rule Package
|
|
|
|
{
|
|
|
|
local packagename = $(1) ;
|
|
|
|
local packagefiles = $(2) ;
|
|
|
|
local path = $(3) ;
|
|
|
|
|
2003-12-23 18:23:18 +01:00
|
|
|
local packagezip = $(packagename:S=.zip:G=_packages) ;
|
2003-12-18 17:46:57 +01:00
|
|
|
local packagedir = [ FDirName $(OBOS_PACKAGE_DIR) $(packagename) ] ;
|
|
|
|
|
|
|
|
local installscript = install.sh ;
|
2003-12-23 18:23:18 +01:00
|
|
|
local packageinstallscript = $(installscript:G=_packages!$(packagename)) ;
|
2003-12-18 17:46:57 +01:00
|
|
|
local installzip = install.zip ;
|
2003-12-23 18:23:18 +01:00
|
|
|
local packageinstallzip = $(installzip:G=_packages!$(packagename)) ;
|
2003-12-18 17:46:57 +01:00
|
|
|
|
2003-12-23 18:23:18 +01:00
|
|
|
local packageobjectdir
|
|
|
|
= [ FDirName $(OBOS_PACKAGE_OBJECT_DIR) $(packagename) ] ;
|
2003-12-18 17:46:57 +01:00
|
|
|
local packagefiledir = [ FDirName $(packageobjectdir) $(path) ] ;
|
2003-12-23 18:23:18 +01:00
|
|
|
local packagefileinstallzip
|
|
|
|
= $(installzip:G=_package_objects!$(packagename)) ;
|
|
|
|
|
|
|
|
# add the files to the install.zip
|
|
|
|
local packagefilegrist = [ FGrist _package_files $(packagename) $(path) ] ;
|
2003-12-18 17:46:57 +01:00
|
|
|
for file in $(packagefiles) {
|
|
|
|
if $(3[0]) = "boot" {
|
2003-12-23 18:23:18 +01:00
|
|
|
local packagefile = $(file:G=$(packagefilegrist)) ;
|
2003-12-18 17:46:57 +01:00
|
|
|
MakeLocate $(packagefile) : $(packagefiledir) ;
|
|
|
|
Copy $(packagefile) : $(file) ;
|
|
|
|
Clean cleanPackages : $(packagefile) ;
|
|
|
|
PackageInstallZip $(packagefileinstallzip) : $(packagefile) ;
|
|
|
|
} else {
|
2003-12-23 18:23:18 +01:00
|
|
|
local packagefile = $(file:G=_packages!$(packagename)) ;
|
2003-12-18 17:46:57 +01:00
|
|
|
MakeLocate $(packagefile) : $(packagedir) ;
|
2004-01-07 04:43:28 +01:00
|
|
|
Copy $(packagefile) : [ FGristFiles $(file) ] ;
|
2003-12-18 17:46:57 +01:00
|
|
|
Clean cleanPackages : $(packagefile) ;
|
|
|
|
Depends $(packagezip) : $(packagefile) ;
|
|
|
|
}
|
|
|
|
}
|
2003-12-23 18:23:18 +01:00
|
|
|
|
|
|
|
# general setup for this packages -- only on first invocation
|
|
|
|
if ! $(_setup_$(packagename)) {
|
|
|
|
_setup_$(packagename) = true ;
|
|
|
|
|
|
|
|
NotFile $(packagename) ;
|
2004-10-24 04:57:22 +02:00
|
|
|
LocalDepends packages : $(packagename) ;
|
2003-12-23 18:23:18 +01:00
|
|
|
|
|
|
|
MakeLocate $(packagezip) : $(OBOS_PACKAGE_DIR) ;
|
|
|
|
MakeLocate $(packageinstallscript) : $(packagedir) ;
|
|
|
|
MakeLocate $(packageinstallzip) : $(packagedir) ;
|
|
|
|
MakeLocate $(packagefileinstallzip) : $(packageobjectdir) ;
|
|
|
|
|
|
|
|
PackageInstallScript $(packageinstallscript) : $(packagedir) ;
|
|
|
|
LinkInstallZip $(packageinstallzip) : $(packagefileinstallzip) ;
|
|
|
|
Depends $(packagename) : $(packagezip) ;
|
|
|
|
PackageZip $(packagezip) : $(packagedir)
|
|
|
|
: $(packageinstallscript) $(packageinstallzip) ;
|
|
|
|
}
|
|
|
|
|
2003-12-18 17:46:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
rule PackageZip
|
|
|
|
{
|
2003-12-23 18:23:18 +01:00
|
|
|
local dir = $(2:G=dir) ;
|
|
|
|
Depends $(1) : $(dir) $(3) ;
|
2003-12-18 17:46:57 +01:00
|
|
|
Clean cleanPackages : $(1) ;
|
2003-12-23 18:23:18 +01:00
|
|
|
PackageZip1 $(1) : $(dir) ;
|
2003-12-18 17:46:57 +01:00
|
|
|
}
|
|
|
|
|
2003-12-23 18:23:18 +01:00
|
|
|
actions together PackageZip1 {
|
2004-01-27 09:17:04 +01:00
|
|
|
cd "$(OBOS_PACKAGE_DIR)" ;
|
|
|
|
zip -rq "$(1:BS)" "$(2:BS)" ;
|
2003-12-18 17:46:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
rule PackageInstallScript
|
|
|
|
{
|
|
|
|
MakeLocate $(1) : $(2) ;
|
|
|
|
Clean cleanPackages : $(1) ;
|
2003-12-23 18:23:18 +01:00
|
|
|
PackageInstallScript1 $(1) : $(2:G=dir) ;
|
2003-12-18 17:46:57 +01:00
|
|
|
}
|
|
|
|
|
2003-12-23 18:23:18 +01:00
|
|
|
actions together PackageInstallScript1
|
2003-12-18 17:46:57 +01:00
|
|
|
{
|
2003-12-22 23:17:38 +01:00
|
|
|
echo '#!/bin/sh
|
|
|
|
base=`dirname "$0"`
|
2004-01-27 09:17:04 +01:00
|
|
|
cd "$base"
|
2003-12-22 23:17:38 +01:00
|
|
|
if [ -n "$TTY" ]
|
|
|
|
then
|
2004-01-27 09:17:04 +01:00
|
|
|
unzip -d / install.zip
|
2003-12-22 23:17:38 +01:00
|
|
|
else
|
2004-01-27 09:17:04 +01:00
|
|
|
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)" ;
|
2003-12-18 17:46:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
rule PackageInstallZip
|
|
|
|
{
|
|
|
|
Depends $(1) : $(2) ;
|
|
|
|
Clean cleanPackages : $(1) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
actions together PackageInstallZip
|
|
|
|
{
|
2004-01-27 09:17:04 +01:00
|
|
|
cd "$(1:P)" ;
|
|
|
|
zip -rqy "$(1:BS)" boot ;
|
2003-12-18 17:46:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
rule LinkInstallZip
|
|
|
|
{
|
|
|
|
Depends $(1) : $(2) ;
|
|
|
|
Clean cleanPackages : $(1) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
actions together LinkInstallZip
|
|
|
|
{
|
2004-01-27 09:17:04 +01:00
|
|
|
ln -sf "`pwd`/$(2)" "$(1)" ;
|
2003-12-18 17:46:57 +01:00
|
|
|
}
|
2004-03-06 23:39:28 +01:00
|
|
|
|
|
|
|
rule SubIncludeGPL
|
|
|
|
{
|
|
|
|
# SubInclude rule that can be used to conditionally include GPL licensed add-ons
|
|
|
|
if $(INCLUDE_GPL_ADDONS) = 1 {
|
|
|
|
SubInclude $(1) ;
|
|
|
|
}
|
|
|
|
}
|
2005-05-13 17:42:21 +02:00
|
|
|
|
|
|
|
rule Man2Doc
|
|
|
|
{
|
|
|
|
local source = [ FGristFiles $(2) ] ;
|
|
|
|
local binary = $(1) ;
|
|
|
|
|
|
|
|
SEARCH on $(source) = $(SEARCH_SOURCE) ;
|
|
|
|
|
2005-05-15 03:44:35 +02:00
|
|
|
MakeLocate $(binary) : [ FDirName $(OBOS_OBJECT_TARGET) documentation Shell_Tools ] ;
|
2005-05-13 17:42:21 +02:00
|
|
|
|
|
|
|
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) ;
|
|
|
|
}
|
|
|
|
}
|
2005-05-15 03:44:35 +02:00
|
|
|
|