2007-07-18 17:21:52 +04:00
|
|
|
#
|
|
|
|
# $Id$
|
|
|
|
#
|
|
|
|
# Part of Equinox Desktop Environment (EDE).
|
|
|
|
# Copyright (c) 2000-2007 EDE Authors.
|
|
|
|
#
|
|
|
|
# This program is licensed under terms of the
|
|
|
|
# GNU General Public License version 2 or newer.
|
|
|
|
# See COPYING for details.
|
|
|
|
|
|
|
|
|
2008-08-22 20:40:18 +04:00
|
|
|
#RMDIR_UNSAFE ?= $(RM) -Rf ;
|
2007-07-18 20:14:10 +04:00
|
|
|
#RMDIR_SAFE ?= "rmdir" ;
|
|
|
|
#CP ?= "cp" ;
|
2008-08-22 20:40:18 +04:00
|
|
|
#COPYDIR ?= "cp -R" ;
|
2007-07-18 20:14:10 +04:00
|
|
|
#MV ?= "mv" ;
|
|
|
|
#MKDIRS ?= "mkdir -p" ;
|
|
|
|
#LINKCMD ?= "ln -s" ;
|
2007-07-18 17:21:52 +04:00
|
|
|
|
2007-09-28 18:08:59 +04:00
|
|
|
# Compatibility with ftjam,PerforceJam,...
|
|
|
|
# Haiku jam have builtin LocalClean and LocalDepends
|
|
|
|
if ! $(INVOCATION_SUBDIR_SET) {
|
|
|
|
rule LocalClean { Clean $(1) : $(2) ; }
|
|
|
|
rule LocalDepends { Depends $(1) : $(2) ; }
|
|
|
|
}
|
|
|
|
# Compatibility part ends
|
|
|
|
|
2009-01-26 15:31:01 +03:00
|
|
|
# [ RemoveFlag FLAG : FLAGS ] ;
|
|
|
|
# Removes FLAG from list of FLAGS
|
|
|
|
rule RemoveFlag
|
|
|
|
{
|
|
|
|
local i ;
|
|
|
|
local ret ;
|
|
|
|
|
|
|
|
for i in $(>) {
|
|
|
|
if $(i) != $(<) {
|
|
|
|
ret += $(i) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $(ret) ;
|
|
|
|
}
|
|
|
|
|
2007-07-18 17:21:52 +04:00
|
|
|
# Fltk use .cxx extension for C++ files so it must
|
|
|
|
# be registered. This rule is called by jam so final
|
|
|
|
# application must not use it.
|
|
|
|
rule UserObject
|
|
|
|
{
|
|
|
|
switch $(>:S) {
|
|
|
|
case .cxx : C++ $(<) : $(>) ;
|
|
|
|
case * : Exit "Unknown suffix on $(>)" ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Wildcard [optinal-directory :] [patterns] : [optional-prepend-directory] ;
|
|
|
|
# Create a list of files that match [patterns]. If [optional-directory]
|
|
|
|
# is given, it will return list from that directory. If [optional-prepend-directory]
|
|
|
|
# is given, all returned files will be prepended with that directory name.
|
|
|
|
#
|
|
|
|
# For example with 'baz.cpp, baz2.cpp':
|
|
|
|
# list files in current directory
|
|
|
|
# lst = [ Wildcard *.cpp ] ; -> 'baz.cpp baz2.cpp'
|
|
|
|
#
|
|
|
|
# list files in 'foo' directory
|
|
|
|
# lst = [ Wildcard foo : *.cpp ] ; -> 'baz.cpp baz2.cpp'
|
|
|
|
#
|
|
|
|
# list files in current directory and prepend with xxx directory name
|
|
|
|
# lst = [ Wildcard : *.cpp : xxx ] ; -> 'xxx/baz.cpp xxx/baz2.cpp'
|
|
|
|
#
|
|
|
|
# This rule is not the same rule from autojam, but that was a good inspiration :-)
|
|
|
|
rule Wildcard
|
|
|
|
{
|
|
|
|
local files dir sdir wildcards ;
|
|
|
|
|
|
|
|
if $(2) {
|
|
|
|
dir = "$(<)/" ;
|
|
|
|
wildcards = $(2) ;
|
|
|
|
} else {
|
|
|
|
dir = "" ;
|
|
|
|
wildcards = $(1) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
if $(3) {
|
|
|
|
sdir = $(3) ;
|
|
|
|
} else {
|
|
|
|
sdir = "" ;
|
|
|
|
}
|
|
|
|
|
|
|
|
files = [ Glob [ FDirName $(SUBDIR) $(dir) ] : $(wildcards) ] ;
|
|
|
|
return $(files:BSR=$(sdir)) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
# SymLink [link] : [source] : [opt-path-to-source];
|
|
|
|
# Creates symbolic link [link] pointing at [source].
|
|
|
|
# If [opt-path-to-source] is given, [link] will point to [opt-path-to-source]/[source].
|
|
|
|
#
|
|
|
|
# Addition of directory option to this rule is needed because of the way how
|
|
|
|
# 'ln -s' works and how it fits to jam's way of seeing paths. For example,
|
|
|
|
# setting 'SymLink foo.so : foo.so.2' will make correcty symlink _only_ in
|
|
|
|
# directory where 'foo.so.2' is built; on other hand if 'foo' is in 'baz' directory
|
|
|
|
# and jam is called outside of it, link will be 'baz/foo.so -> baz/foo.so.2' which is incorrect;
|
|
|
|
# linking must be done locally (done via SYMLINKSRCPATH).
|
|
|
|
rule SymLink
|
|
|
|
{
|
|
|
|
if ! $(LINKCMD) {
|
|
|
|
Echo "LINKCMD wasn't defined, $(<) will not be created" ;
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
2007-09-28 18:08:59 +04:00
|
|
|
LocalDepends $(<) : $(>) ;
|
2007-07-18 17:21:52 +04:00
|
|
|
|
|
|
|
if $(3) {
|
|
|
|
SYMLINKSRCPATH on $(<) = $(3) ;
|
|
|
|
} else {
|
|
|
|
# Can't be empty or SymLink1 will ignore source; also
|
|
|
|
# it is set on $(<) since jam only this way see it as valid variable
|
|
|
|
SYMLINKSRCPATH on $(<) = "" ;
|
|
|
|
}
|
|
|
|
|
|
|
|
SymLink1 $(<) : $(>) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
# FFileName [items] ;
|
|
|
|
# The same as FDirName (since FDirName correctly construct result if
|
|
|
|
# ending item is non-dir), but provided for easier navigation.
|
|
|
|
# In short, return pathed list of items, like: [ FFileName foo baz taz ]
|
|
|
|
# will be 'foo/baz/taz'. Must be called inside [], as FDirName does.
|
|
|
|
rule FFileName
|
|
|
|
{
|
|
|
|
return [ FDirName $(<) ] ;
|
|
|
|
}
|
|
|
|
|
|
|
|
# MkDir [directory] ;
|
|
|
|
# Make a directory and all its parent directories.
|
|
|
|
# The default MkDir rule in Jambase has problems when paths contains a sequence
|
|
|
|
# of multiple slashes (ie. bla////fup). We solve these problems and greatly
|
|
|
|
# simply this rule by using the "mkdir -p" or mkdirs command. Stolen from autojam.
|
|
|
|
rule MkDir
|
|
|
|
{
|
|
|
|
if ! $(MKDIRS) {
|
|
|
|
Echo "MKDIRS wasn't defined; $(<) will not be created" ;
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Ignore timestamps on directories: we only care if they
|
|
|
|
# exist.
|
|
|
|
NoUpdate $(<) ;
|
|
|
|
|
|
|
|
# don't create the dir multiple times
|
|
|
|
if ! $($(<)-mkdir) {
|
|
|
|
$(<)-mkdir = true ;
|
|
|
|
MkDir1 $(<) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
actions SymLink1
|
|
|
|
{
|
|
|
|
$(RM) "$(<)" && $(LINKCMD) "$(>:D=$(SYMLINKSRCPATH))" "$(<)"
|
|
|
|
}
|
|
|
|
|
|
|
|
actions MkDir1
|
|
|
|
{
|
|
|
|
$(MKDIRS) "$(<)"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Cleandir clean : [directory] ;
|
2008-08-22 20:40:18 +04:00
|
|
|
# Removes directory in 'Clean clean' fashion
|
2007-07-18 17:21:52 +04:00
|
|
|
actions piecemeal together existing Cleandir
|
|
|
|
{
|
|
|
|
$(RMDIR_UNSAFE) "$(>)"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Similar to Cleandir, but it will not remove directory
|
|
|
|
# if it is not empty. Also 'ignore' modifier will notify jam
|
|
|
|
# to noy scream if directory is not empty.
|
|
|
|
actions piecemeal together ignore existing CleandirSafe
|
|
|
|
{
|
|
|
|
$(RMDIR_SAFE) "$(>)"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Copy [target] : [source] ;
|
|
|
|
actions Copy
|
|
|
|
{
|
|
|
|
$(CP) "$(>)" "$(<)"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Move [target] : [source] ;
|
|
|
|
actions Move
|
|
|
|
{
|
|
|
|
$(MV) "$(>)" "$(<)"
|
|
|
|
}
|
2008-08-22 20:40:18 +04:00
|
|
|
|
|
|
|
actions CopyDir
|
|
|
|
{
|
|
|
|
$(COPYDIR) "$(>)" "$(<)"
|
|
|
|
}
|