2005-10-29 20:27:43 +04:00
|
|
|
# BeOS specific rules
|
|
|
|
|
2007-05-18 20:50:47 +04:00
|
|
|
rule AddFileDataAttribute target : attrName : attrType : dataFile
|
|
|
|
{
|
|
|
|
# AddFileAttribute <target> : <attrName> : <attrType> : <dataFile> ;
|
|
|
|
# Adds a single attribute to a file, retrieving the attribute data from
|
|
|
|
# a separate file.
|
|
|
|
# <target>: The file to which the attribute shall be added.
|
|
|
|
# <attrName>: The name of the attribute.
|
|
|
|
# <attrType>: Attribute type as supported by addattr (string, int, etc.)
|
|
|
|
# <dataFile>: The data to be written to the attribute will be read from
|
|
|
|
# that file.
|
|
|
|
# Note that this is supposed to be a build target, not a path
|
|
|
|
# name - if you need to add a data file in a different path,
|
|
|
|
# you have to locate it first.
|
|
|
|
#
|
|
|
|
|
|
|
|
# We need to create a temporary file in which we store the attribute name
|
|
|
|
# and type. Otherwise we wouldn't have these data available in the
|
|
|
|
# addattr actions.
|
|
|
|
local id = [ NextID ] ;
|
|
|
|
local attrMetaFile
|
|
|
|
= [ FGristFiles $(target:G=)-attr-$(attrName)-$(attrType)-$(id) ] ;
|
|
|
|
|
|
|
|
ATTRIBUTE_NAME on $(attrMetaFile) = $(attrName) ;
|
|
|
|
ATTRIBUTE_TYPE on $(attrMetaFile) = $(attrType) ;
|
|
|
|
MakeLocateArch $(attrMetaFile) ;
|
|
|
|
CreateAttributeMetaFile $(attrMetaFile) ;
|
|
|
|
|
|
|
|
Depends $(target) : <build>addattr $(attrMetaFile) $(dataFile) ;
|
|
|
|
AddFileDataAttribute1 $(target)
|
|
|
|
: <build>addattr $(attrMetaFile) $(dataFile) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
actions CreateAttributeMetaFile
|
|
|
|
{
|
|
|
|
echo "-t $(ATTRIBUTE_TYPE)" "$(ATTRIBUTE_NAME)" > "$(1)"
|
|
|
|
}
|
|
|
|
|
|
|
|
actions AddFileDataAttribute1
|
|
|
|
{
|
2007-05-18 21:00:18 +04:00
|
|
|
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
|
2007-05-18 20:50:47 +04:00
|
|
|
$(2[1]) -f $(2[3]) `cat $(2[2])` $(1)
|
|
|
|
}
|
2005-10-29 20:27:43 +04:00
|
|
|
|
|
|
|
rule AddStringDataResource
|
|
|
|
{
|
|
|
|
# AddStringDataResource <target> : <resourceID> : <dataString>
|
|
|
|
# Adds a single resource to the resources of an executable/library.
|
|
|
|
# <target>: The executable/library.
|
|
|
|
# <resourceID>: A resource ID string as understood by xres (type:id[:name]).
|
|
|
|
# <dataString>: The string <dataString> will be written to the resource.
|
|
|
|
# Defaults to "".
|
|
|
|
#
|
|
|
|
local target = $(1) ;
|
|
|
|
local resourceID = $(2) ;
|
|
|
|
local dataString = $(3:E="") ;
|
|
|
|
|
|
|
|
# the resource file
|
|
|
|
local resources
|
|
|
|
= [ FGristFiles $(target:B)-added-string-data-resources.rsrc ] ;
|
|
|
|
|
|
|
|
# add the resource file to the target, if not yet done
|
|
|
|
if ! [ on $(resources) return $(RESOURCES_ADDED) ] {
|
|
|
|
RESOURCES_ADDED on $(resources) = true ;
|
|
|
|
MakeLocateArch $(resources) ;
|
|
|
|
Depends $(resources) : <build>xres ;
|
|
|
|
AddStringDataResource1 $(resources) : <build>xres ;
|
|
|
|
AddResources $(target) : $(resources) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
RESOURCE_STRINGS on $(resources)
|
|
|
|
+= "-a "$(resourceID)" -s \""$(dataString)"\"" ;
|
|
|
|
}
|
|
|
|
|
|
|
|
actions together AddStringDataResource1
|
|
|
|
{
|
|
|
|
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
|
|
|
|
$(2[1]) -o "$(1)" $(RESOURCE_STRINGS)
|
|
|
|
}
|
|
|
|
|
|
|
|
rule AddFileDataResource
|
|
|
|
{
|
|
|
|
# AddFileDataResource <target> : <resourceID> : [ <dataFile> ]
|
|
|
|
# Adds a single resource to the resources of an executable/library.
|
|
|
|
# <target>: The executable/library.
|
|
|
|
# <resourceID>: A resource ID string as understood by xres (type:id[:name]).
|
|
|
|
# <dataFile>: The data to be written into the resource will be read from
|
|
|
|
# that file.
|
2006-12-29 00:28:17 +03:00
|
|
|
# Note that this is supposed to be a build target, not a path
|
|
|
|
# name - if you need to add a data file in a different path, you
|
|
|
|
# have to locate it first.
|
2005-10-29 20:27:43 +04:00
|
|
|
#
|
|
|
|
local target = $(1) ;
|
|
|
|
local resourceID = $(2) ;
|
|
|
|
local dataFile = $(3) ;
|
|
|
|
|
|
|
|
# the resource file
|
|
|
|
local resources
|
2006-12-29 00:28:17 +03:00
|
|
|
= <added-resources>file-data-$(resourceID)-$(dataFile).rsrc ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
|
|
|
# add it to the resources of the given target
|
|
|
|
AddResources $(target) : $(resources) ;
|
|
|
|
|
|
|
|
# if the rule for creating the resource file has not been invoked yet, do it
|
|
|
|
if ! [ on $(resources) return $(RESOURCES_DEFINED) ] {
|
|
|
|
RESOURCES_DEFINED on $(resources) = true ;
|
|
|
|
RESOURCE_ID on $(resources) = $(resourceID) ;
|
|
|
|
MakeLocateArch $(resources) ;
|
|
|
|
|
|
|
|
Depends $(resources) : <build>xres $(dataFile) ;
|
|
|
|
AddFileDataResource1 $(resources) : <build>xres $(dataFile) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
actions AddFileDataResource1
|
|
|
|
{
|
|
|
|
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
|
|
|
|
$(2[1]) -o "$(1)" -a "$(RESOURCE_ID)" "$(2[2])" ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule XRes
|
|
|
|
{
|
|
|
|
# XRes <target> : <resource files>
|
|
|
|
if $(2)
|
|
|
|
{
|
|
|
|
Depends $(1) : <build>xres $(2) ;
|
|
|
|
XRes1 $(1) : <build>xres $(2) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
actions XRes1
|
|
|
|
{
|
|
|
|
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
|
|
|
|
$(2[1]) -o "$(1)" "$(2[2-])" ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule SetVersion
|
|
|
|
{
|
|
|
|
# SetVersion <target>
|
|
|
|
|
|
|
|
Depends $(1) : <build>setversion ;
|
|
|
|
SetVersion1 $(1) : <build>setversion ;
|
|
|
|
}
|
|
|
|
|
|
|
|
actions SetVersion1
|
|
|
|
{
|
|
|
|
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
|
|
|
|
$(2[1]) "$(1)" -system $(HAIKU_BUILD_VERSION) -short "$(HAIKU_BUILD_DESCRIPTION)" ;
|
|
|
|
}
|
|
|
|
|
2013-06-29 16:35:16 +04:00
|
|
|
rule SetType target : type
|
2005-10-29 20:27:43 +04:00
|
|
|
{
|
2013-06-29 16:35:16 +04:00
|
|
|
# SetType <target> [ : <type> ]
|
|
|
|
# Sets the MIME type on the target. If none is given, the executable MIME
|
|
|
|
# type is used.
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2013-06-29 16:35:16 +04:00
|
|
|
TARGET_MIME_TYPE on $(target) = $(type:E=$(TARGET_EXECUTABLE_MIME_TYPE)) ;
|
|
|
|
|
|
|
|
Depends $(target) : <build>settype ;
|
|
|
|
SetType1 $(target) : <build>settype ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
actions SetType1
|
|
|
|
{
|
|
|
|
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
|
2013-06-29 16:35:16 +04:00
|
|
|
$(2[1]) -t $(TARGET_MIME_TYPE) "$(1)" ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
2013-05-09 05:38:10 +04:00
|
|
|
rule MimeSet target
|
2005-10-29 20:27:43 +04:00
|
|
|
{
|
2013-05-09 05:38:10 +04:00
|
|
|
# MimeSet <target> ;
|
2006-01-29 01:02:48 +03:00
|
|
|
|
2013-05-09 05:38:10 +04:00
|
|
|
Depends $(target) : <build>mimeset <mimedb>mime_db ;
|
|
|
|
MimeSet1 $(target) : <build>mimeset <mimedb>mime_db ;
|
2006-01-29 01:02:48 +03:00
|
|
|
}
|
|
|
|
|
2013-05-09 05:38:10 +04:00
|
|
|
|
2006-01-29 01:02:48 +03:00
|
|
|
actions MimeSet1
|
|
|
|
{
|
|
|
|
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
|
2013-05-09 05:38:10 +04:00
|
|
|
$(2[1]) -f --mimedb "$(2[2])" "$(1)"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
rule CreateAppMimeDBEntries target
|
|
|
|
{
|
|
|
|
# MimeSetApp <target> ;
|
|
|
|
# Create the app meta MIME DB entries for the given target. The
|
|
|
|
# HAIKU_MIME_DB_ENTRIES variable on <target> is set to the generated
|
|
|
|
# resulting target directory that contains the MIME DB entries.
|
|
|
|
|
|
|
|
local appGrist = $(target:G) ;
|
|
|
|
local appMimeDB = $(target:BS)_mimedb ;
|
|
|
|
appMimeDB = $(appMimeDB:G=mimedb-app-$(appGrist:E=)) ;
|
|
|
|
MakeLocateDebug $(appMimeDB) ;
|
|
|
|
Depends $(appMimeDB) : <build>mimeset $(target) <mimedb>mime_db ;
|
|
|
|
CreateAppMimeDBEntries1 $(appMimeDB)
|
|
|
|
: <build>mimeset $(target) <mimedb>mime_db ;
|
|
|
|
|
|
|
|
HAIKU_MIME_DB_ENTRIES on $(target) = $(appMimeDB) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
actions CreateAppMimeDBEntries1
|
|
|
|
{
|
|
|
|
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
|
|
|
|
|
|
|
|
appMimeDB="$(1)"
|
|
|
|
$(RM) -rf "$appMimeDB"
|
|
|
|
$(MKDIR) "$appMimeDB"
|
|
|
|
$(2[1]) -f --apps --mimedb "$appMimeDB" --mimedb "$(2[3])" "$(2[2])"
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
2013-05-09 05:38:10 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
rule ResComp
|
|
|
|
{
|
|
|
|
# ResComp <resource file> : <rdef file> ;
|
|
|
|
#
|
|
|
|
# <resource file> and <rdef file> must be gristed.
|
|
|
|
|
2006-08-06 16:38:30 +04:00
|
|
|
# get compiler and defines for the platform
|
|
|
|
local cc ;
|
|
|
|
local defines ;
|
2006-08-07 16:07:05 +04:00
|
|
|
local localIncludesOption ;
|
2010-03-30 01:36:00 +04:00
|
|
|
|
2006-08-06 16:38:30 +04:00
|
|
|
on $(1) { # use on $(1) variable values
|
|
|
|
defines = $(DEFINES) ;
|
|
|
|
|
|
|
|
if $(PLATFORM) = host {
|
|
|
|
defines += $(HOST_DEFINES) ;
|
|
|
|
cc = $(HOST_CC) ;
|
2006-08-07 16:07:05 +04:00
|
|
|
localIncludesOption = $(HOST_LOCAL_INCLUDES_OPTION) ;
|
2006-08-06 16:38:30 +04:00
|
|
|
} else {
|
|
|
|
defines += $(TARGET_DEFINES) ;
|
|
|
|
cc = $(TARGET_CC) ;
|
2006-08-07 16:07:05 +04:00
|
|
|
localIncludesOption = $(TARGET_LOCAL_INCLUDES_OPTION) ;
|
2006-08-06 16:38:30 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINES on $(1) = $(defines) ;
|
|
|
|
CCDEFS on $(1) = [ FDefines $(defines) ] ;
|
2010-03-30 01:36:00 +04:00
|
|
|
HDRS on $(1) = [ FIncludes $(SEARCH_SOURCE) $(SUBDIRHDRS) $(HDRS)
|
2009-09-19 02:23:34 +04:00
|
|
|
: $(localIncludesOption) ] ;
|
2010-03-30 01:36:00 +04:00
|
|
|
RCHDRS on $(1) = [ FIncludes $(SEARCH_SOURCE) $(SUBDIRHDRS) $(HDRS)
|
2009-09-19 02:23:34 +04:00
|
|
|
: "-I " ] ;
|
2006-08-06 16:38:30 +04:00
|
|
|
CC on $(1) = $(cc) ;
|
|
|
|
|
|
|
|
# set up other vars
|
2005-10-29 20:27:43 +04:00
|
|
|
SEARCH on $(2) += $(SEARCH_SOURCE) ;
|
|
|
|
MakeLocateArch $(1) ;
|
|
|
|
Depends $(1) : $(2) <build>rc ;
|
|
|
|
LocalClean clean : $(1) ;
|
|
|
|
ResComp1 $(1) : <build>rc $(2) ;
|
|
|
|
}
|
|
|
|
|
2007-07-27 03:08:05 +04:00
|
|
|
# Note: We pipe the input files into the preprocessor, since *.rdef files are
|
|
|
|
# considered linker scripts, and thus we can use preprocessor features.
|
2005-10-29 20:27:43 +04:00
|
|
|
actions ResComp1
|
|
|
|
{
|
|
|
|
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
|
2007-07-31 05:54:24 +04:00
|
|
|
cat "$(2[2-])" | $(CC) -E $(CCDEFS) $(HDRS) - | egrep -v '^#' | $(2[1]) $(RCHDRS) --auto-names -o "$(1)" -
|
2007-07-27 03:08:05 +04:00
|
|
|
}
|
|
|
|
|
2007-10-02 19:22:13 +04:00
|
|
|
rule ResAttr attributeFile : _resourceFiles : deleteAttributeFile
|
2007-07-27 03:08:05 +04:00
|
|
|
{
|
2007-10-02 19:22:13 +04:00
|
|
|
# ResAttr <attribute file> : <resource files> [ : <delete file> ] ;
|
2007-07-27 03:08:05 +04:00
|
|
|
#
|
|
|
|
# <attribute file> and <resource files> must be gristed.
|
|
|
|
# <resource files> can also be .rdef files -- they will be compiled first in
|
|
|
|
# this case.
|
2007-10-02 19:22:13 +04:00
|
|
|
# <clear file> is a boolean that specifies wether or not the target file
|
|
|
|
# should be removed before writing. Defaults to true.
|
2007-07-27 03:08:05 +04:00
|
|
|
|
|
|
|
local resourceFiles ;
|
|
|
|
local resourceFile ;
|
2007-10-02 19:22:13 +04:00
|
|
|
deleteAttributeFile ?= true ;
|
|
|
|
deleteAttributeFile1 on $(1) = $(deleteAttributeFile) ;
|
|
|
|
|
2007-07-27 03:08:05 +04:00
|
|
|
for resourceFile in $(_resourceFiles) {
|
|
|
|
# if the specified resource file is an .rdef file, we compile it first
|
|
|
|
if $(resourceFile:S) = ".rdef" {
|
|
|
|
local rdefFile = $(resourceFile) ;
|
|
|
|
resourceFile = $(rdefFile:S=.rsrc) ;
|
|
|
|
ResComp $(resourceFile) : $(rdefFile) ;
|
|
|
|
} else {
|
|
|
|
SEARCH on $(resourceFile) += $(SEARCH_SOURCE) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
resourceFiles += $(resourceFile) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
MakeLocateArch $(attributeFile) ;
|
|
|
|
Depends $(attributeFile) : $(resourceFiles) <build>resattr ;
|
|
|
|
LocalClean clean : $(attributeFile) ;
|
|
|
|
ResAttr1 $(attributeFile) : <build>resattr $(resourceFiles) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
actions ResAttr1
|
|
|
|
{
|
|
|
|
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
|
2007-10-02 19:22:13 +04:00
|
|
|
if [ \\"$(deleteAttributeFile1)\\" = "true" ]; then
|
* 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
|
|
|
$(RM) $(1)
|
2007-10-02 19:22:13 +04:00
|
|
|
fi
|
|
|
|
$(2[1]) -O -o "$(1)" "$(2[2-])"
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|