]> git.saurik.com Git - wxWidgets.git/blob - src/makeg95.env
merged 2 overloaded functions into a single membersections
[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 # 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.
74 ifndef WINE
75 #OSTYPE=msys
76 else
77 OSTYPE=msys
78 endif
79
80 # If building DLL, the version
81 include $(WXDIR)/src/version.mak
82 WXVERSION=$(wxMAJOR_VERSION)$(wxMINOR_VERSION)$(wxRELEASE_NUMBER_IFUNSTABLE)
83
84 ifndef UNICODE
85 UNICODE=0
86 endif
87
88 ifndef FINAL
89 FINAL=0
90 endif
91
92 ifndef wxUSE_GUI
93 wxUSE_GUI=1
94 endif
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.
98 RM=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.
102 COPY=cp
103
104 ########################## Compiler ##################################
105
106 ifneq (,$(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
119 endif
120
121 ifneq (,$(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__
126 endif
127 # But cygwin doesn't define them, at least through its version
128 # 2.95.3-4 of gcc.
129 ifneq ($(MINGW32),1)
130 OBSOLETE_DEFINES = -D_X86_=1 -DWIN32 -D_WIN32 -D__WIN32__
131 endif
132
133 ifneq (,$(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
139 endif
140
141 ifeq (,$(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
149 endif
150
151 ifeq (,$(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.
155 ifndef WINE
156 _USE_W32API_HEADER_IF_SUPPORTED = -DHAVE_W32API_H
157 endif
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 #
167 endif
168
169 # Define the C++ and C compiler respectively
170 ifndef WINE
171 CXX = g++
172 CC = gcc
173 else
174 CXX = wineg++
175 CC = winegcc
176 endif
177
178 # Compiler used for LEX generated C
179 # For now at least, it can be the same as the regular C compiler
180 CCLEX = $(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.
196 ifndef WINE
197 RESCOMP=windres $(_USE_TEMP_FILE_IF_SUPPORTED)
198 else
199 RESCOMP=wrc
200 endif
201 RCINPUTSWITCH=-i
202 RCOUTPUTSWITCH=-o
203 RCINCSWITCH=--include-dir
204 RCDEFSWITCH=--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
211 RESFLAGS=$(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.
214 AS = as
215 DLLTOOL = dlltool
216
217 ########################## Compiler flags #############################
218
219 # Unicode defines
220 ifeq ($(UNICODE),1)
221 UNICODE_OPT = -D_UNICODE -DUNICODE -DwxUSE_UNICODE=1
222 else
223 UNICODE_OPT =
224 endif
225
226 # Miscellaneous compiler options
227 OPTIONS = -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.
236 COMMON_FLAGS = -mno-cygwin # -mthreads
237
238 # Debugging information
239 ifeq ($(FINAL),0)
240 DEBUGFLAGS = -g -D__WXDEBUG__
241 endif
242
243 WIN95=1
244
245 ifeq ($(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.
249 APPVER=3.50
250 WINVERSION=-DWINVER=0x0350 -D__GNUWIN32__ # Generic WIN32
251 else
252 APPVER=4.0 # 3.50
253 # This means 'enable Windows 95 features' (in wxWindows and in the compiler).
254 WINVERSION=-DWINVER=0x0400 -D__GNUWIN32__
255 endif
256
257 # This is never used and should be expunged.
258 # CPU=i386
259
260 # Suffixes
261 OBJSUFF=o
262 SRCSUFF=cpp
263 LIBPREFIX=lib
264 LIBSUFF=a
265 EXESUFF=.exe
266 RESSUFF=res
267 RSCSUFF=rsc
268
269 # Warnings
270 WARN = -Wall
271
272 # build wxbase/wxMSW
273 ifeq ($(wxUSE_GUI),1)
274 TOOLKIT=msw
275 GUI =
276 else
277 TOOLKIT=base
278 GUI = -DwxUSE_GUI=0
279 endif
280
281 ifeq ($(FINAL),1)
282 OPT = -O2 -fno-rtti -fno-exceptions
283 else
284 OPT = -fno-rtti -fno-exceptions
285 endif
286
287 # Options for ar archiver
288 AROPTIONS = ruv
289 AR = ar
290 RANLIB = ranlib
291
292 # Extra compiler libraries
293 COMPLIBS=
294
295 # Compiler or system-specific include paths
296 COMPPATHS=
297
298 ########################## Directories ###############################
299
300 OLELIBS=-lole32 -loleaut32 -luuid
301 BASELIBS=-lstdc++ -lgcc -lodbc32 -lwsock32
302 ifeq ($(wxUSE_GUI),1)
303 WINLIBS= $(BASELIBS) \
304 -lwinspool -lwinmm -lshell32 \
305 -lcomctl32 -lctl3d32 -lodbc32 -ladvapi32 \
306 -lodbc32 -lwsock32 -lopengl32 -lglu32 $(OLELIBS) # -loldnames
307 else
308 WINLIBS=$(BASELIBS)
309 endif
310
311 #WINLIBS=-lstdc++ -lgcc \
312 # -lwinspool -lwinmm -lshell32 \
313 # -lcomctl32 -lctl3d32 -lodbc32 -ladvapi32 -lwsock32 # -loldnames
314
315 # Shouldn't need to change these...
316 WXSRC=$(WXDIR)/src/msw
317 WXINC=$(WXDIR)/include
318 WXBASESRC=$(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
323 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)
324 #endif
325
326 RCLFLAGS=-cpp "cpp -lang-c++ $(OBSOLETE_DEFINES) -DRCL_INVOKED -I$(WXWIN)/include"
327
328 ifdef WXUSINGDLL
329 # png, jpeg, etc are exported from wx dll, so skip and save on link time.
330 LIBS = $(EXTRALIBS) $(WXLIB) $(WINLIBS) $(COMPLIBS)
331 else
332 LIBS = $(EXTRALIBS) $(WXLIB) -lregex$(MIN_SUFFIX) -lpng$(MIN_SUFFIX) -ljpeg$(MIN_SUFFIX) -lzlib$(MIN_SUFFIX) -ltiff$(MIN_SUFFIX) $(WINLIBS) $(COMPLIBS)
333 endif
334
335 WINFLAGS = $(OBSOLETE_DEFINES) $(WINVERSION)
336
337 #for windows 95
338 XINCLUDE=$(WINFLAGS)
339 XLIB=$(LIBS)
340 LDLIBS = $(LIBS)
341
342 # Directory for object files (don't change)
343 # OBJDIR = objects$(GUISUFFIX)
344 OBJDIR = .
345
346 ifeq ($(FINAL),1)
347 DEBEXT=
348 else
349 DEBEXT=d
350 endif
351
352 ifeq ($(UNICODE),1)
353 UNIEXT=u
354 else
355 UNIEXT=
356 endif
357
358 ifeq ($(WXMAKINGDLL)$(WXUSINGDLL),)
359 INCEXT=$(UNIEXT)$(DEBEXT)
360 else
361 INCEXT=dll$(UNIEXT)$(DEBEXT)
362 endif
363
364 WXLIB=$(WXDIR)/lib/$(LIBPREFIX)wx$(TOOLKIT)$(UNIEXT)$(DEBEXT).$(LIBSUFF)
365
366 ifdef WXMAKINGDLL
367 EXTRADLLFLAGS = -DWXMAKINGDLL=1 -D_DLL=1 -D_WINDLL=1
368 WXLIB=$(WXDIR)/lib/$(LIBPREFIX)wx$(TOOLKIT)$(WXVERSION)$(UNIEXT)$(DEBEXT)$(MIN_SUFFIX).$(LIBSUFF)
369 endif
370
371 ifdef WXUSINGDLL
372 EXTRADLLFLAGS = -DWXUSINGDLL=1
373 WXLIB=$(WXDIR)/lib/$(LIBPREFIX)wx$(TOOLKIT)$(WXVERSION)$(UNIEXT)$(DEBEXT)$(MIN_SUFFIX).$(LIBSUFF)
374 endif
375
376
377 ifeq ($(wxUSE_GUI),1)
378 WINDOWSLDFLAGS=-Wl,--subsystem,windows
379 WINDOWSLDLIBS=-mwindows
380 endif
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
388 CFLAGS = -DWIN32_LEAN_AND_MEAN
389
390 WXLIBDIRS = -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.
407 ALL_CPPFLAGS = $(XINCLUDE) $(INC) $(CPPFLAGS) $(EXTRACPPFLAGS)
408 # C and C++ compiler flags for compatibility with old gcc versions
409 REQUIRED_GCC_FLAGS = $(_STRUCT_RETURN_WORKAROUND) $(_THUNK_WORKAROUND)
410 # C++ compiler flags
411 ALL_CXXFLAGS = $(COMMON_FLAGS) $(REQUIRED_GCC_FLAGS) $(UNICODE_OPT) $(OPTIONS) $(GUI) $(DEBUGFLAGS) $(WARN) $(OPT) $(EXTRADLLFLAGS) $(CXXFLAGS)
412 # C compiler flags
413 ALL_CFLAGS = $(COMMON_FLAGS) $(REQUIRED_GCC_FLAGS) $(UNICODE_OPT) $(OPTIONS) $(GUI) $(DEBUGFLAGS) $(WARN) $(OPT) $(EXTRADLLFLAGS) $(CFLAGS)
414 # Linker flags
415 ALL_LDFLAGS = $(COMMON_FLAGS) $(WINDOWSLDFLAGS) $(WINDOWSLDLIBS) $(WXLIBDIRS) $(EXTRALDFLAGS) $(LDFLAGS)
416 # under Cygwin, Dlls must not be linked with subsystem=windows
417 ALL_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)