]> git.saurik.com Git - wxWidgets.git/blame - src/makeg95.env
merged 2 overloaded functions into a single membersections
[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
b994671d
MB
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
78e376b5
MB
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
fe5de1ea 62MINGW32VERSION=3.0
2bda0e17 63
5283098e
JS
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
78e376b5
MB
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.
5283098e 74ifndef WINE
8a653baa 75#OSTYPE=msys
5283098e
JS
76else
77OSTYPE=msys
78endif
2b5f62a0 79
75515c52 80# If building DLL, the version
35af98e4 81include $(WXDIR)/src/version.mak
34b6a45a 82WXVERSION=$(wxMAJOR_VERSION)$(wxMINOR_VERSION)$(wxRELEASE_NUMBER_IFUNSTABLE)
b3bd664a
MB
83
84ifndef UNICODE
c448540d
MB
85 UNICODE=0
86endif
87
88ifndef FINAL
8a653baa 89 FINAL=0
c448540d
MB
90endif
91
92ifndef wxUSE_GUI
93 wxUSE_GUI=1
b3bd664a 94endif
75515c52 95
102f951d
GRG
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.
014e19de 98RM=rm -f
6474416b 99
102f951d 100# Set to the appropriate copy command (must support forward slashes)
a20a10fe
JS
101# You can get a suitable cp.exe from ports/mingw32/extra.zip on the ftp site.
102COPY=cp
01dba85a 103
2bda0e17
KB
104########################## Compiler ##################################
105
78e376b5
MB
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
f3ef286f 120
78e376b5
MB
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__
5991550a 126endif
78e376b5
MB
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__
5991550a 131endif
46c0c2dc 132
78e376b5
MB
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
f3ef286f 139endif
2bda0e17 140
78e376b5
MB
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.
5283098e 155ifndef WINE
78e376b5 156 _USE_W32API_HEADER_IF_SUPPORTED = -DHAVE_W32API_H
5283098e 157endif
78e376b5
MB
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
5283098e
JS
169# Define the C++ and C compiler respectively
170ifndef WINE
78e376b5 171CXX = g++
78e376b5 172CC = gcc
5283098e
JS
173else
174CXX = wineg++
175CC = winegcc
176endif
2bda0e17
KB
177
178# Compiler used for LEX generated C
78e376b5
MB
179# For now at least, it can be the same as the regular C compiler
180CCLEX = $(CC)
2bda0e17 181
102f951d
GRG
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
2bda0e17 185
102f951d 186# LEX (currently unused)
78e376b5 187# LEX=flex # -t -L
2bda0e17 188
102f951d 189# YACC (currently unused)
78e376b5
MB
190# YACC=byacc
191# YACC=bison
2bda0e17 192
57c208c5 193# Settings for Cyginw/Mingw32
102f951d
GRG
194# Some versions of windres cannot cope with the --preprocessor
195# option. Uncomment the RCPREPROCESSOR line below if yours can.
5283098e 196ifndef WINE
78e376b5 197RESCOMP=windres $(_USE_TEMP_FILE_IF_SUPPORTED)
5283098e
JS
198else
199RESCOMP=wrc
200endif
57c208c5
JS
201RCINPUTSWITCH=-i
202RCOUTPUTSWITCH=-o
203RCINCSWITCH=--include-dir
204RCDEFSWITCH=--define
9f334bea
JS
205# Note that this can cause windres to fail (Win95/98 problem?)
206# but commenting out RCPREPROCESSOR then does the trick.
78e376b5 207#RCPREPROCESSOR=--preprocessor "$(CXX) -c -E -xc-header -DRC_INVOKED"
2bda0e17 208
f4bfe7e0
JS
209# Don't make this too long (e.g. by adding contrib/include/wx) because it will
210# truncate the command line
53fdeb16 211RESFLAGS=$(RCPREPROCESSOR) $(RCINCSWITCH) $(WXDIR)/include $(RCEXTRAINC) $(RCDEFSWITCH) __WIN32__ $(RCDEFSWITCH) __WIN95__ $(RCDEFSWITCH) __GNUWIN32__
2bda0e17 212
75515c52 213# Needed to build a DLL if your linker does not support --shared option.
8a653baa
JS
214AS = as
215DLLTOOL = dlltool
75515c52 216
2bda0e17
KB
217########################## Compiler flags #############################
218
e13f1288
MB
219# Unicode defines
220ifeq ($(UNICODE),1)
221 UNICODE_OPT = -D_UNICODE -DUNICODE -DwxUSE_UNICODE=1
222else
223 UNICODE_OPT =
224endif
225
2bda0e17 226# Miscellaneous compiler options
78e376b5 227OPTIONS = -DSTRICT $(_USE_W32API_HEADER_IF_SUPPORTED)
2bda0e17 228
a0b9e27f 229# Add "-mthreads" if you want to have threads under mingw32
2e38557f 230# Add "-mno-cygwin" if you want to link with msvcrt.dll in Cywin and Wine
d66dcb60
MB
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.
2e38557f 236COMMON_FLAGS = -mno-cygwin # -mthreads
a0b9e27f 237
2bda0e17 238# Debugging information
c448540d
MB
239ifeq ($(FINAL),0)
240 DEBUGFLAGS = -g -D__WXDEBUG__
241endif
2bda0e17 242
2bda0e17
KB
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
78e376b5 250WINVERSION=-DWINVER=0x0350 -D__GNUWIN32__ # Generic WIN32
2bda0e17 251else
102f951d 252APPVER=4.0 # 3.50
78e376b5 253# This means 'enable Windows 95 features' (in wxWindows and in the compiler).
d66dcb60 254WINVERSION=-DWINVER=0x0400 -D__GNUWIN32__
2bda0e17
KB
255endif
256
78e376b5
MB
257# This is never used and should be expunged.
258# CPU=i386
2bda0e17
KB
259
260# Suffixes
261OBJSUFF=o
262SRCSUFF=cpp
263LIBPREFIX=lib
264LIBSUFF=a
265EXESUFF=.exe
266RESSUFF=res
267RSCSUFF=rsc
268
269# Warnings
2bda0e17
KB
270WARN = -Wall
271
c448540d
MB
272# build wxbase/wxMSW
273ifeq ($(wxUSE_GUI),1)
274 TOOLKIT=msw
d66dcb60 275 GUI =
c448540d
MB
276else
277 TOOLKIT=base
d66dcb60 278 GUI = -DwxUSE_GUI=0
c448540d
MB
279endif
280
c448540d 281ifeq ($(FINAL),1)
78e376b5 282 OPT = -O2 -fno-rtti -fno-exceptions
c448540d 283else
78e376b5 284 OPT = -fno-rtti -fno-exceptions
c448540d 285endif
2bda0e17
KB
286
287# Options for ar archiver
2bda0e17 288AROPTIONS = ruv
78e376b5 289AR = ar
8a653baa 290RANLIB = ranlib
2bda0e17 291
b4fe5125
JS
292# Extra compiler libraries
293COMPLIBS=
2bda0e17
KB
294
295# Compiler or system-specific include paths
48d1144b 296COMPPATHS=
2bda0e17 297
2bda0e17
KB
298########################## Directories ###############################
299
ae090fdb 300OLELIBS=-lole32 -loleaut32 -luuid
c448540d
MB
301BASELIBS=-lstdc++ -lgcc -lodbc32 -lwsock32
302ifeq ($(wxUSE_GUI),1)
303 WINLIBS= $(BASELIBS) \
d66dcb60
MB
304 -lwinspool -lwinmm -lshell32 \
305 -lcomctl32 -lctl3d32 -lodbc32 -ladvapi32 \
306 -lodbc32 -lwsock32 -lopengl32 -lglu32 $(OLELIBS) # -loldnames
c448540d
MB
307else
308 WINLIBS=$(BASELIBS)
309endif
b4fe5125
JS
310
311#WINLIBS=-lstdc++ -lgcc \
d66dcb60 312# -lwinspool -lwinmm -lshell32 \
b4fe5125 313# -lcomctl32 -lctl3d32 -lodbc32 -ladvapi32 -lwsock32 # -loldnames
2bda0e17
KB
314
315# Shouldn't need to change these...
6a570331
RR
316WXSRC=$(WXDIR)/src/msw
317WXINC=$(WXDIR)/include
318WXBASESRC=$(WXDIR)/src/common
f3ef286f 319
f6a35171 320#ifeq ($(MINGW32),1)
9d8c2f41 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)
f6a35171 322#else
78e376b5 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)
f6a35171 324#endif
f3ef286f 325
78e376b5 326RCLFLAGS=-cpp "cpp -lang-c++ $(OBSOLETE_DEFINES) -DRCL_INVOKED -I$(WXWIN)/include"
2bda0e17 327
75515c52
GRG
328ifdef WXUSINGDLL
329 # png, jpeg, etc are exported from wx dll, so skip and save on link time.
711df835 330 LIBS = $(EXTRALIBS) $(WXLIB) $(WINLIBS) $(COMPLIBS)
75515c52 331else
b994671d 332 LIBS = $(EXTRALIBS) $(WXLIB) -lregex$(MIN_SUFFIX) -lpng$(MIN_SUFFIX) -ljpeg$(MIN_SUFFIX) -lzlib$(MIN_SUFFIX) -ltiff$(MIN_SUFFIX) $(WINLIBS) $(COMPLIBS)
75515c52 333endif
2bda0e17 334
78e376b5 335WINFLAGS = $(OBSOLETE_DEFINES) $(WINVERSION)
2bda0e17
KB
336
337#for windows 95
338XINCLUDE=$(WINFLAGS)
339XLIB=$(LIBS)
340LDLIBS = $(LIBS)
341
342# Directory for object files (don't change)
dbda9e86 343# OBJDIR = objects$(GUISUFFIX)
881eba2c 344OBJDIR = .
2bda0e17 345
c448540d
MB
346ifeq ($(FINAL),1)
347 DEBEXT=
348else
349 DEBEXT=d
350endif
351
b3bd664a
MB
352ifeq ($(UNICODE),1)
353 UNIEXT=u
354else
355 UNIEXT=
356endif
357
358ifeq ($(WXMAKINGDLL)$(WXUSINGDLL),)
c448540d 359 INCEXT=$(UNIEXT)$(DEBEXT)
b3bd664a 360else
c448540d 361 INCEXT=dll$(UNIEXT)$(DEBEXT)
b3bd664a
MB
362endif
363
c448540d
MB
364WXLIB=$(WXDIR)/lib/$(LIBPREFIX)wx$(TOOLKIT)$(UNIEXT)$(DEBEXT).$(LIBSUFF)
365
75515c52
GRG
366ifdef WXMAKINGDLL
367 EXTRADLLFLAGS = -DWXMAKINGDLL=1 -D_DLL=1 -D_WINDLL=1
b994671d 368 WXLIB=$(WXDIR)/lib/$(LIBPREFIX)wx$(TOOLKIT)$(WXVERSION)$(UNIEXT)$(DEBEXT)$(MIN_SUFFIX).$(LIBSUFF)
75515c52
GRG
369endif
370
371ifdef WXUSINGDLL
372 EXTRADLLFLAGS = -DWXUSINGDLL=1
b994671d 373 WXLIB=$(WXDIR)/lib/$(LIBPREFIX)wx$(TOOLKIT)$(WXVERSION)$(UNIEXT)$(DEBEXT)$(MIN_SUFFIX).$(LIBSUFF)
75515c52
GRG
374endif
375
376
c448540d 377ifeq ($(wxUSE_GUI),1)
78e376b5
MB
378 WINDOWSLDFLAGS=-Wl,--subsystem,windows
379 WINDOWSLDLIBS=-mwindows
c448540d 380endif
2bda0e17 381
78e376b5
MB
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
2e38557f 411ALL_CXXFLAGS = $(COMMON_FLAGS) $(REQUIRED_GCC_FLAGS) $(UNICODE_OPT) $(OPTIONS) $(GUI) $(DEBUGFLAGS) $(WARN) $(OPT) $(EXTRADLLFLAGS) $(CXXFLAGS)
78e376b5 412# C compiler flags
2e38557f 413ALL_CFLAGS = $(COMMON_FLAGS) $(REQUIRED_GCC_FLAGS) $(UNICODE_OPT) $(OPTIONS) $(GUI) $(DEBUGFLAGS) $(WARN) $(OPT) $(EXTRADLLFLAGS) $(CFLAGS)
78e376b5 414# Linker flags
2e38557f 415ALL_LDFLAGS = $(COMMON_FLAGS) $(WINDOWSLDFLAGS) $(WINDOWSLDLIBS) $(WXLIBDIRS) $(EXTRALDFLAGS) $(LDFLAGS)
78e376b5 416# under Cygwin, Dlls must not be linked with subsystem=windows
2e38557f 417ALL_LDFLAGS_DLL = $(COMMON_FLAGS) $(WINDOWSLDLIBS) $(WXLIBDIRS) $(EXTRALDFLAGS) $(LDFLAGS)
78e376b5 418
2b5f62a0 419.SUFFIXES: .rc .$(RESSUFF) .$(RSCSUFF) .cpp .cxx .cc .c
2bda0e17
KB
420
421.c.o:
78e376b5 422 $(CC) -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) -o $@ $*.c
2bda0e17 423
2b5f62a0 424.cc.o:
78e376b5 425 $(CXX) -c $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -o $@ $*.cc
2b5f62a0 426
e828e4f7 427.cxx.o:
78e376b5 428 $(CXX) -c $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -o $@ $*.cxx
e828e4f7 429
78e376b5
MB
430# This '.cpp.o' rule is apparently written this way because
431# the 'tmake' file g95.t expects it.
9b97ee33 432.$(SRCSUFF).$(OBJSUFF):
78e376b5 433 $(CXX) -c $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -o $@ $*.$(SRCSUFF)