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