1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243
|
<?xml version="1.0" ?>
<!-- Created by: Francesco Montorsi <frm@users.sourceforge.net> -->
<!-- Creation date: 9/10/2004 -->
<!-- RCS-ID: $Id$ -->
<makefile>
<using module="datafiles"/>
<!-- -->
<!-- NEW TAGS -->
<!-- -->
<!-- A shortcut for the INCLUDE and LIB-PATH tags. -->
<define-tag name="stdlib" rules="exe,dll,lib">
<include>$(value)$(DIRSEP)include</include>
<lib-path>$(value)$(DIRSEP)lib</lib-path>
</define-tag>
<!-- Localization stuff -->
<set var="MSGFMT">msgfmt --statistics</set>
<set var="MSGMERGE">msgmerge</set>
<set var="XGETTEXT">xgettext</set>
<set var="XARGS">xargs</set>
<set var="XGETTEXT_ARGS">--c++ -k_ -kwxPLURAL:1,2 -kwxTRANSLATE -s -j</set>
<define-tag name="create-pot" rules="action">
<command>
rm -f $(value)
touch $(value)
find $(SRCDIR)/include -name "*.h" | $(XARGS) $(XGETTEXT) $(XGETTEXT_ARGS) -o $(value)
find $(SRCDIR)/src -name "*.cpp" | $(XARGS) $(XGETTEXT) $(XGETTEXT_ARGS) -o $(value)
find $(SRCDIR)/src -name "*.xrc.extracted" | $(XARGS) $(XGETTEXT) $(XGETTEXT_ARGS) -o $(value)
</command>
</define-tag>
<define-tag name="update-po" rules="action">
<command>
$(MSGMERGE) $(value) $(POTFILE) > $(value).new && mv $(value).new $(value)
</command>
</define-tag>
<define-tag name="compile-po" rules="action">
<command>
$(MSGFMT) -o $(value.replace('po', 'mo')) $(value)
</command>
</define-tag>
<define-tag name="update-and-compile-po" rules="action">
<update-po>$(value)</update-po>
<compile-po>$(value)</compile-po>
</define-tag>
<define-tag name="scanxrc" rules="action">
<!-- Extract translatable strings from XRC and put them in a fake file which will be scanned later -->
<command>wxrc $(value) -g -c -o $(value).extracted</command>
</define-tag>
<!-- E.g.:
<set var="POTFILE">locale/webupdater.pot</set>
<set var="XRCFILE">$(SRCDIR)/src/webupdatedlg.xrc</set>
<gettext-catalogs id="locale">
<srcdir>$(SRCDIR)/locale</srcdir>
<catalog-name>webupdater</catalog-name>
<linguas>it de</linguas>
<install-to>$(LOCALEDIR)</install-to>
</gettext-catalogs>
<action id="i18n" cond="TARGETING_WIN32=='0'">
<scanxrc>$(XRCFILE)</scanxrc>
<create-pot>$(POTFILE)</create-pot>
<update-and-compile-po>locale/it.po</update-and-compile-po>
<update-and-compile-po>locale/de.po</update-and-compile-po>
</action>
-->
<!-- -->
<!-- NEW RULES -->
<!-- -->
<!-- Changes the current directory to the folder given to the CD -->
<!-- tag and then executes the command given to the RUN tag. -->
<!-- Usage sample: -->
<!-- <cd-and-run id="tarball"> -->
<!-- <cd>..</cd> -->
<!-- <run>tar -cvzf tarball.tar.gz myproj/*</run> -->
<!-- </cd-and-run> -->
<define-rule name="cd-and-run" extends="action">
<template>
<set var="__cmddir"/>
<set var="__cmdstr"/>
</template>
<define-tag name="cd">
<set var="__cmddir">$(nativePaths(value))</set>
</define-tag>
<define-tag name="run">
<set var="__cmdstr">$(value)</set>
<if cond="FORMAT=='msvc' or FORMAT=='mingw' or FORMAT=='gnu' or FORMAT=='autoconf'">
<command>( cd $(__cmddir) && $(__cmdstr) )</command>
</if>
<if cond="FORMAT=='borland' or FORMAT=='watcom'">
<command>-cd $(__cmddir)</command>
<command>-$(__cmdstr)</command>
</if>
</define-tag>
</define-rule>
<!-- NOTE: the following tags do:
- create a .tar.gz in the parent's folder of the component
- assume that the folder containing the component is named $(COMP_NAME)
- need to be run from $(SRCDIR)/..
-->
<define-tag name="run-tarball" rules="action">
<!-- NOTE: the double quotes are to avoid shell expansion (and 'tar' will accept
wildcards inside options as well) -->
<run>tar -cvzf $(value) --exclude="*~" --exclude="*.log" --exclude="*.o*" --exclude="*.a" --exclude=".svn" --exclude="autom4te.cache" $(COMP_NAME)$(DIRSEP)*</run>
</define-tag>
<define-tag name="run-zip" rules="action">
<run>zip -r9 $(value) $(COMP_NAME) -x "*.pdb" -x "*.log" -x "*.o*"</run>
</define-tag>
<!-- Helps you to set the MAKEARGS variable manually. -->
<!-- he MAKEARGS variable is usually automatically generated by -->
<!-- Bakefile using all the options available; the problem is that -->
<!-- maybe you have to translate from an option name to another... -->
<!-- For example, I often found that I need to translate the: -->
<!-- WX_UNICODE=1/0, -->
<!-- WX_SHARED=1/0, -->
<!-- WX_DEBUG=1/0, -->
<!-- options of the build system of my wxWidgets-based projects, to -->
<!-- some other option name, when building the non wx-based part of -->
<!-- those projects, like: -->
<!-- UNICODE=1/0, -->
<!-- SHARED=1/0, -->
<!-- BUILD=debug/release -->
<!-- To do such kind of substitution in the arguments passed to the -->
<!-- other MAKEs by the <subproject> targets, you need to write the -->
<!-- MAKEARGS variable by hand... and this tag helps you a lot ! -->
<!-- Usage sample: -->
<!-- <set var="BUILD_EQUIVALENT"> -->
<!-- <if cond="WX_DEBUG=='1'">debug</if> -->
<!-- <if cond="WX_DEBUG=='0'">release</if> -->
<!-- </set> -->
<!-- <smart-subproject id="nonwxbased"> -->
<!-- <set-makeargs> -->
<!-- UNICODE=$(WX_UNICODE) -->
<!-- SHARED=$(WX_SHARED) -->
<!-- BUILD=$(BUILD_EQUIVALENT) -->
<!-- </set-makeargs> -->
<!-- </smart-subproject> -->
<define-rule name="smart-subproject" extends="subproject">
<template>
</template>
<define-tag name="set-makeargs">
<set var="_MAKEARGS">
CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)"
CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" $(value)
</set>
<!-- now adjust the real MAKEARGS -->
<if cond="FORMAT=='borland'">
<set var="MAKEARGS" make_var="1">$(''.join(['-D%s ' % (x) for x in _MAKEARGS.split()]))</set>
</if>
<if cond="FORMAT!='borland'">
<set var="MAKEARGS" make_var="1">$(_MAKEARGS)</set>
</if>
</define-tag>
</define-rule>
<!-- Forces the presence of the $(id) option into the final makefile; -->
<!-- this rule (which is really used more like a tag) is a tweaky way -->
<!-- to tell Bakefile not to remove from the final makefile an option -->
<!-- which has been qualified as 'useless'. -->
<!-- See bakefile docs for the VARS_DONT_ELIMINATE global switch. -->
<!-- Usage sample: -->
<!-- <force-opt-presence id="MY_USELESS_OPTION"/> -->
<define-rule name="force-opt-presence" extends="phony">
<template id="dummytemplate_for_$(id)">
<set var="dummy_for_$(id)"><if cond="$(id)=='dummy'">AAA</if></set>
</template>
</define-rule>
<!-- exactly like <copy-files> but this target just does not contain the "if not exist"
check and thus always performs the copy of the files (maybe overwriting old
versions of them). -->
<define-rule name="force-copy-files" extends="action">
<template>
<is-phony/>
<set var="__srcdir"/>
<!--
DigitalMars' smake has problems with long command lines, so we
have to work around it. More details here:
http://sourceforge.net/mailarchive/message.php?msg_id=9595825
-->
<if cond="TOOLSET=='win32' and FORMAT=='dmars_smake'">
<set var="__copy_depends" eval="0">
$(''.join(['$(__srcdir)%s ' % (x) for x in __files.split()]))
</set>
<set var="__deps" append="1">$(__copy_depends)</set>
<set var="__copy_script_name">$(FORMAT)_copy_$(id).bat</set>
</if>
<set var="__copy_cmd" eval="0">
<if cond="TOOLSET=='unix'">
@mkdir -p $(__dstdir)
@for f in $(__files); do \
cp -pRf $(__srcdir)$(DOLLAR)$(DOLLAR)f $(__dstdir) ; \
done
</if>
<if cond="TOOLSET in ['win32','os2'] and FORMAT!='mingw' and FORMAT!='dmars_smake'">
if not exist $(__dstdir) mkdir $(__dstdir)
for %f in ($(__files)) do copy $(__srcdir)%f $(__dstdir)
</if>
<if cond="TOOLSET=='win32' and FORMAT=='dmars_smake'">
if not exist $(__dstdir) mkdir $(__dstdir)
echo copy $(__srcdir)%%1 $(__dstdir)\%%1 > $(__copy_script_name)
!$(__copy_script_name) $**
del $(__copy_script_name)
</if>
<if cond="TOOLSET=='win32' and FORMAT=='mingw'">
if not exist $(__dstdir) mkdir $(__dstdir)
for %%f in ($(__files)) do copy $(__srcdir)%%f $(__dstdir)
</if>
</set>
<command>$(__copy_cmd)</command>
</template>
<define-tag name="dstdir">
<set var="__dstdir">$(nativePaths(value))</set>
</define-tag>
<define-tag name="srcdir">
<set var="__srcdir">$(nativePaths(value))$(DIRSEP)</set>
</define-tag>
<define-tag name="files">
<set var="__files">$(' '.join(value.split()))</set>
</define-tag>
</define-rule>
</makefile>
|