]> git.saurik.com Git - wxWidgets.git/blob - src/makeg95.env
Only call GetBestSize if one or both of the minsize components are unset.
[wxWidgets.git] / src / makeg95.env
1 #
2 # makeg95.env
3 # Common makefile settings for wxWindows programs
4 # This file is included by all the other makefiles, thus changes
5 # made here take effect everywhere (except where overriden).
6 # The settings are for GnuWin32-derived compilers, i.e. Cygwin and Mingw32.
7 #
8 # Customize this file to match your own settings.
9 #
10 # CVS_ID: $Id$
11 #
12
13 # The MINGW32 and MINGW32VERSION variables are preconfigured for
14 # MinGW gcc version 3.x and must both be changed for any version
15 # earlier than 3.0 or for cygwin. Editing this file is one way to
16 # change them. An easier way, at least with GNU make, is to override
17 # them on the command line, e.g.
18 # make MINGW32=0 MINGW32VERSION=2.8 -f makefile.g95
19
20 # If using Mingw32 (any version), set this to 1.
21 # If using Cygwin (any version), set this to 0.
22 #
23 # This agrees with the instructions given in docs/msw/install.txt .
24 # Earlier versions of this makefile suggested setting MINGW32=1 for
25 # recent versions of cygwin, but that would give the wrong dll entry
26 # point in src/msw/makefile.g95 .
27 #
28 # With cygwin, there are still some problems compiling wxWindows
29 # this way; './configure && make' may work better.
30 #
31 MINGW32=1
32
33 # set MIN_SUFFIX to nothing if you use only MinGW compiler, set it to
34 # something MinGW-specific if you want to build wxWindows with more than one
35 # compiler
36 ifeq ($(MINGW32),1)
37 MIN_SUFFIX=_min
38 else
39 MIN_SUFFIX=_cyg
40 endif
41
42 # Set to your gcc version. Generally 'gcc --version' tells you
43 # which version you have. But it cannot distinguish between
44 # 2.95.2-1 and earlier suffix versions of 2.95 . In that case,
45 # inspect the dates of bin/gcc.exe and bin/ld.exe ; if they
46 # are at least
47 # 2000-01-21 for gcc.exe and
48 # 2000-02-04 for ld.exe
49 # then use '2.95-late'.
50 #
51 # gcc 2.8.x and earlier require struct-return workaround
52 #MINGW32VERSION=2.8
53 #
54 # gcc 2.95.2 and earlier requires special thunk option
55 #MINGW32VERSION=2.9-early
56 #
57 # mingw gcc-2.95.2-1 supports '-shared'
58 # windres provided with gcc-2.95.2-1 supports temp file option
59 #MINGW32VERSION=2.95-late
60 #
61 # gcc 3.x provides a win32api.h header
62 MINGW32VERSION=3.0
63
64 # If you want to compile on Wine, simply uncomment this variable
65 # If you don't want to edit the file, you can simply define it
66 # on the command line like so: make WINE=1 -f makefile.g95
67 #WINE=1
68
69 # Set this if you are using a cross-compiler, i.e. compiling on one system
70 # the program for another one
71 # CROSS=i386-mingw32-
72
73 # If we're using MSYS, or other utilities that use forward slashes,
74 # you need to set this when invoking the makefile from DOS, or the
75 # wrong separators will be assumed. However, if you're using MSYS,
76 # you really ought to invoke the makefile from MSYS--or, even better,
77 # use the './configure && make' technique that MSYS is designed for.
78 ifndef WINE
79 #OSTYPE=msys
80 else
81 OSTYPE=msys
82 endif
83
84 # If building DLL, the version
85 include $(WXDIR)/src/version.mak
86 WXVERSION=$(wxMAJOR_VERSION)$(wxMINOR_VERSION)$(wxRELEASE_NUMBER_IFUNSTABLE)
87
88 ifndef UNICODE
89 UNICODE=0
90 endif
91
92 ifndef FINAL
93 FINAL=0
94 endif
95
96 ifndef wxUSE_GUI
97 wxUSE_GUI=1
98 endif
99
100 # Set to the appropriate remove command (must support forward slashes)
101 # You can get a suitable rm.exe from ports/mingw32/extra.zip on the ftp site.
102 RM=rm -f
103
104 # Set to the appropriate copy command (must support forward slashes)
105 # You can get a suitable cp.exe from ports/mingw32/extra.zip on the ftp site.
106 COPY=cp
107
108 ########################## Compiler ##################################
109
110 ifneq (,$(findstring $(MINGW32VERSION),2.8))
111 # According to Guillermo Rodriguez Garcia <guille@iies.es>, the
112 # -fno-pcc-struct-return option is needed to make the standard div()
113 # function work - otherwise it returns absolutely incorrect results
114 # which breaks the wxImage class. This was fixed on 1998-08-14 for
115 # mingw and cygwin. It is preferable not to use this option where it
116 # is not required, because it is documented to cause binary API
117 # incompatibility.
118 _STRUCT_RETURN_WORKAROUND=-fno-pcc-struct-return
119 # Really old versions of cygwin are thought to require extra headers.
120 ifneq ($(MINGW32),1)
121 GNUWIN32EXTRA=-I$(WXDIR)/include/wx/msw/gnuwin32
122 endif
123 endif
124
125 ifneq (,$(findstring $(MINGW32VERSION),2.8 2.9-early))
126 # Earlier versions of this makefile defined the following macros
127 # explicitly; mingw versions since at least '2.95-late' define
128 # them already.
129 OBSOLETE_DEFINES = -D_X86_=1 -DWIN32 -D_WIN32 -D__WIN32__
130 endif
131 # But cygwin doesn't define them, at least through its version
132 # 2.95.3-4 of gcc.
133 ifneq ($(MINGW32),1)
134 OBSOLETE_DEFINES = -D_X86_=1 -DWIN32 -D_WIN32 -D__WIN32__
135 endif
136
137 ifneq (,$(findstring $(MINGW32VERSION),2.8 2.9-early 2.95-late))
138 # Versions prior to 3.0 require -fvtable-thunks for OLE support.
139 # All code must be built with this option, even C++ libraries you
140 # only link to, including system libraries. This option can cause
141 # subtle problems with multiple inheritance.
142 _THUNK_WORKAROUND=-fvtable-thunks
143 endif
144
145 ifeq (,$(findstring $(MINGW32VERSION),2.8 2.9-early))
146 # Versions since 2.95.2-1 support '-shared', which makes linking
147 # a dll *much* faster; and the accompanying windres supports
148 # '--use-temp-file', which is more robust.
149 LD_SUPPORTS_SHARED=yes
150 _USE_TEMP_FILE_IF_SUPPORTED=--use-temp-file
151 # Use the WIN32 wxDirDialog only if we have a recent mingw version
152 RECENT_MINGW=yes
153 endif
154
155 ifeq (,$(findstring $(MINGW32VERSION),2.8 2.9-early 2.95-late))
156 # Versions since 3.0 provide win32api.h . An old comment said to
157 # define this 'if you have w32api >= 0.5', but mingw 2.95.2-1
158 # has no such header.
159 ifndef WINE
160 _USE_W32API_HEADER_IF_SUPPORTED = -DHAVE_W32API_H
161 endif
162 #
163 # Revision 1.70.2.6 of this file suggested '--pipe' for mingw but
164 # not for cygwin, and only for version 3.0 or later. Since then,
165 # the advice given here
166 # http://mail.gnu.org/pipermail/autoconf/2000-July/005479.html
167 # is followed, and '--pipe' is not used unless you specify it on
168 # the make command line, e.g.
169 # make CXXFLAGS=--pipe CFLAGS=--pipe -f makefile.g95
170 #
171 endif
172
173 # Define the C++ and C compiler respectively
174 ifndef WINE
175 CXX = $(CROSS)g++
176 CC = $(CROSS)gcc
177 else
178 CXX = wineg++
179 CC = winegcc
180 endif
181
182 # Compiler used for LEX generated C
183 # For now at least, it can be the same as the regular C compiler
184 CCLEX = $(CROSS)$(CC)
185
186 # This shouldn't be needed as make is supposed to define this
187 # variable itself. Uncomment it if your make complains.
188 #MAKE=make
189
190 # LEX (currently unused)
191 # LEX=flex # -t -L
192
193 # YACC (currently unused)
194 # YACC=byacc
195 # YACC=bison
196
197 # Settings for Cyginw/Mingw32
198 # Some versions of windres cannot cope with the --preprocessor
199 # option. Uncomment the RCPREPROCESSOR line below if yours can.
200 ifndef WINE
201 RESCOMP=$(CROSS)windres $(_USE_TEMP_FILE_IF_SUPPORTED)
202 else
203 RESCOMP=wrc
204 endif
205 RCINPUTSWITCH=-i
206 RCOUTPUTSWITCH=-o
207 RCINCSWITCH=--include-dir
208 RCDEFSWITCH=--define
209 # Note that this can cause windres to fail (Win95/98 problem?)
210 # but commenting out RCPREPROCESSOR then does the trick.
211 #RCPREPROCESSOR=--preprocessor "$(CXX) -c -E -xc-header -DRC_INVOKED"
212
213 # Don't make this too long (e.g. by adding contrib/include/wx) because it will
214 # truncate the command line
215 RESFLAGS=$(RCPREPROCESSOR) $(RCINCSWITCH) $(WXDIR)/include $(RCEXTRAINC) $(RCDEFSWITCH) __WIN32__ $(RCDEFSWITCH) __WIN95__ $(RCDEFSWITCH) __GNUWIN32__
216
217 # Needed to build a DLL if your linker does not support --shared option.
218 AS = $(CROSS)as
219 DLLTOOL = $(CROSS)dlltool
220
221 ########################## Compiler flags #############################
222
223 # Unicode defines
224 ifeq ($(UNICODE),1)
225 UNICODE_OPT = -D_UNICODE -DUNICODE -DwxUSE_UNICODE=1
226 else
227 UNICODE_OPT =
228 endif
229
230 # Miscellaneous compiler options
231 OPTIONS = -DSTRICT $(_USE_W32API_HEADER_IF_SUPPORTED)
232
233 # Add "-mthreads" if you want to have threads under mingw32
234 # Add "-mno-cygwin" if you want to link with msvcrt.dll in Cywin and Wine
235 # Otherwise, you link against the native runtime (cygwin.dll
236 # or libc). Having the flag in mingw32 does not hurt as you
237 # always link against msvcrt.dll By default it should be on,
238 # to minimize dependencies on Cygwin, and have more correct
239 # filename behaviour in Wine.
240 COMMON_FLAGS = -mno-cygwin # -mthreads
241
242 # Debugging information
243 ifeq ($(FINAL),0)
244 DEBUGFLAGS = -g -D__WXDEBUG__
245 endif
246
247 WIN95=1
248
249 ifeq ($(WIN95),0)
250 # With 3.50, Win95 will use your existing icons to show smaller ones.
251 # With 4.0, you'll have to follow Win95 procedures for icons or you'll get the
252 # default Windows icon.
253 APPVER=3.50
254 WINVERSION=-DWINVER=0x0350 -D__GNUWIN32__ # Generic WIN32
255 else
256 APPVER=4.0 # 3.50
257 # This means 'enable Windows 95 features' (in wxWindows and in the compiler).
258 WINVERSION=-DWINVER=0x0400 -D__GNUWIN32__
259 endif
260
261 # This is never used and should be expunged.
262 # CPU=i386
263
264 # Suffixes
265 OBJSUFF=o
266 SRCSUFF=cpp
267 LIBPREFIX=lib
268 LIBSUFF=a
269 EXESUFF=.exe
270 RESSUFF=res
271 RSCSUFF=rsc
272
273 # Warnings
274 WARN = -Wall
275
276 # build wxbase/wxMSW
277 ifeq ($(wxUSE_GUI),1)
278 TOOLKIT=msw
279 GUI =
280 else
281 TOOLKIT=base
282 GUI = -DwxUSE_GUI=0
283 endif
284
285 ifeq ($(FINAL),1)
286 OPT = -O2 -fno-rtti -fno-exceptions
287 else
288 OPT = -fno-rtti -fno-exceptions
289 endif
290
291 # Options for ar archiver
292 AROPTIONS = ruv
293 AR = $(CROSS)ar
294 RANLIB = $(CROSS)ranlib
295
296 # Extra compiler libraries
297 COMPLIBS=
298
299 # Compiler or system-specific include paths
300 COMPPATHS=
301
302 ########################## Directories ###############################
303
304 OLELIBS=-lole32 -loleaut32 -luuid
305 BASELIBS=-lstdc++ -lgcc -lodbc32 -lwsock32
306 ifeq ($(wxUSE_GUI),1)
307 WINLIBS= $(BASELIBS) \
308 -lwinspool -lwinmm -lshell32 \
309 -lcomctl32 -lctl3d32 -lodbc32 -ladvapi32 \
310 -lodbc32 -lwsock32 -lopengl32 -lglu32 $(OLELIBS) # -loldnames
311 else
312 WINLIBS=$(BASELIBS)
313 endif
314
315 #WINLIBS=-lstdc++ -lgcc \
316 # -lwinspool -lwinmm -lshell32 \
317 # -lcomctl32 -lctl3d32 -lodbc32 -ladvapi32 -lwsock32 # -loldnames
318
319 # Shouldn't need to change these...
320 WXSRC=$(WXDIR)/src/msw
321 WXINC=$(WXDIR)/include
322 WXBASESRC=$(WXDIR)/src/common
323
324 #ifeq ($(MINGW32),1)
325 #INC = -I$(WXINC) -I$(WXDIR)/contrib/include -I$(WXDIR)/src/png -I$(WXDIR)/src/jpeg -I$(WXDIR)/src/zlib -I$(WXDIR)/src/tiff $(EXTRAINC) $(COMPPATHS)
326 #else
327 INC = -I$(WXDIR)/lib/$(TOOLKIT)$(INCEXT) -I$(WXINC) -I$(WXDIR)/contrib/include -I$(WXDIR)/src/regex -I$(WXDIR)/src/png -I$(WXDIR)/src/jpeg -I$(WXDIR)/src/zlib -I$(WXDIR)/src/tiff $(EXTRAINC) $(COMPPATHS) $(GNUWIN32EXTRA)
328 #endif
329
330 RCLFLAGS=-cpp "cpp -lang-c++ $(OBSOLETE_DEFINES) -DRCL_INVOKED -I$(WXWIN)/include"
331
332 ifdef WXUSINGDLL
333 # png, jpeg, etc are exported from wx dll, so skip and save on link time.
334 LIBS = $(EXTRALIBS) $(WXLIB) $(WINLIBS) $(COMPLIBS)
335 else
336 LIBS = $(EXTRALIBS) $(WXLIB) -lregex$(MIN_SUFFIX) -lpng$(MIN_SUFFIX) -ljpeg$(MIN_SUFFIX) -lzlib$(MIN_SUFFIX) -ltiff$(MIN_SUFFIX) $(WINLIBS) $(COMPLIBS)
337 endif
338
339 WINFLAGS = $(OBSOLETE_DEFINES) $(WINVERSION)
340
341 #for windows 95
342 XINCLUDE=$(WINFLAGS)
343 XLIB=$(LIBS)
344 LDLIBS = $(LIBS)
345
346 # Directory for object files (don't change)
347 # OBJDIR = objects$(GUISUFFIX)
348 OBJDIR = .
349
350 ifeq ($(FINAL),1)
351 DEBEXT=
352 else
353 DEBEXT=d
354 endif
355
356 ifeq ($(UNICODE),1)
357 UNIEXT=u
358 else
359 UNIEXT=
360 endif
361
362 ifeq ($(WXMAKINGDLL)$(WXUSINGDLL),)
363 INCEXT=$(UNIEXT)$(DEBEXT)
364 else
365 INCEXT=dll$(UNIEXT)$(DEBEXT)
366 endif
367
368 WXLIB=$(WXDIR)/lib/$(LIBPREFIX)wx$(TOOLKIT)$(UNIEXT)$(DEBEXT).$(LIBSUFF)
369
370 ifdef WXMAKINGDLL
371 EXTRADLLFLAGS = -DWXMAKINGDLL=1 -D_DLL=1 -D_WINDLL=1
372 WXLIB=$(WXDIR)/lib/$(LIBPREFIX)wx$(TOOLKIT)$(WXVERSION)$(UNIEXT)$(DEBEXT)$(MIN_SUFFIX).$(LIBSUFF)
373 endif
374
375 ifdef WXUSINGDLL
376 EXTRADLLFLAGS = -DWXUSINGDLL=1
377 WXLIB=$(WXDIR)/lib/$(LIBPREFIX)wx$(TOOLKIT)$(WXVERSION)$(UNIEXT)$(DEBEXT)$(MIN_SUFFIX).$(LIBSUFF)
378 endif
379
380
381 ifeq ($(wxUSE_GUI),1)
382 WINDOWSLDFLAGS=-Wl,--subsystem,windows
383 WINDOWSLDLIBS=-mwindows
384 endif
385
386 # Note: WIN32_LEAN_AND_MEAN is defined only for C and not for C++ compiles.
387 # Defining this macro means that a great deal of less commonly used stuff
388 # is ignored in the windows headers, resulting in faster compiles. It can't
389 # be used with some C++ source files. It just so happens that it can be
390 # used with all C source files.
391
392 CFLAGS = -DWIN32_LEAN_AND_MEAN
393
394 WXLIBDIRS = -L$(WXDIR)/lib -L$(WXDIR)/contrib/lib
395
396 # You shouldn't need to change these flags, which are merely composed of
397 # the options selected above. You can add more flags by specifying them on
398 # the make command line, e.g.
399 # make CXXFLAGS='-O3 -march=i686' -f makefile.g95
400 # The gnu make manual says
401 # 'Users expect to be able to specify CFLAGS freely themselves'
402 # That was unsafe with older versions of this makefile, but now it works.
403 #
404 # C preprocessor flags
405 # Some makefiles pass extra flags in $(EXTRACPPFLAGS); although earlier
406 # versions of this file used CPPFLAGS as C++ compiler flags (instead of
407 # as C preprocessor flags), it is OK to add them to the preprocessor
408 # flags, which are always used for C++ compiles. Because other makefiles
409 # use this method to override these flags, they are added after $(CPPFLAGS),
410 # which would normally come last.
411 ALL_CPPFLAGS = $(XINCLUDE) $(INC) $(CPPFLAGS) $(EXTRACPPFLAGS)
412 # C and C++ compiler flags for compatibility with old gcc versions
413 REQUIRED_GCC_FLAGS = $(_STRUCT_RETURN_WORKAROUND) $(_THUNK_WORKAROUND)
414 # C++ compiler flags
415 ALL_CXXFLAGS = $(COMMON_FLAGS) $(REQUIRED_GCC_FLAGS) $(UNICODE_OPT) $(OPTIONS) $(GUI) $(DEBUGFLAGS) $(WARN) $(OPT) $(EXTRADLLFLAGS) $(CXXFLAGS)
416 # C compiler flags
417 ALL_CFLAGS = $(COMMON_FLAGS) $(REQUIRED_GCC_FLAGS) $(UNICODE_OPT) $(OPTIONS) $(GUI) $(DEBUGFLAGS) $(WARN) $(OPT) $(EXTRADLLFLAGS) $(CFLAGS)
418 # Linker flags
419 ALL_LDFLAGS = $(COMMON_FLAGS) $(WINDOWSLDFLAGS) $(WINDOWSLDLIBS) $(WXLIBDIRS) $(EXTRALDFLAGS) $(LDFLAGS)
420 # under Cygwin, Dlls must not be linked with subsystem=windows
421 ALL_LDFLAGS_DLL = $(COMMON_FLAGS) $(WINDOWSLDLIBS) $(WXLIBDIRS) $(EXTRALDFLAGS) $(LDFLAGS)
422
423 .SUFFIXES: .rc .$(RESSUFF) .$(RSCSUFF) .cpp .cxx .cc .c
424
425 .c.o:
426 $(CC) -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) -o $@ $*.c
427
428 .cc.o:
429 $(CXX) -c $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -o $@ $*.cc
430
431 .cxx.o:
432 $(CXX) -c $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -o $@ $*.cxx
433
434 # This '.cpp.o' rule is apparently written this way because
435 # the 'tmake' file g95.t expects it.
436 .$(SRCSUFF).$(OBJSUFF):
437 $(CXX) -c $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -o $@ $*.$(SRCSUFF)