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