]>
Commit | Line | Data |
---|---|---|
83c7f6a7 | 1 | <?xml version="1.0" ?> |
83c7f6a7 VS |
2 | |
3 | <!-- | |
4 | Presents for building wxWidgets applications using Autoconf or GNU toosets. | |
5 | See wx.bkl for platform-independent notes. | |
6 | ||
83c7f6a7 VS |
7 | Format-specific notes: |
8 | ||
9 | * autoconf: | |
7fb02ea7 FM |
10 | Beware that you have to use WX_CONFIG_OPTIONS and |
11 | WX_CONFIG_CHECK in your configure.in to get at least the | |
e602dae8 | 12 | WX_CPPFLAGS, WX_CFLAGS, WX_CXXFLAGS, WX_LIBS option values defined. |
7fb02ea7 | 13 | |
e602dae8 | 14 | To detect the WX_* option values typically you also want to use |
7fb02ea7 FM |
15 | the WX_STANDARD_OPTIONS, WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS, |
16 | WX_CONFIG_CHECK and finally WX_DETECT_STANDARD_OPTION_VALUES macros | |
17 | (see wxwin.m4 for more info). | |
83c7f6a7 VS |
18 | |
19 | --> | |
20 | ||
21 | ||
22 | <makefile> | |
23 | ||
e602dae8 KO |
24 | |
25 | ||
83c7f6a7 VS |
26 | <!-- ============================================================== --> |
27 | <!-- Autoconf --> | |
28 | <!-- ============================================================== --> | |
9864ef3b | 29 | |
83c7f6a7 | 30 | <if cond="FORMAT=='autoconf'"> |
83c7f6a7 VS |
31 | <option name="WX_CFLAGS"/> |
32 | <option name="WX_CXXFLAGS"/> | |
33 | <option name="WX_CPPFLAGS"/> | |
34 | <option name="WX_LIBS"/> | |
692ebda6 | 35 | <option name="WX_RESCOMP"/> |
e602dae8 KO |
36 | <option name="WX_VERSION_MAJOR"/> |
37 | <option name="WX_VERSION_MINOR"/> | |
e606c822 | 38 | <option name="WX_PORT"/> |
e602dae8 | 39 | |
e606c822 | 40 | <!-- wxwin.m4 macros will detect all WX_* options defined above --> |
e602dae8 KO |
41 | |
42 | ||
43 | <!-- VERY IMPORTANT: <wx-lib>base</wx-lib> must be the last wx-lib tag | |
44 | in all your bakefiles !! | |
45 | --> | |
46 | <define-tag name="wx-lib" rules="exe,dll,module"> | |
47 | <if cond="value=='base'"> | |
48 | <!-- all wx-dependent libraries should have been already listed | |
49 | thus we can now add WX_LIBS to the linker line --> | |
50 | <ldlibs>$(WX_LIBS)</ldlibs> | |
e606c822 | 51 | </if> |
18cea871 | 52 | <if cond="value not in WX_LIB_LIST.split()"> |
e602dae8 KO |
53 | <error>Unknown wxWidgets library given in the wx-lib tag</error> |
54 | </if> | |
55 | </define-tag> | |
56 | </if> | |
57 | ||
9864ef3b | 58 | |
83c7f6a7 VS |
59 | <!-- ============================================================== --> |
60 | <!-- GNU makefiles for Unix --> | |
61 | <!-- ============================================================== --> | |
62 | ||
63 | <if cond="FORMAT=='gnu'"> | |
e602dae8 KO |
64 | |
65 | <!-- remove those WX_* vars which were created just to avoid the definition | |
66 | of the WX_* options in wx.bkl --> | |
67 | <unset var="WX_SHARED"/> | |
68 | <unset var="WX_UNICODE"/> | |
e602dae8 KO |
69 | <unset var="WX_PORT"/> |
70 | <unset var="WX_VERSION"/> | |
71 | ||
369e0d05 | 72 | <set var="WX_CONFIG_DEFAULT" overwrite="0">wx-config</set> |
83c7f6a7 | 73 | <option name="WX_CONFIG"> |
369e0d05 | 74 | <default-value>$(WX_CONFIG_DEFAULT)</default-value> |
83c7f6a7 VS |
75 | <description>Location and arguments of wx-config script</description> |
76 | </option> | |
e602dae8 KO |
77 | |
78 | <set var="WX_PORT_DEFAULT" overwrite="0"> | |
e5405b6b | 79 | $(DOLLAR)(shell $(WX_CONFIG) --query-toolkit) |
e602dae8 KO |
80 | </set> |
81 | <option name="WX_PORT"> | |
0e1f8ea4 | 82 | <values>gtk1,gtk2,msw,x11,motif,osx_cocoa,osx_carbon,dfb</values> |
e606c822 | 83 | <default-value force="1">$(WX_PORT_DEFAULT)</default-value> |
e602dae8 KO |
84 | <description> |
85 | Port of the wx library to build against | |
86 | </description> | |
87 | </option> | |
88 | ||
89 | <set var="WX_SHARED_DEFAULT" overwrite="0"> | |
e5405b6b | 90 | $(DOLLAR)(shell if test -z `$(WX_CONFIG) --query-linkage`; then echo 1; else echo 0; fi) |
e602dae8 KO |
91 | </set> |
92 | <option name="WX_SHARED"> | |
e606c822 VZ |
93 | <values>0,1</values> |
94 | <values-description>Static,DLL</values-description> | |
95 | <default-value force="1">$(WX_SHARED_DEFAULT)</default-value> | |
e602dae8 KO |
96 | <description> |
97 | Use DLL build of wx library to use? | |
98 | </description> | |
83c7f6a7 | 99 | </option> |
e602dae8 KO |
100 | |
101 | <set var="WX_UNICODE_DEFAULT" overwrite="0"> | |
e5405b6b | 102 | $(DOLLAR)(shell $(WX_CONFIG) --query-chartype | sed 's/unicode/1/;s/ansi/0/') |
e602dae8 KO |
103 | </set> |
104 | <option name="WX_UNICODE"> | |
e606c822 VZ |
105 | <values>0,1</values> |
106 | <values-description>ANSI,Unicode</values-description> | |
107 | <default-value force="1">$(WX_UNICODE_DEFAULT)</default-value> | |
e602dae8 KO |
108 | <description> |
109 | Compile Unicode build of wxWidgets? | |
110 | </description> | |
83c7f6a7 | 111 | </option> |
e602dae8 | 112 | |
e602dae8 | 113 | <set var="WX_VERSION_DEFAULT" overwrite="0"> |
e5405b6b | 114 | $(DOLLAR)(shell $(WX_CONFIG) --query-version | sed -e 's/\([0-9]*\)\.\([0-9]*\)/\1\2/') |
e602dae8 KO |
115 | </set> |
116 | <option name="WX_VERSION"> | |
117 | <default-value>$(WX_VERSION_DEFAULT)</default-value> | |
118 | <description> | |
119 | Version of the wx library to build against. | |
120 | </description> | |
692ebda6 | 121 | </option> |
83c7f6a7 | 122 | |
e602dae8 KO |
123 | <!-- Get MAJOR and MINOR version numbers --> |
124 | <set var="WX_VERSION_MAJOR" make_var="1"> | |
125 | $(DOLLAR)(shell echo $(DOLLAR)(WX_VERSION) | cut -c1,1) | |
126 | </set> | |
127 | <set var="WX_VERSION_MINOR" make_var="1"> | |
128 | $(DOLLAR)(shell echo $(DOLLAR)(WX_VERSION) | cut -c2,2) | |
129 | </set> | |
130 | ||
131 | ||
132 | <!-- | |
133 | Using the GNU format creates a configurable makefile just like | |
134 | a win32 makefile: i.e. a makefile where you can select the wanted | |
135 | wxWidgets build using the WX_* options. | |
136 | ||
046e85ca | 137 | The difference with win32 makefiles is that WX_PORT, WX_UNICODE and |
e602dae8 KO |
138 | WX_SHARED options have a smart default value which is created using |
139 | the installed wx-config or the wx-config given using WX_CONFIG option | |
140 | --> | |
e602dae8 KO |
141 | <set var="WX_CONFIG_UNICODE_FLAG"> |
142 | <if cond="WX_UNICODE=='0'">--unicode=no</if> | |
143 | <if cond="WX_UNICODE=='1'">--unicode=yes</if> | |
144 | </set> | |
145 | <set var="WX_CONFIG_SHARED_FLAG"> | |
146 | <if cond="WX_SHARED=='0'">--static=yes</if> | |
147 | <if cond="WX_SHARED=='1'">--static=no</if> | |
148 | </set> | |
149 | <set var="WX_CONFIG_PORT_FLAG"> | |
150 | --toolkit=$(WX_PORT) | |
151 | </set> | |
152 | <set var="WX_CONFIG_VERSION_FLAG"> | |
153 | --version=$(WX_VERSION_MAJOR).$(WX_VERSION_MINOR) | |
154 | </set> | |
155 | ||
156 | <set var="WX_CONFIG_FLAGS" make_var="1"> | |
046e85ca | 157 | $(WX_CONFIG_UNICODE_FLAG) $(WX_CONFIG_SHARED_FLAG) |
e602dae8 KO |
158 | $(WX_CONFIG_PORT_FLAG) $(WX_CONFIG_VERSION_FLAG) |
159 | </set> | |
160 | ||
e5405b6b | 161 | <set var="DEFAULT_CXX">`$(DOLLAR)(WX_CONFIG) --cxx`</set> |
e602dae8 KO |
162 | <set var="WX_CFLAGS">`$(DOLLAR)(WX_CONFIG) --cflags $(WX_CONFIG_FLAGS)`</set> |
163 | <set var="WX_CXXFLAGS">`$(DOLLAR)(WX_CONFIG) --cxxflags $(WX_CONFIG_FLAGS)`</set> | |
164 | <set var="WX_CPPFLAGS">`$(DOLLAR)(WX_CONFIG) --cppflags $(WX_CONFIG_FLAGS)`</set> | |
165 | <set var="WX_RESCOMP">`$(DOLLAR)(WX_CONFIG) --rescomp $(WX_CONFIG_FLAGS)`</set> | |
166 | ||
167 | <!-- | |
168 | VERY IMPORTANT: before starting to build all targets of the generated makefile, | |
169 | we need to check if the selected wxWidgets build exists; we do | |
170 | that simply creating the following target; if it fails the make | |
171 | program will halt with the wx-config error message... | |
172 | --> | |
a78a8f7f VZ |
173 | <if cond="WX_TEST_FOR_SELECTED_WXBUILD=='1'"> |
174 | <action id="test_for_selected_wxbuild"> | |
175 | <dependency-of>all</dependency-of> | |
176 | ||
177 | <!-- Use @ to hide to the user that we're running wx-config... --> | |
178 | <command>@$(DOLLAR)(WX_CONFIG) $(WX_CONFIG_FLAGS)</command> | |
179 | </action> | |
180 | </if> | |
e602dae8 | 181 | |
7fb02ea7 | 182 | <!-- we need these vars but the trick used in the default values above |
83c7f6a7 | 183 | prevents bakefile from detecting it: --> |
e602dae8 KO |
184 | <set var="FORMAT_OUTPUT_VARIABLES" append="1">WX_CONFIG WX_VERSION</set> |
185 | ||
186 | ||
187 | <!-- VERY IMPORTANT: <wx-lib>base</wx-lib> must be the last wx-lib tag | |
188 | in all your bakefiles !! | |
189 | --> | |
190 | <define-tag name="wx-lib" rules="exe,dll,module"> | |
191 | <if cond="value=='base'"> | |
192 | <!-- all wx libraries should have been already specified, thus | |
7fb02ea7 | 193 | $(__liblist) should contain the full list of required wxlibs... --> |
e602dae8 | 194 | <set var="__liblist" append="1">base</set> |
11469277 | 195 | <ldlibs>`$(WX_CONFIG) $(WX_CONFIG_FLAGS) --libs $(','.join(__liblist.split()))`</ldlibs> |
e602dae8 KO |
196 | </if> |
197 | <if cond="value!='base'"> | |
198 | <set var="__liblist" append="1">$(value)</set> | |
199 | </if> | |
18cea871 | 200 | <if cond="value not in WX_LIB_LIST.split()"> |
e602dae8 KO |
201 | <error>Unknown wxWidgets library given in the wx-lib tag</error> |
202 | </if> | |
203 | </define-tag> | |
83c7f6a7 | 204 | </if> |
9864ef3b | 205 | |
83c7f6a7 VS |
206 | <!-- ============================================================== --> |
207 | <!-- Common code --> | |
208 | <!-- ============================================================== --> | |
9864ef3b | 209 | |
83c7f6a7 VS |
210 | <if cond="FORMAT not in ['gnu','autoconf']"> |
211 | <error> | |
212 | Don't include presets/wx_unix.bkl directly, use presets/wx.bkl. | |
213 | </error> | |
214 | </if> | |
9864ef3b | 215 | |
692ebda6 | 216 | <!-- |
67533115 VZ |
217 | We need to re-define the WINDRES resource compiler name to the resource compiler |
218 | returned by 'wx-config - -rescomp' since this option returns both the name of the | |
219 | resource compiler to use (windres) and the flags required for that compiler. | |
692ebda6 JS |
220 | |
221 | This line typically does something *only* when the Makefile.in generated | |
222 | using this bakefile, is used on Windows with MSYS (when using Cygwin, resources | |
223 | are not compiled at all). | |
67533115 VZ |
224 | Without this line, in fact, when compiling with MSYS on Windows, the - -include-dir |
225 | option which tells windres to look in wxWidgets\include folder would be missing and | |
226 | then windres would fail to find the wxMSW resources. | |
227 | ||
228 | NOTE: overwriting the WINDRES variable we add wxWidgets resource flags to | |
229 | all targets which include this bakefile; this could be useless to those | |
230 | targets which are not wx-based eventually present in that bakefile but | |
231 | in any case it shouldn't do any harm. | |
692ebda6 | 232 | --> |
67533115 | 233 | <set var="WINDRES">$(WX_RESCOMP)</set> |
692ebda6 | 234 | |
c07e76fa | 235 | <template id="wx-lib"> |
83c7f6a7 VS |
236 | <cxxflags>$(WX_CXXFLAGS)</cxxflags> |
237 | <cflags>$(WX_CFLAGS)</cflags> | |
c07e76fa VS |
238 | </template> |
239 | ||
240 | <template id="wx" template="wx-lib"> | |
9864ef3b VZ |
241 | <!-- |
242 | Don't include the $(WX_LIBS) variable in linker options here since | |
243 | it would make impossible for the user to obtain the right library | |
244 | order when he needs to specify, *before* WX_LIBS, its own libraries | |
245 | that depend on wxWidgets libraries; to avoid this, we include | |
246 | $(WX_LIBS) as soon as we found the <wx-lib>base</wx-lib> tag which | |
247 | the user should always put *after* all other wx-dependent libraries | |
248 | --> | |
83c7f6a7 VS |
249 | </template> |
250 | ||
83c7f6a7 | 251 | </makefile> |