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