2005-10-29 20:27:43 +04:00
|
|
|
# Overridden to allow spaces in file names.
|
|
|
|
actions Chmod1
|
|
|
|
{
|
|
|
|
$(CHMOD) "$(MODE)" "$(1)"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Overridden to allow spaces in file names.
|
2013-09-30 05:28:36 +04:00
|
|
|
actions piecemeal together existing Clean
|
2005-10-29 20:27:43 +04:00
|
|
|
{
|
|
|
|
$(RM) "$(>)"
|
|
|
|
}
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------
|
2008-09-09 03:03:52 +04:00
|
|
|
# Link rule/action are overwritten as they don't handle linking files who's name
|
2005-10-29 20:27:43 +04:00
|
|
|
# contain spaces very well. Also adds resources and version to executable.
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
rule Link
|
|
|
|
{
|
|
|
|
# Note: RESFILES must be set before invocation.
|
|
|
|
|
|
|
|
if [ on $(1) return $(PLATFORM) ] = host {
|
|
|
|
LINK on $(1) = $(HOST_LINK) ;
|
|
|
|
LINKFLAGS on $(1) = $(HOST_LINKFLAGS) [ on $(1) return $(LINKFLAGS) ] ;
|
|
|
|
} else {
|
2013-08-01 10:51:16 +04:00
|
|
|
LINK on $(1) = $(TARGET_LINK_$(TARGET_PACKAGING_ARCH)) ;
|
|
|
|
LINKFLAGS on $(1) = $(TARGET_LINKFLAGS_$(TARGET_PACKAGING_ARCH))
|
2005-10-29 20:27:43 +04:00
|
|
|
[ on $(1) return $(LINKFLAGS) ] ;
|
|
|
|
}
|
|
|
|
|
|
|
|
NEEDLIBS on $(1) = [ on $(1) return $(NEEDLIBS) ] ;
|
|
|
|
LINKLIBS on $(1) = [ on $(1) return $(LINKLIBS) ] ;
|
2008-09-09 03:03:52 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
MODE on $(<) = $(EXEMODE) ;
|
|
|
|
on $(1) XRes $(1) : $(RESFILES) ;
|
|
|
|
if ! [ on $(1) return $(DONT_USE_BEOS_RULES) ] {
|
|
|
|
SetType $(1) ;
|
2013-05-09 05:38:10 +04:00
|
|
|
MimeSet $(1) : sharedObject ;
|
2005-10-29 20:27:43 +04:00
|
|
|
SetVersion $(1) ;
|
* 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
|
|
|
|
2013-05-09 05:38:10 +04:00
|
|
|
# For applications for the target also generate the MIME DB entries.
|
|
|
|
if [ on $(1) return $(PLATFORM) ] != host
|
|
|
|
&& [ on $(1) return $(RESFILES) ] {
|
|
|
|
CreateAppMimeDBEntries $(1) ;
|
|
|
|
}
|
|
|
|
|
* 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
|
|
|
# If the generic attribute emulation is enabled, make sure the tool to
|
|
|
|
# remove the attributes is built first.
|
|
|
|
if $(HOST_RM_ATTRS_TARGET) {
|
|
|
|
Depends $(1) : $(HOST_RM_ATTRS_TARGET) ;
|
|
|
|
}
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
2008-04-19 03:51:21 +04:00
|
|
|
Chmod $(<) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
2008-09-09 03:03:52 +04:00
|
|
|
# When using "real" attributes (i.e. BeOS attributes or xattr/extattr) on the
|
|
|
|
# host platform, unlinking the main target by gcc will also automatically get
|
|
|
|
# rid of the attributes. When using the generic attribute emulation, which
|
|
|
|
# uses separate files, we need to remove the target explicitely first, so that
|
|
|
|
# the attributes won't be "leaked".
|
|
|
|
if $(HOST_PLATFORM_BEOS_COMPATIBLE) || $(HAIKU_HOST_USE_XATTR) = 1 {
|
2009-05-22 18:51:16 +04:00
|
|
|
actions Link bind NEEDLIBS LINK_BEGIN_GLUE LINK_END_GLUE VERSION_SCRIPT
|
2008-09-09 03:03:52 +04:00
|
|
|
{
|
|
|
|
$(LINK) $(LINKFLAGS) -o "$(1)" $(UNDEFS) "$(LINK_BEGIN_GLUE)" "$(2)" \
|
2009-05-22 18:51:16 +04:00
|
|
|
"$(NEEDLIBS)" $(LINKLIBS) "$(LINK_END_GLUE)" \
|
|
|
|
-Wl,--version-script,$(VERSION_SCRIPT)
|
2008-09-09 03:03:52 +04:00
|
|
|
}
|
|
|
|
} else {
|
2009-05-22 18:51:16 +04:00
|
|
|
actions Link bind NEEDLIBS LINK_BEGIN_GLUE LINK_END_GLUE VERSION_SCRIPT
|
2008-09-09 03:03:52 +04:00
|
|
|
{
|
|
|
|
$(RM) "$(1)"
|
|
|
|
$(LINK) $(LINKFLAGS) -o "$(1)" $(UNDEFS) "$(LINK_BEGIN_GLUE)" "$(2)" \
|
2009-05-22 18:51:16 +04:00
|
|
|
"$(NEEDLIBS)" $(LINKLIBS) "$(LINK_END_GLUE)" \
|
|
|
|
-Wl,--version-script,$(VERSION_SCRIPT)
|
2008-09-09 03:03:52 +04:00
|
|
|
}
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
rule Object
|
|
|
|
{
|
|
|
|
# find out which headers and defines to use
|
|
|
|
local headers ;
|
|
|
|
local sysHeaders ;
|
|
|
|
local defines ;
|
2008-09-09 03:03:52 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
on $(1) { # use on $(1) variable values
|
|
|
|
if ! $(PLATFORM) in $(SUPPORTED_PLATFORMS) {
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Save HDRS for -I$(HDRS) on compile.
|
|
|
|
# We shouldn't need -I$(SEARCH_SOURCE) as cc can find headers
|
|
|
|
# in the .c file's directory, but generated .c files (from
|
|
|
|
# yacc, lex, etc) are located in $(LOCATE_TARGET), possibly
|
|
|
|
# different from $(SEARCH_SOURCE).
|
|
|
|
|
2008-03-28 01:01:38 +03:00
|
|
|
headers = $(HAIKU_CONFIG_HEADERS) $(SEARCH_SOURCE) $(SUBDIRHDRS)
|
|
|
|
$(HDRS) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
sysHeaders = $(SUBDIRSYSHDRS) $(SYSHDRS) ;
|
|
|
|
defines = $(DEFINES) ;
|
|
|
|
|
|
|
|
if $(PLATFORM) = host {
|
|
|
|
sysHeaders += $(HOST_HDRS) ;
|
|
|
|
defines += $(HOST_DEFINES) ;
|
2008-09-09 03:03:52 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
if $(USES_BE_API) {
|
|
|
|
sysHeaders += $(HOST_BE_API_HEADERS) ;
|
|
|
|
}
|
2008-09-09 03:03:52 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
} else {
|
2013-08-01 10:51:16 +04:00
|
|
|
sysHeaders += $(TARGET_HDRS_$(TARGET_PACKAGING_ARCH)) ;
|
|
|
|
defines += $(TARGET_DEFINES_$(TARGET_PACKAGING_ARCH))
|
|
|
|
$(TARGET_DEFINES) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# locate object and search for source
|
|
|
|
|
|
|
|
LocalClean clean : $(<) ;
|
|
|
|
|
|
|
|
MakeLocateDebug $(<) ;
|
|
|
|
SEARCH on $(>) = $(SEARCH_SOURCE) ;
|
|
|
|
|
|
|
|
HDRS on $(<) = $(headers) ;
|
|
|
|
SYSHDRS on $(<) = $(sysHeaders) ;
|
|
|
|
|
|
|
|
# handle #includes for source: Jam scans for headers with
|
|
|
|
# the regexp pattern $(HDRSCAN) and then invokes $(HDRRULE)
|
|
|
|
# with the scanned file as the target and the found headers
|
|
|
|
# as the sources. HDRSEARCH is the value of SEARCH used for
|
2008-09-09 03:03:52 +04:00
|
|
|
# the found header files. Finally, if jam must deal with
|
2005-10-29 20:27:43 +04:00
|
|
|
# header files of the same name in different directories,
|
|
|
|
# they can be distinguished with HDRGRIST.
|
|
|
|
|
2008-09-09 03:03:52 +04:00
|
|
|
# $(SEARCH_SOURCE:E) is where cc first looks for #include
|
|
|
|
# "foo.h" files. If the source file is in a distant directory,
|
2005-10-29 20:27:43 +04:00
|
|
|
# look there. Else, look in "" (the current directory).
|
|
|
|
|
|
|
|
HDRRULE on $(>) = HdrRule ;
|
|
|
|
HDRSCAN on $(>) = $(HDRPATTERN) ;
|
|
|
|
HDRSEARCH on $(>) = $(headers) $(sysHeaders) $(STDHDRS) ;
|
|
|
|
HDRGRIST on $(>) = $(HDRGRIST) ;
|
|
|
|
|
|
|
|
# propagate target specific-defines
|
|
|
|
|
|
|
|
DEFINES on $(1) = $(defines) ;
|
|
|
|
|
|
|
|
# if source is not .c, generate .c with specific rule
|
|
|
|
|
|
|
|
switch $(>:S)
|
|
|
|
{
|
|
|
|
case .asm : As $(<) : $(>) ;
|
2009-03-30 13:33:33 +04:00
|
|
|
case .nasm : AssembleNasm $(<) : $(>) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
case .c : Cc $(<) : $(>) ;
|
|
|
|
case .C : C++ $(<) : $(>) ;
|
|
|
|
case .cc : C++ $(<) : $(>) ;
|
|
|
|
case .cpp : C++ $(<) : $(>) ;
|
|
|
|
case .f : Fortran $(<) : $(>) ;
|
|
|
|
case .l : if [ on $(2) return $(GENERATE_C++) ] {
|
2005-10-31 17:14:05 +03:00
|
|
|
InheritPlatform $(<:S=.cpp) : $(1) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
C++ $(<) : $(<:S=.cpp) ;
|
|
|
|
Lex $(<:S=.cpp) : $(>) ;
|
|
|
|
} else {
|
2005-10-31 17:14:05 +03:00
|
|
|
InheritPlatform $(<:S=.c) : $(1) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
Cc $(<) : $(<:S=.c) ;
|
|
|
|
Lex $(<:S=.c) : $(>) ;
|
|
|
|
}
|
|
|
|
case *.o : return ;
|
|
|
|
case .s : As $(<) : $(>) ;
|
|
|
|
case .S : As $(<) : $(>) ;
|
|
|
|
case .y : if [ on $(2) return $(GENERATE_C++) ] {
|
2005-10-31 17:14:05 +03:00
|
|
|
InheritPlatform $(1:S=.cpp) $(1:S=.hpp) : $(1) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
C++ $(1) : $(1:S=.cpp) ;
|
|
|
|
Yacc $(1:S=.cpp) $(1:S=.hpp) : $(2) ;
|
|
|
|
} else {
|
2005-10-31 17:14:05 +03:00
|
|
|
InheritPlatform $(1:S=.c) $(1:S=.h) : $(1) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
Cc $(1) : $(1:S=.c) ;
|
|
|
|
Yacc $(1:S=.c) $(1:S=.h) : $(2) ;
|
|
|
|
}
|
|
|
|
case * : UserObject $(<) : $(>) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rule As
|
|
|
|
{
|
|
|
|
local flags ;
|
2005-11-13 01:58:54 +03:00
|
|
|
local includesSeparator ;
|
|
|
|
local localIncludesOption ;
|
|
|
|
local systemIncludesOption ;
|
2005-10-29 20:27:43 +04:00
|
|
|
if [ on $(1) return $(PLATFORM) ] = host {
|
|
|
|
flags = [ on $(1) return $(HOST_ASFLAGS) $(ASFLAGS) ] ;
|
2008-09-09 03:03:52 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
CC on $(1) = $(HOST_CC) ;
|
|
|
|
|
2005-11-13 01:58:54 +03:00
|
|
|
includesSeparator = $(HOST_INCLUDES_SEPARATOR) ;
|
|
|
|
localIncludesOption = $(HOST_LOCAL_INCLUDES_OPTION) ;
|
|
|
|
systemIncludesOption = $(HOST_SYSTEM_INCLUDES_OPTION) ;
|
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
} else {
|
2013-08-01 10:51:16 +04:00
|
|
|
flags = [ on $(1) return $(TARGET_ASFLAGS_$(architecture))
|
|
|
|
$(ASFLAGS) ] ;
|
2008-09-09 03:03:52 +04:00
|
|
|
|
2013-08-01 10:51:16 +04:00
|
|
|
CC on $(1) = $(TARGET_CC_$(TARGET_PACKAGING_ARCH)) ;
|
2005-11-13 01:58:54 +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)) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
Depends $(<) : $(>) ;
|
|
|
|
ASFLAGS on $(<) += $(flags) $(SUBDIRASFLAGS) ;
|
2005-11-13 01:58:54 +03:00
|
|
|
ASHDRS on $(<) = [ on $(<) FIncludes $(HDRS) : $(localIncludesOption) ]
|
|
|
|
$(includesSeparator)
|
|
|
|
[ on $(<) FSysIncludes $(SYSHDRS) : $(systemIncludesOption) ] ;
|
2005-10-29 20:27:43 +04:00
|
|
|
ASDEFS on $(<) = [ on $(<) FDefines $(DEFINES) ] ;
|
|
|
|
}
|
|
|
|
|
|
|
|
# TODO: The KERNEL_CCFLAGS were used here before. Check whether we need any
|
|
|
|
# flags we don't have now.
|
|
|
|
actions As
|
|
|
|
{
|
|
|
|
$(CC) -c "$(2)" -O2 $(ASFLAGS) -D_ASSEMBLER $(ASDEFS) $(ASHDRS) -o "$(1)" ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule Lex
|
|
|
|
{
|
|
|
|
Depends $(1) : $(2) ;
|
|
|
|
MakeLocateArch $(1) ;
|
|
|
|
LocalClean clean : $(1) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
actions Lex
|
|
|
|
{
|
2006-12-17 22:53:01 +03:00
|
|
|
$(LEX) $(LEXFLAGS) -o$(1) $(2)
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
rule Yacc
|
|
|
|
{
|
|
|
|
local source = $(1[1]) ;
|
|
|
|
local header = $(1[2]) ;
|
|
|
|
local yaccSource = $(2) ;
|
|
|
|
|
|
|
|
MakeLocateArch $(source) $(header) ;
|
|
|
|
|
|
|
|
Depends $(source) $(header) : $(yaccSource) ;
|
|
|
|
Yacc1 $(source) $(header) : $(yaccSource) ;
|
|
|
|
LocalClean clean : $(source) $(header) ;
|
|
|
|
|
|
|
|
# make sure someone includes $(header) else it will be
|
|
|
|
# a deadly independent target
|
|
|
|
|
|
|
|
Includes $(source) : $(header) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
actions Yacc1
|
|
|
|
{
|
|
|
|
bison $(YACCFLAGS) -o $(1[1]) $(2)
|
|
|
|
[ -f $(1[1]).h ] && mv $(1[1]).h $(1[2]) || true
|
|
|
|
}
|
|
|
|
|
|
|
|
rule Cc
|
|
|
|
{
|
|
|
|
Depends $(<) : $(>) ;
|
|
|
|
|
|
|
|
on $(1) {
|
|
|
|
local flags ;
|
2005-11-13 01:58:54 +03:00
|
|
|
local includesSeparator ;
|
|
|
|
local localIncludesOption ;
|
|
|
|
local systemIncludesOption ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
|
|
|
# optimization flags
|
|
|
|
if $(DEBUG) = 0 {
|
|
|
|
flags += $(OPTIM) ;
|
|
|
|
} else {
|
|
|
|
flags += -O0 ;
|
|
|
|
}
|
|
|
|
|
|
|
|
if $(PLATFORM) = host {
|
|
|
|
# warning flags
|
|
|
|
if $(WARNINGS) != 0 {
|
|
|
|
flags += $(HOST_WARNING_CCFLAGS) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
# debug and other flags
|
|
|
|
flags += $(HOST_CCFLAGS) $(HOST_DEBUG_$(DEBUG)_CCFLAGS)
|
|
|
|
$(SUBDIRCCFLAGS) $(CCFLAGS) ;
|
|
|
|
|
|
|
|
if $(USES_BE_API) {
|
|
|
|
flags += $(HOST_BE_API_CCFLAGS) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
CC on $(1) = $(HOST_CC) ;
|
|
|
|
|
2005-11-13 01:58:54 +03:00
|
|
|
includesSeparator = $(HOST_INCLUDES_SEPARATOR) ;
|
|
|
|
localIncludesOption = $(HOST_LOCAL_INCLUDES_OPTION) ;
|
|
|
|
systemIncludesOption = $(HOST_SYSTEM_INCLUDES_OPTION) ;
|
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
} else {
|
|
|
|
# warning flags
|
|
|
|
if $(WARNINGS) != 0 {
|
2013-08-01 10:51:16 +04:00
|
|
|
flags += $(TARGET_WARNING_CCFLAGS_$(TARGET_PACKAGING_ARCH)) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
# debug and other flags
|
2013-08-01 10:51:16 +04:00
|
|
|
flags += $(TARGET_CCFLAGS_$(TARGET_PACKAGING_ARCH))
|
|
|
|
$(TARGET_DEBUG_$(DEBUG)_CCFLAGS_$(TARGET_PACKAGING_ARCH))
|
2005-10-29 20:27:43 +04:00
|
|
|
$(SUBDIRCCFLAGS) $(CCFLAGS) ;
|
|
|
|
|
2013-08-01 10:51:16 +04:00
|
|
|
CC on $(1) = $(TARGET_CC_$(TARGET_PACKAGING_ARCH)) ;
|
2005-11-13 01:58:54 +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)) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
CCFLAGS on $(<) = $(flags) ;
|
2005-11-13 01:58:54 +03:00
|
|
|
CCHDRS on $(<) = [ FIncludes $(HDRS) : $(localIncludesOption) ]
|
|
|
|
$(includesSeparator)
|
|
|
|
[ FSysIncludes $(SYSHDRS) : $(systemIncludesOption) ] ;
|
2005-10-29 20:27:43 +04:00
|
|
|
CCDEFS on $(<) = [ FDefines $(DEFINES) ] ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-09-09 03:03:52 +04:00
|
|
|
actions Cc
|
2005-10-29 20:27:43 +04:00
|
|
|
{
|
|
|
|
$(CC) $(CCFLAGS) -c "$(2)" $(CCDEFS) $(CCHDRS) -o "$(1)" ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule C++
|
|
|
|
{
|
|
|
|
Depends $(<) : $(>) ;
|
|
|
|
|
|
|
|
on $(1) {
|
|
|
|
local flags ;
|
2005-11-13 01:58:54 +03:00
|
|
|
local includesSeparator ;
|
|
|
|
local localIncludesOption ;
|
|
|
|
local systemIncludesOption ;
|
2008-09-09 03:03:52 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
# optimization flags
|
|
|
|
if $(DEBUG) = 0 {
|
|
|
|
flags += $(OPTIM) ;
|
|
|
|
} else {
|
|
|
|
flags += -O0 ;
|
|
|
|
}
|
2008-09-09 03:03:52 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
if $(PLATFORM) = host {
|
|
|
|
# warning flags
|
|
|
|
if $(WARNINGS) != 0 {
|
|
|
|
flags += $(HOST_WARNING_C++FLAGS) ;
|
|
|
|
}
|
2008-09-09 03:03:52 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
# debug and other flags
|
|
|
|
flags += $(HOST_C++FLAGS) $(HOST_DEBUG_$(DEBUG)_C++FLAGS)
|
|
|
|
$(SUBDIRC++FLAGS) $(C++FLAGS) ;
|
2008-09-09 03:03:52 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
if $(USES_BE_API) {
|
|
|
|
flags += $(HOST_BE_API_C++FLAGS) ;
|
|
|
|
}
|
2008-09-09 03:03:52 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
C++ on $(1) = $(HOST_C++) ;
|
2008-09-09 03:03:52 +04:00
|
|
|
|
2005-11-13 01:58:54 +03:00
|
|
|
includesSeparator = $(HOST_INCLUDES_SEPARATOR) ;
|
|
|
|
localIncludesOption = $(HOST_LOCAL_INCLUDES_OPTION) ;
|
|
|
|
systemIncludesOption = $(HOST_SYSTEM_INCLUDES_OPTION) ;
|
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
} else {
|
|
|
|
# warning flags
|
|
|
|
if $(WARNINGS) != 0 {
|
2013-08-01 10:51:16 +04:00
|
|
|
flags += $(TARGET_WARNING_C++FLAGS_$(TARGET_PACKAGING_ARCH)) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
2008-09-09 03:03:52 +04:00
|
|
|
|
2005-10-29 20:27:43 +04: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))
|
2005-10-29 20:27:43 +04:00
|
|
|
$(SUBDIRC++FLAGS) $(C++FLAGS) ;
|
2008-09-09 03:03:52 +04:00
|
|
|
|
2013-08-01 10:51:16 +04:00
|
|
|
C++ on $(1) = $(TARGET_C++_$(TARGET_PACKAGING_ARCH)) ;
|
2005-11-13 01:58:54 +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)) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
2008-09-09 03:03:52 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
C++FLAGS on $(<) = $(flags) ;
|
2005-11-13 01:58:54 +03:00
|
|
|
CCHDRS on $(<) = [ FIncludes $(HDRS) : $(localIncludesOption) ]
|
|
|
|
$(includesSeparator)
|
|
|
|
[ FSysIncludes $(SYSHDRS) : $(systemIncludesOption) ] ;
|
2005-10-29 20:27:43 +04:00
|
|
|
CCDEFS on $(<) = [ FDefines $(DEFINES) ] ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
actions C++
|
|
|
|
{
|
|
|
|
$(C++) -c "$(2)" $(C++FLAGS) $(CCDEFS) $(CCHDRS) -o "$(1)" ;
|
|
|
|
}
|
|
|
|
|
2007-02-18 01:42:16 +03:00
|
|
|
actions together Archive
|
|
|
|
{
|
|
|
|
# Force recreation of the archive to avoid build errors caused by
|
|
|
|
# stale dependencies after renaming or deleting object files.
|
|
|
|
$(RM) $(<)
|
|
|
|
$(AR) $(<) $(>)
|
|
|
|
}
|
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
rule Library
|
|
|
|
{
|
|
|
|
local lib = $(1) ;
|
|
|
|
local sources = [ FGristFiles $(2) ] ;
|
|
|
|
local objects = $(sources:S=$(SUFOBJ)) ;
|
|
|
|
|
|
|
|
InheritPlatform $(objects) : $(lib) ;
|
|
|
|
LibraryFromObjects $(lib) : $(objects) ;
|
|
|
|
Objects $(sources) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule LibraryFromObjects
|
|
|
|
{
|
|
|
|
local _i _l _s ;
|
|
|
|
|
|
|
|
# Add grist to file names
|
|
|
|
# bonefish: No, don't. The Library rule does that anyway, and when we
|
|
|
|
# have an object from another dir, we certainly don't want that.
|
|
|
|
|
|
|
|
_s = $(>) ;
|
|
|
|
_l = $(<:S=$(SUFLIB)) ;
|
|
|
|
|
|
|
|
on $(_l) {
|
|
|
|
# set the tools according to the platform
|
|
|
|
if $(PLATFORM) = host {
|
2005-11-19 03:57:21 +03:00
|
|
|
AR on $(_l) = $(HOST_AR) $(HOST_ARFLAGS) ;
|
|
|
|
RANLIB on $(_l) = $(HOST_RANLIB) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
} else {
|
2013-08-01 10:51:16 +04:00
|
|
|
AR on $(_l) = $(TARGET_AR_$(TARGET_PACKAGING_ARCH))
|
|
|
|
$(TARGET_ARFLAGS_$(TARGET_PACKAGING_ARCH)) ;
|
|
|
|
RANLIB on $(_l) = $(TARGET_RANLIB_$(TARGET_PACKAGING_ARCH)) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
2008-09-09 03:03:52 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
# library depends on its member objects
|
2008-09-09 03:03:52 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
if $(KEEPOBJS)
|
|
|
|
{
|
|
|
|
LocalDepends obj : $(_s) ;
|
|
|
|
}
|
2008-09-09 03:03:52 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
LocalDepends lib : $(_l) ;
|
2008-09-09 03:03:52 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
# 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.
|
2008-09-09 03:03:52 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
if ! $(_l:D)
|
|
|
|
{
|
|
|
|
# locate the library only, if it hasn't been located yet
|
|
|
|
local dir = $(LOCATE[1]) ;
|
|
|
|
if ! $(dir) {
|
|
|
|
MakeLocateDebug $(_l) ;
|
|
|
|
dir = [ on $(_l) return $(LOCATE[1]) ] ;
|
|
|
|
# Note: The "on ..." is necessary, since our environment
|
|
|
|
# isn't changed by MakeLocateDebug.
|
|
|
|
}
|
|
|
|
MakeLocate $(_l)($(_s:BS)) : $(dir) ;
|
|
|
|
}
|
2008-09-09 03:03:52 +04:00
|
|
|
|
|
|
|
if $(NOARSCAN)
|
|
|
|
{
|
2005-10-29 20:27:43 +04:00
|
|
|
# If we can't scan the library to timestamp its contents,
|
|
|
|
# we have to just make the library depend directly on the
|
2008-09-09 03:03:52 +04:00
|
|
|
# on-disk object files.
|
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
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.
|
2008-09-09 03:03:52 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
Depends $(_l) : $(_l)($(_s:BS)) ;
|
2008-09-09 03:03:52 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
for _i in $(_s)
|
|
|
|
{
|
|
|
|
Depends $(_l)($(_i:BS)) : $(_i) ;
|
|
|
|
}
|
|
|
|
}
|
2008-09-09 03:03:52 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
LocalClean clean : $(_l) ;
|
2008-09-09 03:03:52 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
# bonefish: Not needed on the supported platforms. Maybe later...
|
|
|
|
# if $(CRELIB) { CreLib $(_l) : $(_s[1]) ; }
|
2008-09-09 03:03:52 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
Archive $(_l) : $(_s) ;
|
2008-09-09 03:03:52 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
if $(RANLIB) { Ranlib $(_l) ; }
|
2008-09-09 03:03:52 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
# If we can't scan the library, we have to leave the .o's around.
|
2008-09-09 03:03:52 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
if ! ( $(KEEPOBJS) || $(NOARSCAN) || $(NOARUPDATE) ) {
|
|
|
|
RmTemps $(_l) : $(_s) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rule Main
|
|
|
|
{
|
|
|
|
local target = $(1) ;
|
|
|
|
local sources = [ FGristFiles $(2) ] ;
|
|
|
|
local objects = $(sources:S=$(SUFOBJ)) ;
|
|
|
|
|
|
|
|
InheritPlatform $(objects) : $(target) ;
|
|
|
|
MainFromObjects $(target) : $(objects) ;
|
|
|
|
Objects $(sources) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule MainFromObjects
|
|
|
|
{
|
|
|
|
local _s _t ;
|
|
|
|
|
|
|
|
# Add grist to file names
|
|
|
|
# Add suffix to exe
|
|
|
|
|
|
|
|
_s = [ FGristFiles $(>) ] ;
|
|
|
|
_t = [ FAppendSuffix $(<) : $(SUFEXE) ] ;
|
|
|
|
|
|
|
|
# so 'jam foo' works when it's really foo.exe
|
|
|
|
|
|
|
|
if $(_t) != $(<)
|
|
|
|
{
|
|
|
|
Depends $(<) : $(_t) ;
|
|
|
|
NotFile $(<) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
# make compiled sources a dependency of target
|
|
|
|
|
|
|
|
LocalDepends exe : $(_t) ;
|
|
|
|
Depends $(_t) : $(_s) ;
|
|
|
|
MakeLocateDebug $(_t) ;
|
|
|
|
|
|
|
|
LocalClean clean : $(_t) ;
|
|
|
|
|
|
|
|
Link $(_t) : $(_s) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Override Jam 2.5rc3 MakeLocate and MkDir to deal more intelligently
|
2013-06-07 17:31:03 +04:00
|
|
|
# with grist set on the supplied directory name. Also do nothing for already
|
|
|
|
# located files.
|
2005-10-29 20:27:43 +04:00
|
|
|
rule MakeLocate
|
|
|
|
{
|
|
|
|
local dir = $(2[1]) ;
|
|
|
|
|
|
|
|
if $(dir)
|
|
|
|
{
|
|
|
|
if ! $(dir:G) {
|
|
|
|
dir = $(dir:G=dir) ;
|
|
|
|
}
|
2013-06-07 17:31:03 +04:00
|
|
|
|
|
|
|
local target ;
|
|
|
|
for target in $(1) {
|
|
|
|
# don't relocate once located
|
|
|
|
LOCATE on $(target) += $(dir:G=) ;
|
|
|
|
if [ on $(target) return $(LOCATE) ] = $(dir:G=) {
|
|
|
|
Depends $(target) : $(dir) ;
|
|
|
|
MkDir $(dir) ;
|
|
|
|
}
|
|
|
|
}
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rule MkDir
|
|
|
|
{
|
|
|
|
local dir = $(<) ;
|
|
|
|
if ! $(dir:G) {
|
|
|
|
dir = $(dir:G=dir) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
# make this and all super directories
|
|
|
|
while true {
|
|
|
|
# If dir exists, don't update it
|
|
|
|
# Do this even for $(DOT).
|
|
|
|
NoUpdate $(dir) ;
|
|
|
|
|
|
|
|
# Bail out when reaching the CWD (".") or a directory we've already
|
|
|
|
# made.
|
|
|
|
if $(dir:G=) = $(DOT) || $($(dir:G=)-mkdir) {
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
|
|
|
local s ;
|
|
|
|
|
|
|
|
# Cheesy gate to prevent multiple invocations on same dir
|
2008-09-09 03:03:52 +04:00
|
|
|
# MkDir1 has the actions
|
2005-10-29 20:27:43 +04:00
|
|
|
# Arrange for jam dirs
|
|
|
|
|
|
|
|
$(dir:G=)-mkdir = true ;
|
|
|
|
MkDir1 $(dir) ;
|
|
|
|
LocalDepends dirs : $(dir) ;
|
|
|
|
|
|
|
|
# Recursively make parent directories.
|
|
|
|
# $(dir:P) = $(dir)'s parent, & we recurse until root
|
|
|
|
|
|
|
|
s = $(dir:P) ; # parent keeps grist
|
2008-09-09 03:03:52 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
if $(s:G=) && $(s) != $(dir) {
|
|
|
|
Depends $(dir) : $(s) ;
|
|
|
|
dir = $(s) ;
|
|
|
|
} else if $(s) {
|
|
|
|
NotFile $(s) ;
|
|
|
|
break ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rule ObjectCcFlags
|
|
|
|
{
|
|
|
|
# supports inheriting the global variable value
|
|
|
|
|
|
|
|
local file ;
|
|
|
|
for file in [ FGristFiles $(1:S=$(SUFOBJ)) ] {
|
|
|
|
CCFLAGS on $(file) = [ on $(file) return $(CCFLAGS) ] $(2) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rule ObjectC++Flags
|
|
|
|
{
|
|
|
|
# supports inheriting the global variable value
|
|
|
|
|
|
|
|
local file ;
|
|
|
|
for file in [ FGristFiles $(1:S=$(SUFOBJ)) ] {
|
|
|
|
C++FLAGS on $(file) = [ on $(file) return $(C++FLAGS) ] $(2) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rule ObjectDefines
|
|
|
|
{
|
|
|
|
# supports inheriting the global variable value and multiple files
|
|
|
|
|
|
|
|
if $(2) {
|
|
|
|
local file ;
|
|
|
|
for file in [ FGristFiles $(1:S=$(SUFOBJ)) ] {
|
|
|
|
DEFINES on $(file) = [ on $(file) return $(DEFINES) ] $(2) ;
|
|
|
|
CCDEFS on $(file) = [ on $(file) FDefines $(DEFINES) ] ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rule ObjectHdrs
|
|
|
|
{
|
|
|
|
# ObjectHdrs <sources or objects> : <headers> : <gristed objects>
|
|
|
|
# Note: Parameter 3 <gristed objects> is an extension.
|
|
|
|
|
|
|
|
local objects = [ FGristFiles $(1:S=$(SUFOBJ)) ] $(3) ;
|
|
|
|
local headers = $(2) ;
|
|
|
|
|
|
|
|
local file ;
|
|
|
|
for file in $(objects) {
|
2005-11-13 01:58:54 +03:00
|
|
|
on $(file) {
|
|
|
|
local localHeaders = $(HDRS) $(headers) ;
|
|
|
|
SYSHDRS on $(file) = $(localHeaders) ;
|
|
|
|
|
|
|
|
# reformat ASHDRS and CCHDRS
|
|
|
|
local fileHeaders ;
|
|
|
|
|
|
|
|
if $(PLATFORM) = host {
|
|
|
|
fileHeaders =
|
|
|
|
[ FIncludes $(localHeaders) : $(HOST_LOCAL_INCLUDES_OPTION) ]
|
|
|
|
$(HOST_INCLUDES_SEPARATOR)
|
|
|
|
[ FSysIncludes $(SYSHDRS)
|
|
|
|
: $(HOST_SYSTEM_INCLUDES_OPTION) ] ;
|
|
|
|
} else {
|
2013-08-01 10:51:16 +04:00
|
|
|
local architecture = $(TARGET_PACKAGING_ARCH) ;
|
2005-11-13 01:58:54 +03:00
|
|
|
fileHeaders =
|
2013-08-01 10:51:16 +04:00
|
|
|
[ FIncludes $(localHeaders)
|
|
|
|
: $(TARGET_LOCAL_INCLUDES_OPTION_$(architecture)) ]
|
|
|
|
$(TARGET_INCLUDES_SEPARATOR_$(architecture))
|
2005-11-13 01:58:54 +03:00
|
|
|
[ FSysIncludes $(SYSHDRS)
|
2013-08-01 10:51:16 +04:00
|
|
|
: $(TARGET_SYSTEM_INCLUDES_OPTION_$(architecture)) ] ;
|
2005-11-13 01:58:54 +03:00
|
|
|
}
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2005-11-13 01:58:54 +03:00
|
|
|
ASHDRS on $(file) = $(fileHeaders) ;
|
|
|
|
CCHDRS on $(file) = $(fileHeaders) ;
|
|
|
|
}
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Overridden to avoid calling SubDir for a directory twice (in SubInclude
|
|
|
|
# and from the Jamfile in the directory).
|
|
|
|
rule SubInclude
|
|
|
|
{
|
|
|
|
# SubInclude TOP d1 ... ;
|
|
|
|
#
|
|
|
|
# Include a subdirectory's Jamfile.
|
|
|
|
|
|
|
|
if ! $($(<[1]))
|
|
|
|
{
|
|
|
|
Exit SubInclude $(<[1]) without prior SubDir $(<[1]) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Set up the config variables for the subdirectory.
|
|
|
|
local config = [ ConfigObject $(1) ] ;
|
|
|
|
|
|
|
|
__configured = ;
|
|
|
|
if ! [ on $(config) return $(__configured) ] {
|
|
|
|
# No custom configuration defined for the subdir. We use the variable
|
|
|
|
# values inherited by the closest ancestor.
|
|
|
|
config = $(HAIKU_INHERITED_SUBDIR_CONFIG) ;
|
|
|
|
}
|
|
|
|
|
2007-03-07 19:01:19 +03:00
|
|
|
# store SUBDIR_TOKENS
|
|
|
|
local oldSubDirTokens = $(SUBDIR_TOKENS) ;
|
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
on $(config) {
|
|
|
|
include [ FDirName $($(1[1])) $(1[2-) $(JAMFILE) ] ;
|
|
|
|
}
|
2007-03-07 19:01:19 +03:00
|
|
|
|
|
|
|
# restore SUBDIR_TOKENS
|
|
|
|
SUBDIR_TOKENS = $(oldSubDirTokens) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
2013-04-23 21:49:21 +04:00
|
|
|
|
|
|
|
|
|
|
|
actions File
|
|
|
|
{
|
|
|
|
$(CP) "$(>)" "$(<)"
|
|
|
|
}
|