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