2005-10-29 20:27:43 +04:00
|
|
|
|
|
|
|
rule AddSharedObjectGlueCode
|
|
|
|
{
|
|
|
|
# AddSharedObjectGlueCode <target> : <isExecutable> ;
|
2007-08-23 02:07:03 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
# we link with -nostdlib and add the required libs manually, when building
|
|
|
|
# for Haiku
|
2005-11-27 16:31:50 +03:00
|
|
|
local platform ;
|
|
|
|
on $(1) {
|
|
|
|
platform = $(PLATFORM) ;
|
|
|
|
if $(platform) = haiku {
|
2013-08-01 10:51:16 +04:00
|
|
|
local stdLibs = [ MultiArchDefaultGristFiles libroot.so ] ;
|
|
|
|
local type = EXECUTABLE ;
|
|
|
|
if $(2) != true {
|
|
|
|
type = LIBRARY ;
|
2005-11-27 16:31:50 +03:00
|
|
|
|
|
|
|
# special case for libroot: don't link it against itself
|
|
|
|
if $(DONT_LINK_AGAINST_LIBROOT) {
|
|
|
|
stdLibs = ;
|
|
|
|
}
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
2013-08-01 10:51:16 +04:00
|
|
|
local beginGlue
|
|
|
|
= $(HAIKU_$(type)_BEGIN_GLUE_CODE_$(TARGET_PACKAGING_ARCH)) ;
|
|
|
|
local endGlue
|
|
|
|
= $(HAIKU_$(type)_END_GLUE_CODE_$(TARGET_PACKAGING_ARCH)) ;
|
|
|
|
|
2005-11-27 16:31:50 +03:00
|
|
|
LINK_BEGIN_GLUE on $(1) = $(beginGlue) ;
|
|
|
|
LINK_END_GLUE on $(1) = $(endGlue) ;
|
|
|
|
|
2006-04-22 20:51:24 +04:00
|
|
|
NEEDLIBS on $(1) = [ on $(1) return $(NEEDLIBS) ] $(stdLibs) ;
|
2005-11-27 16:31:50 +03:00
|
|
|
Depends $(1) : $(stdLibs) $(beginGlue) $(endGlue) ;
|
2008-06-03 20:34:02 +04:00
|
|
|
LINKFLAGS on $(1) = [ on $(1) return $(LINKFLAGS) ] -nostdlib
|
|
|
|
-Xlinker --no-undefined ;
|
2005-11-27 16:31:50 +03:00
|
|
|
}
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
* Reintroduced third LinkAgainst parameter <mapLibs>, defaulting to true.
Library names are now mapped for all targets but "host" (not only for
"haiku") -- added one more level of indirection to achieve that.
(TARGET_LIBRARY_NAME_MAP -> *_LIBRARY_NAME_MAP_*).
* Renamed build/HaikuBuildCompatibility.h to BeOSBuildCompatibility.h
(auto-included when compiling something that uses the Be API for platform
"host" on anon-BeOS platform), and introduced build/HaikuBuildCompatibility.h,
which can be included when compiling something that can be built for both,
Haiku and BeOS compatible platforms.
* Introduced libhaikucompat.a, a library that adds a few functions existing
under Haiku, but not under BeOS.
* New rule AddSubDirSupportedPlatforms.
* Renamed libopenbeos.so to libbe_haiku.so.
* Introduced new target platform "libbe_test", which is basically equivalent
to a BeOS compatible host platform target, with the exception, that instead
of the host platform's libbe.so a special build of Haiku's libbe.so
(libbe_haiku.so (formerly known as libopenbeos.so)) is used. Furthermore
Haiku's public app, interface, storage, and support kit headers are used
when compiling. This replaces the less nice way in which the test app server
and applications for this test environment were built.
When building for platform "libbe_test", the library name "be" is
autotranslated to "libbe_haiku.so". Thus most applications don't need
special fiddling when them building them for the app server test environment;
usually an "AddSubDirSupportedPlatforms libbe_test ;" will suffice.
* Reduced the dependencies of <syscalls.h> and fixed problems caused by this
(e.g. source files not including the needed headers directly).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14749 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-07 19:07:25 +03:00
|
|
|
|
|
|
|
# link against the compatibility libraries needed for the target
|
|
|
|
if $(platform) != host && $(TARGET_HAIKU_COMPATIBILITY_LIBS) {
|
|
|
|
LinkAgainst $(1) : $(TARGET_HAIKU_COMPATIBILITY_LIBS) ;
|
|
|
|
}
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
rule Executable
|
|
|
|
{
|
|
|
|
# Executable <name> : <sources> : <libraries> : <res> ;
|
|
|
|
#
|
|
|
|
if ! [ IsPlatformSupportedForTarget $(1) ] {
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
|
|
|
AddResources $(1) : $(4) ;
|
|
|
|
Main $(1) : $(2) ;
|
|
|
|
LinkAgainst $(1) : $(3) ;
|
|
|
|
LINKFLAGS on $(1) = [ on $(1) return $(LINKFLAGS) ]
|
2008-06-03 20:34:02 +04:00
|
|
|
-Xlinker -soname=_APP_ ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
|
|
|
# we link with -nostdlib and add the required libs manually, when building
|
|
|
|
# for Haiku
|
|
|
|
AddSharedObjectGlueCode $(1) : true ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule Application
|
|
|
|
{
|
|
|
|
# Application <name> : <sources> : <libraries> : <res> ;
|
|
|
|
Executable $(1) : $(2) : $(3) : $(4) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule BinCommand
|
|
|
|
{
|
|
|
|
# BinCommand <name> : <sources> : <libraries> : <res> ;
|
|
|
|
Executable $(1) : $(2) : $(3) : $(4) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule StdBinCommands
|
|
|
|
{
|
|
|
|
# StdBinCommands <sources> : <libs> : <res> ;
|
|
|
|
local libs = $(2) ;
|
|
|
|
local ress = $(3) ;
|
|
|
|
local source ;
|
|
|
|
for source in $(1)
|
|
|
|
{
|
|
|
|
local target = $(source:S=) ;
|
|
|
|
|
|
|
|
BinCommand $(target) : $(source) : $(libs) : $(ress) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rule Preference
|
|
|
|
{
|
|
|
|
# Preference <name> : <sources> : <libraries> : <res> ;
|
|
|
|
Executable $(1) : $(2) : $(3) : $(4) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule Server
|
|
|
|
{
|
|
|
|
# Server <name> : <sources> : <libraries> : <res> ;
|
2007-08-23 02:07:03 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
Executable $(1) : $(2) : $(3) : $(4) ;
|
|
|
|
}
|
|
|
|
|
2007-04-07 05:27:19 +04:00
|
|
|
rule Addon target : sources : libraries : isExecutable
|
2005-10-29 20:27:43 +04:00
|
|
|
{
|
2007-04-07 05:27:19 +04:00
|
|
|
# Addon <target> : <sources> : <is executable> : <libraries> ;
|
|
|
|
# <target>: The add-on.
|
2005-10-29 20:27:43 +04:00
|
|
|
# <sources>: Source files.
|
|
|
|
# <libraries>: Libraries to be linked against.
|
2007-04-07 05:27:19 +04:00
|
|
|
# <isExecutable>: true, if the target shall be executable as well.
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2007-04-07 05:27:19 +04:00
|
|
|
if ! [ IsPlatformSupportedForTarget $(target) ] {
|
2005-10-29 20:27:43 +04:00
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
2007-04-07 05:27:19 +04:00
|
|
|
Main $(target) : $(sources) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2008-06-03 20:34:02 +04:00
|
|
|
local linkFlags = -Xlinker -soname=\"$(target:G=)\" ;
|
2005-10-29 20:27:43 +04:00
|
|
|
if $(isExecutable) != true {
|
2013-04-24 22:27:55 +04:00
|
|
|
linkFlags = -shared $(linkFlags) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
2007-04-07 05:27:19 +04:00
|
|
|
LINKFLAGS on $(target) = [ on $(target) return $(LINKFLAGS) ] $(linkFlags) ;
|
|
|
|
LinkAgainst $(target) : $(libraries) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2007-04-07 05:27:19 +04:00
|
|
|
AddSharedObjectGlueCode $(target) : $(isExecutable) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
2007-04-07 05:42:47 +04:00
|
|
|
rule Translator target : sources : libraries : isExecutable
|
2005-10-29 20:27:43 +04:00
|
|
|
{
|
2007-04-07 05:42:47 +04:00
|
|
|
# Translator <target> : <sources> : <libraries> : <isExecutable> ;
|
|
|
|
Addon $(target) : $(sources) : $(libraries) : $(isExecutable) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
2007-04-07 05:27:19 +04:00
|
|
|
rule ScreenSaver target : sources : libraries
|
2005-10-29 20:27:43 +04:00
|
|
|
{
|
2007-04-07 05:27:19 +04:00
|
|
|
# ScreenSaver <target> : <sources> : <libraries> ;
|
|
|
|
Addon $(target) : $(sources) : $(libraries) : false ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
rule StaticLibrary
|
|
|
|
{
|
2005-11-27 16:31:50 +03:00
|
|
|
# StaticLibrary <lib> : <sources> : <otherObjects> ;
|
2005-10-29 20:27:43 +04:00
|
|
|
# Creates a static library from sources.
|
|
|
|
# <lib>: The static library to be built.
|
2005-11-27 16:31:50 +03:00
|
|
|
# <sources>: List of source files.
|
|
|
|
# <otherObjects>: List of additional object files.
|
2007-08-23 02:07:03 +04:00
|
|
|
#
|
2005-10-29 20:27:43 +04:00
|
|
|
local lib = $(1) ;
|
|
|
|
local sources = [ FGristFiles $(2) ] ;
|
2005-11-27 16:31:50 +03:00
|
|
|
local otherObjects = $(3) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
local objects = $(sources:S=$(SUFOBJ)) ;
|
|
|
|
|
|
|
|
if ! [ IsPlatformSupportedForTarget $(1) ] {
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
|
|
|
InheritPlatform $(objects) : $(lib) ;
|
|
|
|
|
2005-11-27 16:31:50 +03:00
|
|
|
StaticLibraryFromObjects $(lib) : $(objects) $(otherObjects) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
Objects $(2) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule StaticLibraryFromObjects
|
|
|
|
{
|
|
|
|
if ! [ IsPlatformSupportedForTarget $(1) ] {
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
|
|
|
LibraryFromObjects $(1) : $(2) ;
|
|
|
|
}
|
|
|
|
|
2009-03-30 19:11:55 +04:00
|
|
|
rule AssembleNasm
|
|
|
|
{
|
|
|
|
Depends $(<) : $(>) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
actions AssembleNasm
|
|
|
|
{
|
2009-04-11 10:23:14 +04:00
|
|
|
if test $(ASFLAGS) ; then
|
2009-04-13 14:50:17 +04:00
|
|
|
$(HAIKU_YASM) -d $(ASFLAGS) -f elf32 -o $(1) $(2);
|
2009-04-11 10:23:14 +04:00
|
|
|
else
|
2009-04-13 14:50:17 +04:00
|
|
|
$(HAIKU_YASM) -f elf32 -o $(1) $(2);
|
2009-04-11 10:23:14 +04:00
|
|
|
fi
|
2009-03-30 19:11:55 +04:00
|
|
|
}
|
|
|
|
|
2013-09-19 03:25:44 +04:00
|
|
|
rule CompileDTS
|
|
|
|
{
|
|
|
|
Depends $(<) : $(>) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
actions CompileDTS
|
|
|
|
{
|
|
|
|
dtc -O dtb -o $(1) $(2);
|
|
|
|
}
|
|
|
|
|
2005-11-27 16:31:50 +03:00
|
|
|
rule Ld
|
|
|
|
{
|
|
|
|
# Ld <name> : <objs> : <linkerscript> : <flags> ;
|
|
|
|
#
|
|
|
|
local target = $(1) ;
|
|
|
|
local objects = $(2) ;
|
|
|
|
local linkerScript = $(3) ;
|
|
|
|
local linkerFlags = $(4) ;
|
|
|
|
|
|
|
|
if $(linkerScript) {
|
|
|
|
linkerFlags += --script=$(linkerScript) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
on $(target) {
|
|
|
|
if $(PLATFORM) = host {
|
|
|
|
LINK on $(target) = $(HOST_LD) ;
|
|
|
|
LINKFLAGS on $(target) = $(HOST_LDFLAGS) $(LINKFLAGS) $(linkerFlags) ;
|
|
|
|
} else {
|
2013-08-01 10:51:16 +04:00
|
|
|
LINK on $(target) = $(TARGET_LD_$(TARGET_PACKAGING_ARCH)) ;
|
|
|
|
LINKFLAGS on $(target) = $(TARGET_LDFLAGS_$(TARGET_PACKAGING_ARCH))
|
|
|
|
$(LINKFLAGS) $(linkerFlags) ;
|
2005-11-27 16:31:50 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NEEDLIBS on $(target) = $(NEEDLIBS) ;
|
|
|
|
LINKLIBS on $(target) = $(LINKLIBS) ;
|
|
|
|
}
|
2007-08-23 02:07:03 +04:00
|
|
|
|
2005-11-27 16:31:50 +03:00
|
|
|
LocalClean clean : $(target) ;
|
|
|
|
LocalDepends all : $(target) ;
|
|
|
|
Depends $(target) : $(objects) ;
|
|
|
|
|
2007-08-23 02:07:03 +04:00
|
|
|
MakeLocateDebug $(target) ;
|
2007-10-02 19:22:13 +04:00
|
|
|
|
|
|
|
on $(1) XRes $(1) : $(RESFILES) ;
|
|
|
|
if ! [ on $(1) return $(DONT_USE_BEOS_RULES) ] {
|
|
|
|
SetType $(1) ;
|
|
|
|
MimeSet $(1) ;
|
|
|
|
SetVersion $(1) ;
|
|
|
|
}
|
2005-11-27 16:31:50 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
actions Ld
|
|
|
|
{
|
|
|
|
$(LINK) $(LINKFLAGS) -o "$(1)" "$(2)" "$(NEEDLIBS)" $(LINKLIBS)
|
|
|
|
}
|
|
|
|
|
2008-01-11 03:36:44 +03:00
|
|
|
rule CreateAsmStructOffsetsHeader header : source
|
|
|
|
{
|
|
|
|
# CreateAsmStructOffsetsHeader header : source
|
|
|
|
#
|
|
|
|
# Grist will be added to both header and source.
|
|
|
|
|
|
|
|
header = [ FGristFiles $(header) ] ;
|
|
|
|
source = [ FGristFiles $(source) ] ;
|
|
|
|
|
|
|
|
# find out which headers, defines, etc. to use
|
|
|
|
local headers ;
|
|
|
|
local sysHeaders ;
|
|
|
|
local defines ;
|
|
|
|
local flags ;
|
|
|
|
local includesSeparator ;
|
|
|
|
local localIncludesOption ;
|
|
|
|
local systemIncludesOption ;
|
2008-10-01 18:26:08 +04:00
|
|
|
|
2008-01-11 03:36:44 +03:00
|
|
|
on $(header) { # use on $(1) variable values
|
|
|
|
if ! $(PLATFORM) in $(SUPPORTED_PLATFORMS) {
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
|
|
|
# headers and defines
|
2008-10-01 18:26:08 +04:00
|
|
|
headers = $(HAIKU_CONFIG_HEADERS) $(SEARCH_SOURCE) $(SUBDIRHDRS)
|
|
|
|
$(HDRS) ;
|
2008-01-11 03:36:44 +03:00
|
|
|
sysHeaders = $(SUBDIRSYSHDRS) $(SYSHDRS) ;
|
|
|
|
defines = $(DEFINES) ;
|
|
|
|
|
|
|
|
if $(PLATFORM) = host {
|
|
|
|
sysHeaders += $(HOST_HDRS) ;
|
|
|
|
defines += $(HOST_DEFINES) ;
|
2008-10-01 18:26:08 +04:00
|
|
|
|
2008-01-11 03:36:44 +03:00
|
|
|
if $(USES_BE_API) {
|
|
|
|
sysHeaders += $(HOST_BE_API_HEADERS) ;
|
|
|
|
}
|
2008-10-01 18:26:08 +04:00
|
|
|
|
2008-01-11 03:36:44 +03:00
|
|
|
} else {
|
2013-08-01 10:51:16 +04:00
|
|
|
sysHeaders += $(TARGET_HDRS_$(TARGET_PACKAGING_ARCH)) ;
|
|
|
|
defines += $(TARGET_DEFINES_$(TARGET_PACKAGING_ARCH))
|
|
|
|
$(TARGET_DEFINES) ;
|
2008-01-11 03:36:44 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
# optimization flags
|
|
|
|
if $(DEBUG) = 0 {
|
|
|
|
flags += $(OPTIM) ;
|
|
|
|
} else {
|
|
|
|
flags += -O0 ;
|
|
|
|
}
|
2008-10-01 18:26:08 +04:00
|
|
|
|
2008-01-11 03:36:44 +03:00
|
|
|
if $(PLATFORM) = host {
|
|
|
|
# warning flags
|
|
|
|
if $(WARNINGS) != 0 {
|
|
|
|
flags += $(HOST_WARNING_C++FLAGS) ;
|
Fix kernel -Werror support
The introduction of secondary arch support for kernel files disabled
-Werror for all kernel files, since the -Werror flags were moved from
{CC,C++}FLAGS to TARGET_WARNING_{CC,C++}FLAGS_<arch>, which, however,
was overwritten by the SetupKernel rule. This commit introduces new
global variables {HAIKU,HOST,TARGET}_WERROR_FLAGS[_<arch>], which
contain the additional -Werror flags to be applied for the architecture.
The config variable WARNINGS can be set to "treatAsErrors" to cause
-Werror and {HOST,TARGET}_WERROR_FLAGS[_<arch>] to be appended to the
compilation flags.
Fixes #10280.
2013-12-05 15:37:14 +04:00
|
|
|
if $(WARNINGS) = treatAsErrors {
|
|
|
|
flags += -Werror $(HOST_WERROR_FLAGS) ;
|
|
|
|
}
|
2008-01-11 03:36:44 +03:00
|
|
|
}
|
2008-10-01 18:26:08 +04:00
|
|
|
|
2008-01-11 03:36:44 +03:00
|
|
|
# debug and other flags
|
|
|
|
flags += $(HOST_C++FLAGS) $(HOST_DEBUG_$(DEBUG)_C++FLAGS)
|
|
|
|
$(SUBDIRC++FLAGS) $(C++FLAGS) ;
|
2008-10-01 18:26:08 +04:00
|
|
|
|
2008-01-11 03:36:44 +03:00
|
|
|
if $(USES_BE_API) {
|
|
|
|
flags += $(HOST_BE_API_C++FLAGS) ;
|
|
|
|
}
|
2008-10-01 18:26:08 +04:00
|
|
|
|
2008-01-11 03:36:44 +03:00
|
|
|
C++ on $(header) = $(HOST_C++) ;
|
2008-10-01 18:26:08 +04:00
|
|
|
|
2008-01-11 03:36:44 +03:00
|
|
|
includesSeparator = $(HOST_INCLUDES_SEPARATOR) ;
|
|
|
|
localIncludesOption = $(HOST_LOCAL_INCLUDES_OPTION) ;
|
|
|
|
systemIncludesOption = $(HOST_SYSTEM_INCLUDES_OPTION) ;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
# warning flags
|
|
|
|
if $(WARNINGS) != 0 {
|
2013-08-01 10:51:16 +04:00
|
|
|
flags += $(TARGET_WARNING_C++FLAGS_$(TARGET_PACKAGING_ARCH)) ;
|
Fix kernel -Werror support
The introduction of secondary arch support for kernel files disabled
-Werror for all kernel files, since the -Werror flags were moved from
{CC,C++}FLAGS to TARGET_WARNING_{CC,C++}FLAGS_<arch>, which, however,
was overwritten by the SetupKernel rule. This commit introduces new
global variables {HAIKU,HOST,TARGET}_WERROR_FLAGS[_<arch>], which
contain the additional -Werror flags to be applied for the architecture.
The config variable WARNINGS can be set to "treatAsErrors" to cause
-Werror and {HOST,TARGET}_WERROR_FLAGS[_<arch>] to be appended to the
compilation flags.
Fixes #10280.
2013-12-05 15:37:14 +04:00
|
|
|
if $(WARNINGS) = treatAsErrors {
|
|
|
|
flags += -Werror
|
|
|
|
$(TARGET_WERROR_FLAGS_$(TARGET_PACKAGING_ARCH)) ;
|
|
|
|
}
|
2008-01-11 03:36:44 +03:00
|
|
|
}
|
2008-10-01 18:26:08 +04:00
|
|
|
|
2008-01-11 03:36:44 +03:00
|
|
|
# debug and other flags
|
2013-08-01 10:51:16 +04:00
|
|
|
flags += $(TARGET_C++FLAGS_$(TARGET_PACKAGING_ARCH))
|
|
|
|
$(TARGET_DEBUG_$(DEBUG)_C++FLAGS_$(TARGET_PACKAGING_ARCH))
|
2008-01-11 03:36:44 +03:00
|
|
|
$(SUBDIRC++FLAGS) $(C++FLAGS) ;
|
2008-10-01 18:26:08 +04:00
|
|
|
|
2013-08-01 10:51:16 +04:00
|
|
|
C++ on $(header) = $(TARGET_C++_$(TARGET_PACKAGING_ARCH)) ;
|
2008-01-11 03:36:44 +03:00
|
|
|
|
2013-08-01 10:51:16 +04:00
|
|
|
includesSeparator
|
|
|
|
= $(TARGET_INCLUDES_SEPARATOR_$(TARGET_PACKAGING_ARCH)) ;
|
|
|
|
localIncludesOption
|
|
|
|
= $(TARGET_LOCAL_INCLUDES_OPTION_$(TARGET_PACKAGING_ARCH)) ;
|
|
|
|
systemIncludesOption
|
|
|
|
= $(TARGET_SYSTEM_INCLUDES_OPTION_$(TARGET_PACKAGING_ARCH)) ;
|
2008-01-11 03:36:44 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-12 04:00:23 +04:00
|
|
|
# Turn off "invalid use of offsetof()" macro warning. We use offsetof() also
|
|
|
|
# for non-PODs. Since we're using the same compiler for the whole kernel and
|
|
|
|
# don't do virtual inheritence, that works well enough.
|
|
|
|
flags += -Wno-invalid-offsetof ;
|
2013-08-01 10:51:16 +04:00
|
|
|
# TODO: Rather get rid of the respective offsetof() instances.
|
2011-06-12 04:00:23 +04:00
|
|
|
|
2008-01-11 03:36:44 +03:00
|
|
|
# locate object, search for source, and set on target variables
|
|
|
|
|
|
|
|
Depends $(header) : $(source) ;
|
|
|
|
SEARCH on $(source) += $(SEARCH_SOURCE) ;
|
|
|
|
MakeLocateArch $(header) ;
|
|
|
|
LocalClean clean : $(header) ;
|
|
|
|
|
|
|
|
HDRRULE on $(source) = HdrRule ;
|
|
|
|
HDRSCAN on $(source) = $(HDRPATTERN) ;
|
|
|
|
HDRSEARCH on $(source) = $(headers) $(sysHeaders) $(STDHDRS) ;
|
|
|
|
HDRGRIST on $(source) = $(HDRGRIST) ;
|
|
|
|
|
|
|
|
C++FLAGS on $(header) = $(flags) ;
|
|
|
|
CCHDRS on $(header) = [ FIncludes $(headers) : $(localIncludesOption) ]
|
|
|
|
$(includesSeparator)
|
|
|
|
[ FSysIncludes $(sysHeaders) : $(systemIncludesOption) ] ;
|
|
|
|
CCDEFS on $(header) = [ FDefines $(defines) ] ;
|
|
|
|
|
|
|
|
CreateAsmStructOffsetsHeader1 $(header) : $(source) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
actions CreateAsmStructOffsetsHeader1
|
|
|
|
{
|
|
|
|
$(C++) -S "$(2)" $(C++FLAGS) $(CCDEFS) $(CCHDRS) -o - \
|
2008-06-22 05:12:44 +04:00
|
|
|
| grep "#define" | sed -e 's/[\$\#]\([0-9]\)/\1/' > "$(1)"
|
2008-01-11 03:36:44 +03:00
|
|
|
}
|
2005-11-27 16:31:50 +03:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
rule MergeObjectFromObjects
|
|
|
|
{
|
|
|
|
# MergeObjectFromObjects <name> : <objects> : <other objects> ;
|
|
|
|
# Merges object files to an object file.
|
|
|
|
# <name>: Name of the object file to create. No grist will be added.
|
|
|
|
# <objects>: Object files to be merged. Grist will be added.
|
|
|
|
# <other objects>: Object files or static libraries to be merged. No grist
|
|
|
|
# will be added.
|
|
|
|
#
|
|
|
|
local objects = [ FGristFiles $(2) ] ;
|
|
|
|
|
|
|
|
on $(1) {
|
|
|
|
if ! $(PLATFORM) in $(SUPPORTED_PLATFORMS) {
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
|
|
|
if $(PLATFORM) = host {
|
|
|
|
LINK on $(1) = $(HOST_LD) ;
|
2007-08-23 02:07:03 +04:00
|
|
|
LINKFLAGS on $(target) = $(HOST_LDFLAGS) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
} else {
|
2013-08-01 10:51:16 +04:00
|
|
|
LINK on $(1) = $(TARGET_LD_$(TARGET_PACKAGING_ARCH)) ;
|
|
|
|
LINKFLAGS on $(target)
|
|
|
|
= $(TARGET_LDFLAGS_$(TARGET_PACKAGING_ARCH)) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
MakeLocateDebug $(1) ;
|
|
|
|
Depends $(1) : $(objects) ;
|
|
|
|
Depends $(1) : $(3) ;
|
|
|
|
LocalDepends obj : $(1) ;
|
|
|
|
MergeObjectFromObjects1 $(1) : $(objects) $(3) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
actions MergeObjectFromObjects1
|
|
|
|
{
|
2007-08-23 02:07:03 +04:00
|
|
|
$(LINK) $(LINKFLAGS) -r $(2) -o $(1) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
rule MergeObject
|
|
|
|
{
|
|
|
|
# MergeObject <name> : <sources> : <other objects> ;
|
|
|
|
# Compiles source files and merges the object files to an object file.
|
|
|
|
# <name>: Name of the object file to create. No grist will be added.
|
|
|
|
# <sources>: Sources to be compiled. Grist will be added.
|
|
|
|
# <other objects>: Object files or static libraries to be merged. No grist
|
|
|
|
# will be added.
|
|
|
|
#
|
|
|
|
local target = $(1) ;
|
|
|
|
local sources = [ FGristFiles $(2) ] ;
|
|
|
|
local otherObjects = $(3) ;
|
|
|
|
local objects = $(sources:S=$(SUFOBJ)) ;
|
|
|
|
|
|
|
|
if ! [ IsPlatformSupportedForTarget $(1) ] {
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
|
|
|
InheritPlatform $(objects) : $(target) ;
|
|
|
|
Objects $(sources) ;
|
|
|
|
MergeObjectFromObjects $(target) : $(objects) : $(otherObjects) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule SharedLibraryFromObjects
|
|
|
|
{
|
|
|
|
# SharedLibraryFromObjects <lib> : <objects> : <libraries> ;
|
|
|
|
#
|
|
|
|
local _lib = $(1) ;
|
|
|
|
|
|
|
|
if ! [ IsPlatformSupportedForTarget $(1) ] {
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
2009-12-28 03:06:11 +03:00
|
|
|
local soname = [ on $(_lib) return $(HAIKU_SONAME) ] ;
|
|
|
|
soname ?= $(_lib:BS) ;
|
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
MainFromObjects $(_lib) : $(2) ;
|
|
|
|
LINKFLAGS on $(_lib) = [ on $(_lib) return $(LINKFLAGS) ]
|
2013-04-24 22:27:55 +04:00
|
|
|
-shared -Xlinker -soname=\"$(soname)\" ;
|
2005-10-29 20:27:43 +04:00
|
|
|
LinkAgainst $(_lib) : $(3) ;
|
|
|
|
|
|
|
|
AddSharedObjectGlueCode $(_lib) : false ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule SharedLibrary
|
|
|
|
{
|
2010-02-01 02:41:44 +03:00
|
|
|
# SharedLibrary <lib> : <sources> : <libraries> : <abiVersion> ;
|
2005-10-29 20:27:43 +04:00
|
|
|
local lib = $(1) ;
|
|
|
|
local sources = [ FGristFiles $(2) ] ;
|
|
|
|
local objects = $(sources:S=$(SUFOBJ)) ;
|
|
|
|
local libs = $(3) ;
|
2010-02-01 02:41:44 +03:00
|
|
|
local abiVersion = $(4) ; # major ABI (soname) version for lib (if any)
|
2005-10-29 20:27:43 +04:00
|
|
|
|
|
|
|
if ! [ IsPlatformSupportedForTarget $(1) ] {
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
2010-02-01 02:41:44 +03:00
|
|
|
if $(abiVersion) {
|
|
|
|
HAIKU_SONAME on $(lib) = $(lib:BS).$(abiVersion) ;
|
|
|
|
HAIKU_LIB_ABI_VERSION on $(lib) = $(abiVersion) ;
|
2010-01-28 02:13:49 +03:00
|
|
|
}
|
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
InheritPlatform $(objects) : $(lib) ;
|
|
|
|
Objects $(sources) ;
|
|
|
|
SharedLibraryFromObjects $(lib) : $(objects) : $(libs) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule LinkAgainst
|
|
|
|
{
|
* Reintroduced third LinkAgainst parameter <mapLibs>, defaulting to true.
Library names are now mapped for all targets but "host" (not only for
"haiku") -- added one more level of indirection to achieve that.
(TARGET_LIBRARY_NAME_MAP -> *_LIBRARY_NAME_MAP_*).
* Renamed build/HaikuBuildCompatibility.h to BeOSBuildCompatibility.h
(auto-included when compiling something that uses the Be API for platform
"host" on anon-BeOS platform), and introduced build/HaikuBuildCompatibility.h,
which can be included when compiling something that can be built for both,
Haiku and BeOS compatible platforms.
* Introduced libhaikucompat.a, a library that adds a few functions existing
under Haiku, but not under BeOS.
* New rule AddSubDirSupportedPlatforms.
* Renamed libopenbeos.so to libbe_haiku.so.
* Introduced new target platform "libbe_test", which is basically equivalent
to a BeOS compatible host platform target, with the exception, that instead
of the host platform's libbe.so a special build of Haiku's libbe.so
(libbe_haiku.so (formerly known as libopenbeos.so)) is used. Furthermore
Haiku's public app, interface, storage, and support kit headers are used
when compiling. This replaces the less nice way in which the test app server
and applications for this test environment were built.
When building for platform "libbe_test", the library name "be" is
autotranslated to "libbe_haiku.so". Thus most applications don't need
special fiddling when them building them for the app server test environment;
usually an "AddSubDirSupportedPlatforms libbe_test ;" will suffice.
* Reduced the dependencies of <syscalls.h> and fixed problems caused by this
(e.g. source files not including the needed headers directly).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14749 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-07 19:07:25 +03:00
|
|
|
# LinkAgainst <name> : <libs> [ : <mapLibs> ] ;
|
|
|
|
# Valid elements for <libs> are e.g. "be" or "libtranslation.so" or
|
2005-10-29 20:27:43 +04: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
|
|
|
|
# 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.
|
* Reintroduced third LinkAgainst parameter <mapLibs>, defaulting to true.
Library names are now mapped for all targets but "host" (not only for
"haiku") -- added one more level of indirection to achieve that.
(TARGET_LIBRARY_NAME_MAP -> *_LIBRARY_NAME_MAP_*).
* Renamed build/HaikuBuildCompatibility.h to BeOSBuildCompatibility.h
(auto-included when compiling something that uses the Be API for platform
"host" on anon-BeOS platform), and introduced build/HaikuBuildCompatibility.h,
which can be included when compiling something that can be built for both,
Haiku and BeOS compatible platforms.
* Introduced libhaikucompat.a, a library that adds a few functions existing
under Haiku, but not under BeOS.
* New rule AddSubDirSupportedPlatforms.
* Renamed libopenbeos.so to libbe_haiku.so.
* Introduced new target platform "libbe_test", which is basically equivalent
to a BeOS compatible host platform target, with the exception, that instead
of the host platform's libbe.so a special build of Haiku's libbe.so
(libbe_haiku.so (formerly known as libopenbeos.so)) is used. Furthermore
Haiku's public app, interface, storage, and support kit headers are used
when compiling. This replaces the less nice way in which the test app server
and applications for this test environment were built.
When building for platform "libbe_test", the library name "be" is
autotranslated to "libbe_haiku.so". Thus most applications don't need
special fiddling when them building them for the app server test environment;
usually an "AddSubDirSupportedPlatforms libbe_test ;" will suffice.
* Reduced the dependencies of <syscalls.h> and fixed problems caused by this
(e.g. source files not including the needed headers directly).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14749 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-07 19:07:25 +03:00
|
|
|
# <mapLibs> specifies whether the to translate library names (e.g. "be"
|
|
|
|
# to "libbe.so" in case of target platform "haiku"). Defaults to "true".
|
2005-10-29 20:27:43 +04:00
|
|
|
#
|
|
|
|
local target = $(1) ;
|
|
|
|
local libs = $(2) ;
|
* Reintroduced third LinkAgainst parameter <mapLibs>, defaulting to true.
Library names are now mapped for all targets but "host" (not only for
"haiku") -- added one more level of indirection to achieve that.
(TARGET_LIBRARY_NAME_MAP -> *_LIBRARY_NAME_MAP_*).
* Renamed build/HaikuBuildCompatibility.h to BeOSBuildCompatibility.h
(auto-included when compiling something that uses the Be API for platform
"host" on anon-BeOS platform), and introduced build/HaikuBuildCompatibility.h,
which can be included when compiling something that can be built for both,
Haiku and BeOS compatible platforms.
* Introduced libhaikucompat.a, a library that adds a few functions existing
under Haiku, but not under BeOS.
* New rule AddSubDirSupportedPlatforms.
* Renamed libopenbeos.so to libbe_haiku.so.
* Introduced new target platform "libbe_test", which is basically equivalent
to a BeOS compatible host platform target, with the exception, that instead
of the host platform's libbe.so a special build of Haiku's libbe.so
(libbe_haiku.so (formerly known as libopenbeos.so)) is used. Furthermore
Haiku's public app, interface, storage, and support kit headers are used
when compiling. This replaces the less nice way in which the test app server
and applications for this test environment were built.
When building for platform "libbe_test", the library name "be" is
autotranslated to "libbe_haiku.so". Thus most applications don't need
special fiddling when them building them for the app server test environment;
usually an "AddSubDirSupportedPlatforms libbe_test ;" will suffice.
* Reduced the dependencies of <syscalls.h> and fixed problems caused by this
(e.g. source files not including the needed headers directly).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14749 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-07 19:07:25 +03:00
|
|
|
local mapLibs = $(3:E=true) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
|
|
|
on $(target) {
|
|
|
|
# map libraries, if desired and target platform is Haiku
|
2013-08-01 10:51:16 +04:00
|
|
|
local map = $(TARGET_LIBRARY_NAME_MAP_$(TARGET_PACKAGING_ARCH)) ;
|
|
|
|
if $(PLATFORM) != host && $(mapLibs) = true && $(map) {
|
2005-10-29 20:27:43 +04:00
|
|
|
local mappedLibs ;
|
|
|
|
|
|
|
|
for i in $(libs) {
|
2013-08-01 10:51:16 +04:00
|
|
|
local mapped = $($(map)_$(i)) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
mapped ?= $(i) ;
|
|
|
|
mappedLibs += $(mapped) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
libs = $(mappedLibs) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
local linkLibs ;
|
|
|
|
local needLibs ;
|
|
|
|
|
|
|
|
for i in $(libs)
|
|
|
|
{
|
|
|
|
local isfile = ;
|
|
|
|
if $(i:D) || $(i:G) {
|
|
|
|
isfile = true ;
|
|
|
|
if $(i:G) = <nogrist> {
|
|
|
|
i = $(i:G=) ;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
switch $(i:B)
|
|
|
|
{
|
|
|
|
# XXX: _APP_ and _KERNEL_ should not be needed for ELF.
|
|
|
|
case _APP_ : isfile = true ;
|
|
|
|
case _KERNEL_ : isfile = true ;
|
|
|
|
case lib* : isfile = true ;
|
|
|
|
case * : isfile = ;
|
|
|
|
}
|
|
|
|
if ! $(isfile) && ( $(i:S) = .so || $(i:S) = .a ) {
|
|
|
|
isfile = true ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if $(isfile) {
|
|
|
|
needLibs += $(i) ;
|
|
|
|
} else {
|
|
|
|
linkLibs += $(i) ;
|
|
|
|
}
|
|
|
|
}
|
2007-08-23 02:07:03 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
NEEDLIBS on $(1) = $(NEEDLIBS) $(needLibs) ;
|
|
|
|
LINKLIBS on $(1) = $(LINKLIBS) -l$(linkLibs) ;
|
|
|
|
|
|
|
|
if $(needLibs) && ! $(NO_LIBRARY_DEPENDENCIES) {
|
|
|
|
Depends $(1) : $(needLibs) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rule AddResources
|
|
|
|
{
|
|
|
|
# AddResources <name> : <resourcefiles> ;
|
|
|
|
|
|
|
|
# add grist to the resource files which don't have any yet
|
|
|
|
local resfiles ;
|
|
|
|
local file ;
|
|
|
|
for file in $(2) {
|
|
|
|
if ! $(file:G) {
|
|
|
|
file = [ FGristFiles $(file) ] ;
|
|
|
|
}
|
|
|
|
resfiles += $(file) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
SEARCH on $(resfiles) += $(SEARCH_SOURCE) ;
|
|
|
|
|
|
|
|
for file in $(resfiles) {
|
|
|
|
if $(file:S) = .rdef {
|
|
|
|
local rdef = $(file) ;
|
|
|
|
file = $(rdef:S=.rsrc) ;
|
|
|
|
ResComp $(file) : $(rdef) ;
|
|
|
|
}
|
2006-08-06 16:38:30 +04:00
|
|
|
InheritPlatform $(file) : $(1) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
RESFILES on $(1) += $(file) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-22 18:51:16 +04:00
|
|
|
rule SetVersionScript target : versionScript
|
|
|
|
{
|
|
|
|
# SetVersionScript <target> : <versionScript>
|
|
|
|
#
|
|
|
|
# Sets the version script for <target>. Grist will be added to
|
|
|
|
# <versionScript> and SEARCH will be set on it.
|
|
|
|
|
|
|
|
versionScript = [ FGristFiles $(versionScript) ] ;
|
|
|
|
|
|
|
|
SEARCH on $(versionScript) += $(SEARCH_SOURCE) ;
|
|
|
|
|
|
|
|
VERSION_SCRIPT on $(target) = $(versionScript) ;
|
|
|
|
Depends $(target) : $(versionScript) ;
|
|
|
|
}
|
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
rule BuildPlatformObjects
|
|
|
|
{
|
|
|
|
# Usage BuildPlatformObjects <sources> ;
|
|
|
|
# <sources> The sources.
|
2007-08-23 02:07:03 +04:00
|
|
|
#
|
2005-10-29 20:27:43 +04:00
|
|
|
local sources = [ FGristFiles $(1) ] ;
|
|
|
|
local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
|
2007-08-23 02:07:03 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
PLATFORM on $(objects) = host ;
|
|
|
|
SUPPORTED_PLATFORMS on $(objects) = host ;
|
|
|
|
|
|
|
|
Objects $(sources) ;
|
|
|
|
}
|
|
|
|
|
2008-07-24 02:20:37 +04:00
|
|
|
actions CygwinExtensionFix
|
|
|
|
{
|
|
|
|
if test -f $(1).exe ; then
|
|
|
|
rm -f $(1)
|
|
|
|
mv $(1).exe $(1)
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
rule BuildPlatformMain
|
|
|
|
{
|
|
|
|
# Usage BuildPlatformMain <target> : <sources> : <libraries> ;
|
|
|
|
# <target> The executable/library.
|
|
|
|
# <sources> The sources.
|
|
|
|
# <libraries> Libraries to link against.
|
2007-08-23 02:07:03 +04:00
|
|
|
#
|
2005-10-29 20:27:43 +04:00
|
|
|
local target = $(1) ;
|
|
|
|
local sources = $(2) ;
|
|
|
|
local libs = $(3) ;
|
|
|
|
local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
|
|
|
|
|
|
|
|
PLATFORM on $(target) = host ;
|
|
|
|
SUPPORTED_PLATFORMS on $(target) = host ;
|
|
|
|
DONT_USE_BEOS_RULES on $(target) = true ;
|
|
|
|
|
|
|
|
local usesBeAPI = [ on $(target) return $(USES_BE_API) ] ;
|
|
|
|
if $(usesBeAPI) {
|
|
|
|
# propagate the flag to the objects
|
|
|
|
USES_BE_API on $(objects) = $(usesBeAPI) ;
|
|
|
|
|
|
|
|
# add the build libroot
|
|
|
|
if ! $(HOST_PLATFORM_BEOS_COMPATIBLE) {
|
* BuildPlatformMain supports overriding HOST_LIBROOT on the target now,
so one can set it to the static libroot, if desired.
* Generic attribute emulation:
- Added build tool rm_attrs, a simple "rm" replacement, which also
removes the attributes directory for a given file.
- Added build/scripts/rm_attrs shell script, which wraps the
invocation of the rm_attrs tool. If it doesn't exist yet, the
ordinary rm is used.
- The RM jam variable refers to the rm_attrs script now, i.e. whenever
something is removed by the build system, the attributes are removed
too (if the build tool has already been built, that is).
- Removed the shell function attrrmrf() in build_haiku_image. We use
the rm_attrs tool instead, if necessary.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24528 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-23 00:05:03 +03:00
|
|
|
local libroot = [ on $(target) return $(HOST_LIBROOT) ] ;
|
|
|
|
Depends $(target) : $(libroot) ;
|
|
|
|
NEEDLIBS on $(target) += $(libroot) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
}
|
2007-08-23 02:07:03 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
Main $(target) : $(sources) ;
|
|
|
|
LinkAgainst $(target) : $(libs) ;
|
2008-07-24 02:20:37 +04:00
|
|
|
if $(HOST_PLATFORM) = cygwin {
|
|
|
|
# Cygwin gcc adds the ".exe" extension. We cannot force
|
|
|
|
# jam to use SUFEXE as haiku target executables are not
|
|
|
|
# supposed to have this extension, thus finding
|
|
|
|
# dependencies will fail for these.
|
|
|
|
# The hack is to remove the extension after a successful
|
|
|
|
# build of the Target.
|
|
|
|
CygwinExtensionFix $(target) ;
|
|
|
|
}
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
rule BuildPlatformSharedLibrary
|
|
|
|
{
|
|
|
|
# Usage BuildPlatformSharedLibrary <target> : <sources> : <libraries> ;
|
|
|
|
# <target> The library.
|
|
|
|
# <sources> The sources.
|
|
|
|
# <libraries> Libraries to link against.
|
|
|
|
#
|
|
|
|
local target = $(1) ;
|
|
|
|
local sources = $(2) ;
|
|
|
|
local libs = $(3) ;
|
2007-08-23 02:07:03 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
BuildPlatformMain $(target) : $(sources) : $(libs) ;
|
2007-05-18 19:59:04 +04:00
|
|
|
|
|
|
|
if $(HOST_PLATFORM) = darwin {
|
|
|
|
LINKFLAGS on $(target) = [ on $(target) return $(LINKFLAGS) ]
|
|
|
|
-dynamic -dynamiclib -Xlinker -flat_namespace ;
|
2008-07-24 02:20:37 +04:00
|
|
|
} else if $(HOST_PLATFORM) = cygwin {
|
|
|
|
LINKFLAGS on $(target) = [ on $(target) return $(LINKFLAGS) ]
|
|
|
|
-shared -Xlinker --allow-multiple-definition ;
|
2007-05-18 19:59:04 +04:00
|
|
|
} else {
|
|
|
|
LINKFLAGS on $(target) = [ on $(target) return $(LINKFLAGS) ]
|
|
|
|
-shared -Xlinker -soname=\"$(target:G=)\" ;
|
|
|
|
}
|
2007-06-16 23:43:53 +04:00
|
|
|
|
|
|
|
local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
|
2007-08-23 02:07:03 +04:00
|
|
|
CCFLAGS on $(objects) += $(HOST_PIC_CCFLAGS) ;
|
|
|
|
C++FLAGS on $(objects) += $(HOST_PIC_C++FLAGS) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
rule BuildPlatformMergeObject
|
|
|
|
{
|
|
|
|
# BuildPlatformMergeObject <name> : <sources> : <other objects> ;
|
|
|
|
# Compiles source files and merges the object files to an object file.
|
|
|
|
# <name>: Name of the object file to create. No grist will be added.
|
|
|
|
# <sources>: Sources to be compiled. Grist will be added.
|
|
|
|
# <other objects>: Object files or static libraries to be merged. No grist
|
|
|
|
# will be added.
|
|
|
|
#
|
|
|
|
local target = $(1) ;
|
|
|
|
local sources = $(2) ;
|
|
|
|
local otherObjects = $(3) ;
|
|
|
|
local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
|
2007-08-23 02:07:03 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
PLATFORM on $(target) = host ;
|
|
|
|
SUPPORTED_PLATFORMS on $(target) = host ;
|
|
|
|
|
|
|
|
local usesBeAPI = [ on $(target[1]) return $(USES_BE_API) ] ;
|
|
|
|
if $(usesBeAPI) {
|
|
|
|
# propagate the flag to the objects
|
|
|
|
USES_BE_API on $(objects) = $(usesBeAPI) ;
|
|
|
|
}
|
2007-06-16 23:43:53 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
MergeObject $(target) : $(sources) : $(otherObjects) ;
|
|
|
|
}
|
|
|
|
|
2007-06-17 19:14:46 +04:00
|
|
|
rule BuildPlatformMergeObjectPIC target : sources : otherObjects
|
2007-06-16 23:43:53 +04:00
|
|
|
{
|
|
|
|
# BuildPlatformMergeObjectPIC <name> : <sources> : <other objects> ;
|
|
|
|
# Compiles source files and merges the object files to an object file.
|
|
|
|
# Same as BuildPlatformMergeObject rule but adds position-independent
|
|
|
|
# flags to the compiler (if any).
|
|
|
|
# <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.
|
|
|
|
#
|
2007-06-17 19:14:46 +04:00
|
|
|
ObjectCcFlags $(sources) : $(HOST_PIC_CCFLAGS) ;
|
|
|
|
ObjectC++Flags $(sources) : $(HOST_PIC_C++FLAGS) ;
|
2007-06-16 23:43:53 +04:00
|
|
|
|
|
|
|
BuildPlatformMergeObject $(target) : $(sources) : $(otherObjects) ;
|
|
|
|
}
|
|
|
|
|
* BuildPlatformMain supports overriding HOST_LIBROOT on the target now,
so one can set it to the static libroot, if desired.
* Generic attribute emulation:
- Added build tool rm_attrs, a simple "rm" replacement, which also
removes the attributes directory for a given file.
- Added build/scripts/rm_attrs shell script, which wraps the
invocation of the rm_attrs tool. If it doesn't exist yet, the
ordinary rm is used.
- The RM jam variable refers to the rm_attrs script now, i.e. whenever
something is removed by the build system, the attributes are removed
too (if the build tool has already been built, that is).
- Removed the shell function attrrmrf() in build_haiku_image. We use
the rm_attrs tool instead, if necessary.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24528 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-23 00:05:03 +03:00
|
|
|
rule BuildPlatformStaticLibrary lib : sources : otherObjects
|
2005-10-29 20:27:43 +04:00
|
|
|
{
|
|
|
|
# BuildPlatformStaticLibrary <lib> : <sources> ;
|
|
|
|
# Creates a static library from sources.
|
* BuildPlatformMain supports overriding HOST_LIBROOT on the target now,
so one can set it to the static libroot, if desired.
* Generic attribute emulation:
- Added build tool rm_attrs, a simple "rm" replacement, which also
removes the attributes directory for a given file.
- Added build/scripts/rm_attrs shell script, which wraps the
invocation of the rm_attrs tool. If it doesn't exist yet, the
ordinary rm is used.
- The RM jam variable refers to the rm_attrs script now, i.e. whenever
something is removed by the build system, the attributes are removed
too (if the build tool has already been built, that is).
- Removed the shell function attrrmrf() in build_haiku_image. We use
the rm_attrs tool instead, if necessary.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24528 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-23 00:05:03 +03:00
|
|
|
# <lib>: The static library to be built.
|
2005-10-29 20:27:43 +04:00
|
|
|
# <sources>: List of source files.
|
* BuildPlatformMain supports overriding HOST_LIBROOT on the target now,
so one can set it to the static libroot, if desired.
* Generic attribute emulation:
- Added build tool rm_attrs, a simple "rm" replacement, which also
removes the attributes directory for a given file.
- Added build/scripts/rm_attrs shell script, which wraps the
invocation of the rm_attrs tool. If it doesn't exist yet, the
ordinary rm is used.
- The RM jam variable refers to the rm_attrs script now, i.e. whenever
something is removed by the build system, the attributes are removed
too (if the build tool has already been built, that is).
- Removed the shell function attrrmrf() in build_haiku_image. We use
the rm_attrs tool instead, if necessary.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24528 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-23 00:05:03 +03:00
|
|
|
# <otherObjects>: List of additional object files.
|
|
|
|
#
|
2007-08-23 02:07:03 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
|
2007-08-23 02:07:03 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
PLATFORM on $(lib) = host ;
|
|
|
|
SUPPORTED_PLATFORMS on $(lib) = host ;
|
|
|
|
|
|
|
|
local usesBeAPI = [ on $(lib) return $(USES_BE_API) ] ;
|
|
|
|
if $(usesBeAPI) {
|
|
|
|
# propagate the flag to the objects
|
|
|
|
USES_BE_API on $(objects) = $(usesBeAPI) ;
|
|
|
|
}
|
|
|
|
|
* BuildPlatformMain supports overriding HOST_LIBROOT on the target now,
so one can set it to the static libroot, if desired.
* Generic attribute emulation:
- Added build tool rm_attrs, a simple "rm" replacement, which also
removes the attributes directory for a given file.
- Added build/scripts/rm_attrs shell script, which wraps the
invocation of the rm_attrs tool. If it doesn't exist yet, the
ordinary rm is used.
- The RM jam variable refers to the rm_attrs script now, i.e. whenever
something is removed by the build system, the attributes are removed
too (if the build tool has already been built, that is).
- Removed the shell function attrrmrf() in build_haiku_image. We use
the rm_attrs tool instead, if necessary.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24528 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-23 00:05:03 +03:00
|
|
|
StaticLibrary $(lib) : $(sources) : $(otherObjects) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
2011-06-16 20:56:46 +04:00
|
|
|
rule BuildPlatformStaticLibraryPIC target : sources : otherObjects
|
|
|
|
{
|
|
|
|
# Like BuildPlatformStaticLibrary, but producing position independent code.
|
|
|
|
|
|
|
|
ObjectCcFlags $(sources) : $(HOST_PIC_CCFLAGS) ;
|
|
|
|
ObjectC++Flags $(sources) : $(HOST_PIC_C++FLAGS) ;
|
|
|
|
|
|
|
|
BuildPlatformStaticLibrary $(target) : $(sources) : $(otherObjects) ;
|
|
|
|
}
|