4 <!-- Original source: http://wiki.wxwidgets.org/wiki.pl?Bakefile -->
5 <!-- Modified by: Francesco Montorsi <frm@users.sourceforge.net> -->
6 <!-- Vaclav Slavik <vslavik@fastmail.fm> to better fit
7 into Bakefile's presets -->
8 <!-- Creation date: 6/9/2004 -->
9 <!-- Last revision: 22/1/2005 off-CVS -->
15 <requires version=
"0.2.1"/>
19 <!-- These are essentially the configurations you -->
20 <!-- want in bakefile. -->
22 <!-- In MSVC these are the different build -->
23 <!-- configurations you can have (in the build menu), -->
24 <!-- and in autoconf is enabled with enable-xxx=xx. -->
25 <!-- For other compilers a separate configuration -->
26 <!-- file is created (such as config.gcc on gcc) -->
27 <!-- which has several options a user can modify. -->
29 <!-- Note that the above only happens if an option -->
30 <!-- is not constant, i.e. if it cannot be determined -->
31 <!-- by bakefile itself. -->
32 <!-- Also note that for 'autoconf' format these options -->
33 <!-- are only useful when used together with wxpresets.m4 -->
34 <!-- macro file which contains macros for detecting the -->
35 <!-- option values for wx-based projects. See wxpresets.m4 -->
36 <!-- comments for more info. -->
40 <!-- HELPER VARIABLES -->
44 <!-- The unicode define we want. By default bakefile -->
45 <!-- makes variables an empty string, so if unicode -->
46 <!-- is not defined $(UNICODE_DEFINE) would expand -->
47 <!-- to nothing (literally). -->
48 <set var=
"WXUNICODE_DEFINE">
49 <if cond=
"WX_UNICODE=='1'">_UNICODE
</if>
52 <!-- The debug define we need with win32 compilers -->
53 <!-- (on Linux, the wx-config program is used). -->
54 <set var=
"WXDEBUG_DEFINE">
55 <if cond=
"WX_DEBUG=='1'">__WXDEBUG__
</if>
58 <!-- These are handy ways of dealing with the -->
59 <!-- extensions in the library names of the -->
60 <!-- wxWindows library. -->
61 <set var=
"WX3RDPARTYLIBPOSTFIX">
62 <if cond=
"WX_DEBUG=='1'">d
</if>
66 <if cond=
"FORMAT=='msevc4prj'">_$(CPU)
</if>
70 <if cond=
"WX_SHARED=='0'">$(DIRSEP)lib$(DIRSEP)$(COMPILER)$(WXCPU)_lib
</if>
71 <if cond=
"WX_SHARED=='1'">$(DIRSEP)lib$(DIRSEP)$(COMPILER)$(WXCPU)_dll
</if>
74 <!-- under Unix this is an option (detected at configure-time);
75 under Windows this is not an user option! -->
77 <if cond=
"FORMAT=='msevc4prj'">wince
</if>
78 <if cond=
"FORMAT!='msevc4prj'">msw
</if>
81 <set var=
"WXLIBINCLUDE">$(WXLIBPATH)$(DIRSEP)$(WX_PORT)$(WXLIBPOSTFIX)
</set>
84 <!-- All the possible mixes for the wx library names -->
85 <set var=
"WXLIB_BASE_NAME">
86 <if cond=
"WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='0'">wxbase$(WX_VERSION)
</if>
87 <if cond=
"WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='1'">wxbase$(WX_VERSION)d
</if>
88 <if cond=
"WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='0'">wxbase$(WX_VERSION)u
</if>
89 <if cond=
"WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='1'">wxbase$(WX_VERSION)ud
</if>
92 the trick used to support monolithic builds is here: when the
93 <wx-lib>base</wx-lib> tag is found, and user selected
94 WX_MONOLITHIC=1, then the base library is translated to the
97 <if cond=
"WX_MONOLITHIC=='1' and WX_UNICODE=='0' and WX_DEBUG=='0'">wx$(WX_PORT)$(WX_VERSION)
</if>
98 <if cond=
"WX_MONOLITHIC=='1' and WX_UNICODE=='0' and WX_DEBUG=='1'">wx$(WX_PORT)$(WX_VERSION)d
</if>
99 <if cond=
"WX_MONOLITHIC=='1' and WX_UNICODE=='1' and WX_DEBUG=='0'">wx$(WX_PORT)$(WX_VERSION)u
</if>
100 <if cond=
"WX_MONOLITHIC=='1' and WX_UNICODE=='1' and WX_DEBUG=='1'">wx$(WX_PORT)$(WX_VERSION)ud
</if>
104 <!-- Libraries whose name is prefixed with 'wxbase' -->
105 <define-global-tag name=
"define-wxbase-lib-name">
106 <set var=
"WXLIB_$(value.upper())_NAME">
107 <if cond=
"WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='0'">
108 wxbase$(WX_VERSION)_$(value)
110 <if cond=
"WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='1'">
111 wxbase$(WX_VERSION)d_$(value)
113 <if cond=
"WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='0'">
114 wxbase$(WX_VERSION)u_$(value)
116 <if cond=
"WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='1'">
117 wxbase$(WX_VERSION)ud_$(value)
122 <define-wxbase-lib-name>net
</define-wxbase-lib-name>
123 <define-wxbase-lib-name>xml
</define-wxbase-lib-name>
124 <define-wxbase-lib-name>odbc
</define-wxbase-lib-name>
127 <!-- Libraries whose name is prefixed with 'wx' only -->
128 <define-global-tag name=
"define-wxlib-name">
129 <set var=
"WXLIB_$(value.upper())_NAME">
130 <if cond=
"WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='0'">
131 wx$(WX_PORT)$(WX_VERSION)_$(value)
133 <if cond=
"WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='1'">
134 wx$(WX_PORT)$(WX_VERSION)d_$(value)
136 <if cond=
"WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='0'">
137 wx$(WX_PORT)$(WX_VERSION)u_$(value)
139 <if cond=
"WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='1'">
140 wx$(WX_PORT)$(WX_VERSION)ud_$(value)
145 <define-wxlib-name>core
</define-wxlib-name>
146 <define-wxlib-name>media
</define-wxlib-name>
147 <define-wxlib-name>xrc
</define-wxlib-name>
148 <define-wxlib-name>html
</define-wxlib-name>
149 <define-wxlib-name>adv
</define-wxlib-name>
150 <define-wxlib-name>qa
</define-wxlib-name>
151 <define-wxlib-name>dbgrid
</define-wxlib-name>
152 <define-wxlib-name>gl
</define-wxlib-name>
153 <define-wxlib-name>aui
</define-wxlib-name>
154 <define-wxlib-name>richtext
</define-wxlib-name>
163 <!-- While not required, templates make your -->
164 <!-- bakefiles much more readable. Templates, in -->
165 <!-- essence, are abstract classes like c++. -->
167 <!-- Your build targets "inherit" the template, -->
168 <!-- along with the info associated with the template -->
171 <!-- wxWidgets LIBRARY/APP TEMPLATE -->
173 <!-- The "base class" of all our build targets -->
174 <!-- This links with the appropriate native -->
175 <!-- libraries required by the platform, the libraries -->
176 <!-- we want for our stuff, and the wxWindows libs. -->
178 <!-- this tag is used to include wx libraries: -->
179 <define-tag name=
"wx-lib" rules=
"exe,dll,module">
180 <if cond=
"value=='base'"><sys-lib>$(WXLIB_BASE_NAME)
</sys-lib></if>
181 <if cond=
"value=='core'"><sys-lib>$(WXLIB_CORE_NAME)
</sys-lib></if>
183 <if cond=
"value=='net'"><sys-lib>$(WXLIB_NET_NAME)
</sys-lib></if>
184 <if cond=
"value=='xml'"><sys-lib>$(WXLIB_XML_NAME)
</sys-lib></if>
185 <if cond=
"value=='odbc'"><sys-lib>$(WXLIB_ODBC_NAME)
</sys-lib></if>
187 <if cond=
"value=='media'"><sys-lib>$(WXLIB_MEDIA_NAME)
</sys-lib></if>
188 <if cond=
"value=='xrc'"><sys-lib>$(WXLIB_XRC_NAME)
</sys-lib></if>
189 <if cond=
"value=='html'"><sys-lib>$(WXLIB_HTML_NAME)
</sys-lib></if>
190 <if cond=
"value=='adv'"><sys-lib>$(WXLIB_ADV_NAME)
</sys-lib></if>
191 <if cond=
"value=='gl'"><sys-lib>$(WXLIB_GL_NAME)
</sys-lib></if>
192 <if cond=
"value=='dbgrid'"><sys-lib>$(WXLIB_DBGRID_NAME)
</sys-lib></if>
193 <if cond=
"value=='qa'"><sys-lib>$(WXLIB_QA_NAME)
</sys-lib></if>
194 <if cond=
"value=='aui'"><sys-lib>$(WXLIB_AUI_NAME)
</sys-lib></if>
195 <if cond=
"value=='richtext'"><sys-lib>$(WXLIB_RICHTEXT_NAME)
</sys-lib></if>
197 <!-- wx-lib can be used also to link against contrib libraries
198 (which always have the same name, regardless of WX_MONOLITHIC value) -->
199 <if cond=
"value in CONTRIBLIB_LIST.split()">
200 <sys-lib>wx$(WX_PORT)$(WX_VERSION)$(WXLIBPOSTFIX)_$(value)
</sys-lib>
203 <if cond=
"value not in ALLLIB_LIST.split()">
204 <error>Unknown wxWidgets library given in the wx-lib tag
</error>
208 <!-- just a placeholder to mark the place where <wx-lib> will be placed,
209 thanks to the order precedence declaration below it: -->
210 <define-tag name=
"__wx-libs-point" rules=
"exe,dll,module"/>
211 <tag-info name=
"wx-lib"
212 position=
"before:__wx-libs-point"/>
213 <tag-info name=
"__wx-syslibs"
214 position=
"after:__wx-libs-point"/>
217 <!-- template for static wx libraries: -->
218 <template id=
"wx-lib">
219 <!-- MISCELLANEOUS -->
220 <if cond=
"FORMAT=='mingw'">
221 <define>HAVE_W32API_H
</define>
222 <ldflags>-mthreads
</ldflags>
225 <define>$(substituteFromDict(WX_SHARED,{'
1':'WXUSINGDLL','
0':''}))
</define>
227 <define>$(WXUNICODE_DEFINE)
</define>
228 <define>$(WXDEBUG_DEFINE)
</define>
229 <define>__WXMSW__
</define>
231 <include>$(WX_DIR)$(WXLIBINCLUDE)
</include>
232 <include>$(WX_DIR)/include
</include>
236 <!-- this ugly tag contains all sys-lib tags used by "wx" template,
237 in order to make sure they are not reorder when wx-lib is moved
238 after __wx-libs-point: -->
239 <define-tag name=
"__wx-syslibs" rules=
"exe,dll,module">
240 <!-- wx 3rd party libs, always use them: -->
241 <sys-lib cond=
"FORMAT!='msevc4prj'">wxtiff$(WX3RDPARTYLIBPOSTFIX)
</sys-lib>
242 <sys-lib>wxjpeg$(WX3RDPARTYLIBPOSTFIX)
</sys-lib>
243 <sys-lib>wxpng$(WX3RDPARTYLIBPOSTFIX)
</sys-lib>
244 <sys-lib>wxzlib$(WX3RDPARTYLIBPOSTFIX)
</sys-lib>
245 <!-- For regex we won't use the WX3RDPARTYLIBPOSTIX postfix:
246 unliked tiff, jpeg, png, zlib, expat, when building
247 in Unicode mode, the "u" suffix is appended to regex -->
248 <sys-lib cond=
"FORMAT!='msevc4prj'">wxregex$(WXLIBPOSTFIX)
</sys-lib>
249 <sys-lib>wxexpat$(WX3RDPARTYLIBPOSTFIX)
</sys-lib>
251 <!-- link-in system libs that wx depends on: -->
252 <!-- If on borland, we don't need to do much -->
253 <if cond=
"FORMAT=='borland'">
254 <sys-lib>ole2w32
</sys-lib>
255 <sys-lib>odbc32
</sys-lib>
258 <!-- Non-borland, on the other hand... -->
259 <if cond=
"FORMAT not in ['borland','msevc4prj']">
260 <sys-lib>kernel32
</sys-lib>
261 <sys-lib>user32
</sys-lib>
262 <sys-lib>gdi32
</sys-lib>
263 <sys-lib>comdlg32
</sys-lib>
264 <sys-lib>winspool
</sys-lib>
265 <sys-lib>winmm
</sys-lib>
266 <sys-lib>shell32
</sys-lib>
267 <sys-lib>comctl32
</sys-lib>
268 <sys-lib>ole32
</sys-lib>
269 <sys-lib>oleaut32
</sys-lib>
270 <sys-lib>uuid
</sys-lib>
271 <sys-lib>rpcrt4
</sys-lib>
272 <sys-lib>advapi32
</sys-lib>
273 <sys-lib>wsock32
</sys-lib>
274 <sys-lib>odbc32
</sys-lib>
277 <!-- Libs common to both borland and MSVC -->
278 <if cond=
"FORMAT=='msvc' or FORMAT=='msvc6prj' or FORMAT=='borland'">
279 <sys-lib>oleacc
</sys-lib>
283 <!-- template for wx executables/dlls: -->
284 <template id=
"wx" template=
"wx-lib">
285 <lib-path>$(WX_DIR)$(WXLIBPATH)
</lib-path>
287 <!-- wx libs must come before 3rd party and sys libs, this is
288 the place where the hack explained above is carried on: -->
293 <if cond=
"FORMAT_SUPPORTS_ACTIONS=='1'">
296 VERY IMPORTANT: before starting to build all targets of the generated makefile,
297 we need to check if the selected wxWidgets build exists; we do
298 that simply creating the following target; if it fails the make
299 program will halt printing the following nice error message...
300 (much better than the 'could not find wx/*.h file')
302 <action id=
"test_for_selected_wxbuild">
303 <dependency-of>all
</dependency-of>
305 <!-- the @ is to hide these actions from the user -->
307 @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \
308 echo ----------------------------------------------------------------------------
309 @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \
310 echo Selected wxWidgets build is not available!
311 @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \
312 echo Please use the options prefixed with WX_ to select another wxWidgets build.
313 @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \
314 echo ----------------------------------------------------------------------------
315 @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \