mirror of
https://github.com/edeproject/ede.git
synced 2023-08-10 21:13:03 +03:00
Imported asciidoc, jam builds and some docs.
This commit is contained in:
57
build/Doc.jam
Normal file
57
build/Doc.jam
Normal file
@@ -0,0 +1,57 @@
|
||||
#
|
||||
# $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.
|
||||
|
||||
ASCIIDOC = "$(TOP)/docs/asciidoc/asciidoc.py" ;
|
||||
DOCDIR = "$(TOP)/docs" ;
|
||||
MANUALDIR = "$(DOCDIR)/manual" ;
|
||||
|
||||
# Must be relative to "docs" dir
|
||||
DOCICONS = "images" ;
|
||||
|
||||
rule EdeManual
|
||||
{
|
||||
if ! $(ASCIIDOC) {
|
||||
Echo "ASCIIDOC not defined; documentation will not be built !" ;
|
||||
return ;
|
||||
}
|
||||
|
||||
local html_ext = ".html" ;
|
||||
local path = $(SEARCH_SOURCE) ;
|
||||
|
||||
local i source target ;
|
||||
for i in $(<) {
|
||||
source = [ FFileName $(path) $(i) ] ;
|
||||
# strip directory part so we can prepend
|
||||
# another one (used as output directory)
|
||||
target = $(source:D=) ;
|
||||
|
||||
# set output extension (asciidoc does not do that)
|
||||
# and grist to prevent collision
|
||||
target = $(target:S=$(html_ext):G="$(target)-html") ;
|
||||
|
||||
Depends $(target) : $(source) ;
|
||||
Depends all : $(target) ;
|
||||
Depends doc : $(target) ;
|
||||
|
||||
# set output to $(MANUALDIR) directory
|
||||
MakeLocate $(target) : $(MANUALDIR) ;
|
||||
|
||||
AsciiDoc1 $(target) : $(source) ;
|
||||
Clean clean : $(target) ;
|
||||
}
|
||||
}
|
||||
|
||||
actions AsciiDoc1
|
||||
{
|
||||
$(ASCIIDOC) -a icons -a iconsdir=$(DOCICONS) -a edeversion="EDE 2.0 alpha 1" -o $(<) $(>)
|
||||
}
|
||||
|
||||
NotFile doc ;
|
||||
Always doc ;
|
108
build/Install.jam
Normal file
108
build/Install.jam
Normal file
@@ -0,0 +1,108 @@
|
||||
#
|
||||
# $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.
|
||||
|
||||
EDEBINDIR = "/home/sanel/xxx/bin" ;
|
||||
EDEICONDIR = "/home/sanel/xxx/icons" ;
|
||||
EDEDESKTOPFILES = "/home/sanel/xxx/desktop" ;
|
||||
|
||||
# MakeInstallPrivate [location-dir] : [targets] : [opt-file-mode] : [opt-chown] : [opt-chgrp] ;
|
||||
rule MakeInstallPrivate
|
||||
{
|
||||
local i t s ;
|
||||
local dir = $(1) ;
|
||||
|
||||
MkDir $(dir) ;
|
||||
|
||||
# This was pain-in-the-ass to set up (bad docs)
|
||||
# but this is the shortest possible explaination of it:
|
||||
# files must be gristed (or foo/foo will not be build) and _after_
|
||||
# that apply SEARCH on it, consulting SUBDIR. Otherwise
|
||||
# known targets will be compiled, but unknown (icons etc.) will not
|
||||
# be recognized as installable entity.
|
||||
s = [ FGristFiles $(2) ] ;
|
||||
SEARCH on $(s) = $(SUBDIR) ;
|
||||
|
||||
for i in $(s) {
|
||||
t = $(i:BSR=$(dir):G=installed) ;
|
||||
Depends $(t) : $(i) ;
|
||||
Depends $(t) : $(dir) ;
|
||||
|
||||
Depends install : $(t) ;
|
||||
Clean uninstall : $(t) ;
|
||||
|
||||
Install1 $(t) : $(i) ;
|
||||
|
||||
if $(3) {
|
||||
MODE on $(t) = $(3) ;
|
||||
Chmod $(t) ;
|
||||
}
|
||||
|
||||
if $(4) {
|
||||
OWNER on $(t) = $(4) ;
|
||||
Chown $(t) ;
|
||||
}
|
||||
|
||||
if $(5) {
|
||||
GROUP on $(t) = $(5) ;
|
||||
Chgrp $(t) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# InstallAny [location-dir] : [targets] : [opt-file-mode] : [opt-chown] : [opt-chgrp] ;
|
||||
# Install [targets] and [location-dir] directory. If directory does not exists, it will
|
||||
# be created (the same applies for it's parents).
|
||||
# [opt-file-mode], if given, is mode for installed files, which can be EXEMODE, FILEMODE or manually
|
||||
# supplied one (chmod will be called). [opt-chown], if given, will run chown with given
|
||||
# name and change owner of installed targets. [opt-chgrp], if given, will run chgrp and change
|
||||
# group of installed targets.
|
||||
rule InstallAny
|
||||
{
|
||||
MakeInstallPrivate $(1) : $(2) : $(3) : $(4) : $(5) ;
|
||||
}
|
||||
|
||||
# InstallProgram [location-dir] : [targets] : [opt-chown] : [opt-chgrp] ;
|
||||
rule InstallProgram
|
||||
{
|
||||
MakeInstallPrivate $(1) : $(2) : $(EXEMODE) : $(3) : $(4) ;
|
||||
}
|
||||
|
||||
# InstallData [location-dir] : [targets] : [opt-chown] : [opt-chgrp] ;
|
||||
rule InstallData
|
||||
{
|
||||
MakeInstallPrivate $(1) : $(2) : $(FILEMODE) : $(3) : $(4) ;
|
||||
}
|
||||
|
||||
# InstallEdeProgram [targets] ;
|
||||
rule InstallEdeProgram
|
||||
{
|
||||
InstallProgram $(EDEBINDIR) : $(<) ;
|
||||
}
|
||||
|
||||
# InstallEdeIcons [targets] ;
|
||||
rule InstallEdeIcons
|
||||
{
|
||||
InstallData $(EDEICONDIR) : $(<) ;
|
||||
}
|
||||
|
||||
# InstallEdeDesktopFiles [targets] ;
|
||||
rule InstallEdeDesktopFiles
|
||||
{
|
||||
InstallData $(EDEDESKTOPFILES) : $(<) ;
|
||||
}
|
||||
|
||||
|
||||
actions Install1
|
||||
{
|
||||
$(CP) "$(>)" "$(<)"
|
||||
}
|
||||
|
||||
NotFile install uninstall ;
|
||||
Always install uninstall ;
|
129
build/Library.jam
Normal file
129
build/Library.jam
Normal file
@@ -0,0 +1,129 @@
|
||||
#
|
||||
# $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.
|
||||
|
||||
SUFSHAREDLIB = ".so" ;
|
||||
|
||||
# StaticLibrary [lib-name] : [source-files] : [flags] ;
|
||||
rule StaticLibrary
|
||||
{
|
||||
local objects = [ FGristFiles $(>:S=$(SUFOBJ)) ] ;
|
||||
C++FLAGS on $(objects) = [ on $(objects) return $(C++FLAGS) ] $(3) ;
|
||||
CCFLAGS on $(objects) = [ on $(objects) return $(CCFLAGS) ] $(3) ;
|
||||
|
||||
Library $(<) : $(>) ;
|
||||
}
|
||||
|
||||
# Not used (althought it do the job) since MainFromObjects defines
|
||||
# 'exe' target ('jam exe') which will build the library; I want 'lib' target :-P
|
||||
#rule SharedLibraryFromObjects
|
||||
#{
|
||||
# local shlib = $(1) ;
|
||||
# # In case path be part of $(shlib), gcc will set bad soname
|
||||
# # so it must be removed
|
||||
# local shlib_only = $(1:D=) ;
|
||||
#
|
||||
# MainFromObjects $(shlib) : $(2) ;
|
||||
# LINKFLAGS on $(shlib) = [ on $(shlib) return $(LINKFLAGS) ]
|
||||
# -shared -Wl,-soname,\"$(shlib_only)\" $(3) ;
|
||||
#}
|
||||
|
||||
rule SharedLibraryFromObjects
|
||||
{
|
||||
if ! $(UNIX) {
|
||||
Echo "Dynamic libraries can't be built on this OS now" ;
|
||||
return ;
|
||||
}
|
||||
|
||||
local s t t_only ;
|
||||
|
||||
t = $(1) ;
|
||||
s = [ FGristFiles $(2) ] ;
|
||||
|
||||
# Rip directory part from target because this will
|
||||
# be passed to compiler as soname
|
||||
t_only = $(t:D=) ;
|
||||
|
||||
# if given suffix, skip it; otherwise add SUFSHAREDLIB
|
||||
if ! $(t:S) {
|
||||
t = $(t:S=$(SUFSHAREDLIB)) ;
|
||||
}
|
||||
|
||||
Depends lib : $(t) ;
|
||||
|
||||
# This is used if library already does not have a path
|
||||
if ! $(t:D) {
|
||||
MakeLocate $(t) $(t)($(s:BS)) : $(LOCATE_TARGET) ;
|
||||
}
|
||||
|
||||
# FIXME: option 'on $(t) return $(LINKLIBS)' can be re-used
|
||||
# instead $(3) parameter so [opt-linklibs] are not needed. Check this.
|
||||
LINKLIBS on $(t) = [ on $(t) return $(LINKLIBS) ] -shared -Wl,-soname,\"$(t_only)\" $(3) ;
|
||||
|
||||
# Let target is dependant on source
|
||||
Depends $(t) : $(s) ;
|
||||
|
||||
Link $(t) : $(s) ;
|
||||
Clean clean : $(t) ;
|
||||
}
|
||||
|
||||
# SharedLibrary [libname] : [sources] : [opt-linklibs] ;
|
||||
# Creates shared library [libname] from [sources]. If [opt-linklibs] are provided,
|
||||
# library will be linked with them (they _must_ be in form -lfoo which will be directly
|
||||
# passed to compiler).
|
||||
#
|
||||
# Note: ftjam in later versions provide rule with the same name, althought it calls
|
||||
# libtool in the background. The way jam works, selecting latest redefined rules, ftjam's
|
||||
# will be overriden with this.
|
||||
rule SharedLibrary
|
||||
{
|
||||
local shlib = $(1) ;
|
||||
local src = $(2) ;
|
||||
local objects = $(src:S=$(SUFOBJ)) ;
|
||||
|
||||
SharedLibraryFromObjects $(shlib) : $(objects) : $(3) ;
|
||||
Objects $(src) ;
|
||||
}
|
||||
|
||||
# SharedLibraryVersioned [libname] : [sources] : [opt-linklibs] : [opt-version] : ["nolink"] ;
|
||||
# Creates versioned shared library (foo.so.[version]) which is often library naming
|
||||
# on unix platforms. If [opt-version] is not given, it is like calling SharedLibrary only.
|
||||
# By default it will create, besides [libname], ".so" symlink to it too. If "nolink" is given
|
||||
# as 5 parameter, it will skip symlink creation.
|
||||
rule SharedLibraryVersioned
|
||||
{
|
||||
if $(4) {
|
||||
local target target_dir symlink versioned ;
|
||||
|
||||
# Set .so.version extension
|
||||
versioned = "$(SUFSHAREDLIB).$(4)" ;
|
||||
|
||||
# Jam is not smart about ripping suffixes so cases 'foo.so.2.0'
|
||||
# will produce 'foo.so.2'. We must hope that provided [libname] does _not_
|
||||
# have full name or everything will be screwed up (no facility in jam to check this).
|
||||
# With good hopes, we set first full target name and it's link abbreviation.
|
||||
target = $(1:S=$(versioned)) ;
|
||||
symlink = $(1:S=$(SUFSHAREDLIB)) ;
|
||||
SharedLibrary $(target) : $(2) : $(3) ;
|
||||
|
||||
# Create symlink
|
||||
if $(5) != "nolink" {
|
||||
# copy target directory or symlink will be created
|
||||
# from place where jam is called
|
||||
LOCATE on $(symlink) = [ on $(target) return $(LOCATE) ] ;
|
||||
|
||||
Depends lib : $(symlink) ;
|
||||
|
||||
SymLink $(symlink) : $(target) ;
|
||||
Clean clean : $(symlink) ;
|
||||
}
|
||||
} else {
|
||||
SharedLibrary $(1) : $(2) : $(3) ;
|
||||
}
|
||||
}
|
106
build/Program.jam
Normal file
106
build/Program.jam
Normal file
@@ -0,0 +1,106 @@
|
||||
#
|
||||
# $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.
|
||||
|
||||
# MakeProgramPrivate [target] : [sources] : [libraries] : [flags] ;
|
||||
rule MakeProgramPrivate
|
||||
{
|
||||
local target objects ;
|
||||
|
||||
# This will make happy original jam and ftjam since constructing it's
|
||||
# grist from source file will make it unique and prevent colision with the
|
||||
# same directory name
|
||||
target = $(1:G=$(SOURCE_GRIST)) ;
|
||||
|
||||
# so 'jam foo' works when 'foo' is final executable
|
||||
if $(target) != $(<) {
|
||||
Depends $(<) : $(target) ;
|
||||
NotFile $(<) ;
|
||||
}
|
||||
|
||||
objects = [ FGristFiles $(2:S=$(SUFOBJ)) ] ;
|
||||
|
||||
# Pick up values if someone set flags outside (via ObjectCcFlags and etc.)
|
||||
CFLAGS on $(objects) = [ on $(objects) return $(CFLAGS) ] $(4) ;
|
||||
C++FLAGS on $(objects) = [ on $(objects) return $(C++FLAGS) ] $(4) ;
|
||||
|
||||
LINKLIBS on $(target) = $(3) [ on $(target) return $(LINKLIBS) ] ;
|
||||
|
||||
MainFromObjects $(target) : $(objects) ;
|
||||
Objects $(>) ;
|
||||
}
|
||||
|
||||
# Program [target] : [sources] : [libraries] : [flags] ;
|
||||
# Compiles and links [target] from [sources]. No external flags or
|
||||
# libraries are used since this should be generic rule for compiling
|
||||
# any program.
|
||||
rule Program
|
||||
{
|
||||
MakeProgramPrivate $(1) : $(2) : $(3) : $(4) ;
|
||||
}
|
||||
|
||||
# EdeProgram [target] : [sources] : [optinal-libraries] : [optinal-flags] ;
|
||||
# Creates EDE specific programs. They will be linked with EDELIBLIB
|
||||
# and FLTKLIB. If [optinal-libraries] or [optinal-flags] are given, they will be
|
||||
# used too.
|
||||
rule EdeProgram
|
||||
{
|
||||
if ! $(EDELIBINCLUDE) || ! $(EDELIBLIB) {
|
||||
Echo "EDELIBINCLUDE or EDELIBLIB not defined; $(1) will not be built" ;
|
||||
return ;
|
||||
}
|
||||
|
||||
MakeProgramPrivate $(1) : $(2)
|
||||
: $(3) $(EDELIBLIB) $(FLTKLIB) $(STDLIB)
|
||||
: $(4) $(EDELIBINCLUDE) $(FLTKINCLUDE) ;
|
||||
}
|
||||
|
||||
# EfltkProgram [target] : [sources] : [optinal-libraries] : [optinal-flags] ;
|
||||
# Creates programs that will be linked with efltk. If [optinal-libraries] or
|
||||
# [optinal-flags] are given, they will be used too.
|
||||
rule EfltkProgram
|
||||
{
|
||||
if ! $(EFLTKINCLUDE) || ! $(EFLTKLIB) {
|
||||
Echo "EFLTKINCLUDE or EFLTKLIB not defined; $(1) will not be built" ;
|
||||
return ;
|
||||
}
|
||||
|
||||
MakeProgramPrivate $(1) : $(2)
|
||||
: $(3) $(EFLTKLIB) $(STDLIB)
|
||||
: $(4) $(EFLTKINCLUDE) ;
|
||||
}
|
||||
|
||||
# FltkProgram [target] : [sources] : [optinal-libraries] : [optinal-flags] ;
|
||||
# Creates programs that will be linked with fltk only. It will use full fltk
|
||||
# dependencies (images).
|
||||
rule FltkProgram
|
||||
{
|
||||
if ! $(FLTKINCLUDE) || ! $(FLTKLIB) {
|
||||
Echo "FLTKINCLUDE or FLTKLIB not defined; $(1) will not be built" ;
|
||||
return ;
|
||||
}
|
||||
|
||||
MakeProgramPrivate $(1) : $(2)
|
||||
: $(3) $(FLTKLIB) $(STDLIB)
|
||||
: $(4) $(FLTKINCLUDE) ;
|
||||
}
|
||||
|
||||
# FltkProgramBare [target] : [sources] : [optinal-libraries] : [optinal-flags] ;
|
||||
# Creates programs that will be linked with fltk only. No images will be linked in it.
|
||||
rule FltkProgramBare
|
||||
{
|
||||
if ! $(FLTKINCLUDE) || ! $(FLTKLIB_NOIMAGES) {
|
||||
Echo "FLTKINCLUDE or FLTKLIB_NOIMAGES not defined; $(1) will not be built" ;
|
||||
return ;
|
||||
}
|
||||
|
||||
MakeProgramPrivate $(1) : $(2)
|
||||
: $(3) $(FLTKLIB_NOIMAGES) $(STDLIB)
|
||||
: $(4) $(FLTKINCLUDE) ;
|
||||
}
|
109
build/Translation.jam
Normal file
109
build/Translation.jam
Normal file
@@ -0,0 +1,109 @@
|
||||
#
|
||||
# $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.
|
||||
|
||||
DEFAULT_POT = "messages.pot" ;
|
||||
|
||||
# ExtractStrings [dir-where] : [source] : [output-file] ;
|
||||
# Scans [source] file(s) for translatable strings (usually marked as _("foo"))
|
||||
# and store result in [output-file] in [dir-where] directory. If [dir-where]
|
||||
# does not exists, it will be created.
|
||||
# [output-file] can be omitted; in that case DEFAULT_POT will be used.
|
||||
rule ExtractStrings
|
||||
{
|
||||
local strfile ;
|
||||
if $(3) {
|
||||
strfile = $(3) ;
|
||||
} else {
|
||||
strfile = $(DEFAULT_POT) ;
|
||||
}
|
||||
|
||||
if ! $(XGETTEXT) {
|
||||
Echo "XGETTEXT wasn't defined; $(strfile) will not be created !" ;
|
||||
return ;
|
||||
}
|
||||
|
||||
local path locale_dir target source i ;
|
||||
|
||||
path = $(SEARCH_SOURCE) ;
|
||||
# Assure path name does not match pseudo target name by setting
|
||||
# a specified grist. For example if grist wasn't set, and there is
|
||||
# directory 'foo' with executable 'foo' in it, $(path) will be 'foo'
|
||||
# which will confuse jam to see it as target too, (re)building it.
|
||||
path = $(path:G=strings) ;
|
||||
|
||||
locale_dir = [ FDirName $(path) $(<) ] ;
|
||||
target = [ FFileName $(locale_dir) $(strfile) ] ;
|
||||
source = $(>:R=$(path)) ;
|
||||
|
||||
MkDir $(locale_dir) ;
|
||||
for i in $(source) {
|
||||
Depends $(target) : $(i) ;
|
||||
}
|
||||
|
||||
Depends $(target) : $(locale_dir) ;
|
||||
Depends potfile : $(target) ;
|
||||
Depends translation : $(target) ;
|
||||
Depends all : $(target) ;
|
||||
|
||||
XGettext $(target) : $(source) ;
|
||||
|
||||
Clean clean : $(target) ;
|
||||
CleandirSafe distclean : $(locale_dir) ;
|
||||
}
|
||||
|
||||
# MakeTranslation [po-dir] : [file1.po file2.po...] ;
|
||||
# Compile translated files into binary representation, so they
|
||||
# can be used by programs. [po-dir] is directory name where
|
||||
# to look for translated files (.po) and where will be placed
|
||||
# binary ones (.mo). Second parameter is list of .po files.
|
||||
rule MakeTranslation
|
||||
{
|
||||
local moext mofile pofile path i ;
|
||||
|
||||
moext = ".mo" ;
|
||||
|
||||
path = $(SEARCH_SOURCE) ;
|
||||
# Assure path name does not match pseudo target name by setting
|
||||
# a specified grist. For example if grist wasn't set, and there is
|
||||
# directory 'foo' with executable 'foo' in it, $(path) will be 'foo'
|
||||
# which will confuse jam to see it as target too, (re)building it.
|
||||
path = $(path:G=translation) ;
|
||||
|
||||
if ! $(MSGFMT) {
|
||||
Echo "MSGFMT wasn't defined; $(moext) files will not be created !" ;
|
||||
return ;
|
||||
}
|
||||
|
||||
for i in $(>) {
|
||||
pofile = [ FFileName $(path) $(<) $(i) ] ;
|
||||
mofile = [ FFileName $(path) $(<) $(i:S=$(moext)) ] ;
|
||||
|
||||
Depends $(mofile) : $(pofile) ;
|
||||
Depends all : $(mofile) ;
|
||||
Depends translation : $(mofile) ;
|
||||
|
||||
MakeTranslation1 $(mofile) : $(pofile) ;
|
||||
|
||||
Clean clean : $(mofile) ;
|
||||
}
|
||||
}
|
||||
|
||||
actions XGettext
|
||||
{
|
||||
$(XGETTEXT) -k'_' $(2) -o $(1) ;
|
||||
}
|
||||
|
||||
actions MakeTranslation1
|
||||
{
|
||||
$(MSGFMT) $(>) -o $(<) ;
|
||||
}
|
||||
|
||||
NotFile translation potfile ;
|
||||
Always translation potfile ;
|
167
build/Utils.jam
Normal file
167
build/Utils.jam
Normal file
@@ -0,0 +1,167 @@
|
||||
#
|
||||
# $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.
|
||||
|
||||
|
||||
RMDIR_UNSFE ?= $(RM) -Rf ;
|
||||
#RMDIR_SAFE ?= "rmdir --ignore-fail-on-non-empty" ;
|
||||
RMDIR_SAFE ?= "rmdir" ;
|
||||
CP ?= "cp" ;
|
||||
MV ?= "mv" ;
|
||||
MKDIRS ?= "mkdir -p" ;
|
||||
LINKCMD ?= "ln -s" ;
|
||||
|
||||
# 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 ;
|
||||
}
|
||||
|
||||
Depends $(<) : $(>) ;
|
||||
|
||||
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] ;
|
||||
# Removes directory in 'Clean clean' fassion
|
||||
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) "$(>)" "$(<)"
|
||||
}
|
Reference in New Issue
Block a user