]> git.saurik.com Git - wxWidgets.git/blob - src/makeg95.env
183195b374d9be305a47d4f3c122f9b37a76c4a3
[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 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.
60 #OSTYPE=msys
61
62 # If building DLL, the version
63 WXVERSION=250
64
65 ifndef UNICODE
66 UNICODE=0
67 endif
68
69 ifndef FINAL
70 FINAL=0
71 endif
72
73 ifndef wxUSE_GUI
74 wxUSE_GUI=1
75 endif
76
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.
79 RM=rm -f
80
81 # Set to the appropriate copy command (must support forward slashes)
82 # You can get a suitable cp.exe from ports/mingw32/extra.zip on the ftp site.
83 COPY=cp
84
85 ########################## Compiler ##################################
86
87 ifneq (,$(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
100 endif
101
102 ifneq (,$(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__
107 endif
108 # But cygwin doesn't define them, at least through its version
109 # 2.95.3-4 of gcc.
110 ifneq ($(MINGW32),1)
111 OBSOLETE_DEFINES = -D_X86_=1 -DWIN32 -D_WIN32 -D__WIN32__
112 endif
113
114 ifneq (,$(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
120 endif
121
122 ifeq (,$(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
130 endif
131
132 ifeq (,$(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 #
146 endif
147
148 # C compiler
149 CXX = g++
150
151 # C compiler
152 CC = gcc
153
154 # Compiler used for LEX generated C
155 # For now at least, it can be the same as the regular C compiler
156 CCLEX = $(CC)
157
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
161
162 # LEX (currently unused)
163 # LEX=flex # -t -L
164
165 # YACC (currently unused)
166 # YACC=byacc
167 # YACC=bison
168
169 # Settings for Cyginw/Mingw32
170 # Some versions of windres cannot cope with the --preprocessor
171 # option. Uncomment the RCPREPROCESSOR line below if yours can.
172 RESCOMP=windres $(_USE_TEMP_FILE_IF_SUPPORTED)
173 RCINPUTSWITCH=-i
174 RCOUTPUTSWITCH=-o
175 RCINCSWITCH=--include-dir
176 RCDEFSWITCH=--define
177 # Note that this can cause windres to fail (Win95/98 problem?)
178 # but commenting out RCPREPROCESSOR then does the trick.
179 #RCPREPROCESSOR=--preprocessor "$(CXX) -c -E -xc-header -DRC_INVOKED"
180
181 # Don't make this too long (e.g. by adding contrib/include/wx) because it will
182 # truncate the command line
183 RESFLAGS=$(RCPREPROCESSOR) $(RCINCSWITCH) $(WXDIR)/include $(RCEXTRAINC) $(RCDEFSWITCH) __WIN32__ $(RCDEFSWITCH) __WIN95__ $(RCDEFSWITCH) __GNUWIN32__
184
185 # Needed to build a DLL if your linker does not support --shared option.
186 AS = as
187 DLLTOOL = dlltool
188
189 ########################## Compiler flags #############################
190
191 # Miscellaneous compiler options
192 OPTIONS = -DSTRICT $(_USE_W32API_HEADER_IF_SUPPORTED)
193
194 # Add "-mthreads" if you want to have threads under mingw32
195 COMMON_THREADFLAGS =
196
197 # Debugging information
198 ifeq ($(FINAL),0)
199 DEBUGFLAGS = -g -D__WXDEBUG__
200 endif
201
202 WIN95=1
203
204 ifeq ($(WIN95),0)
205 # With 3.50, Win95 will use your existing icons to show smaller ones.
206 # With 4.0, you'll have to follow Win95 procedures for icons or you'll get the
207 # default Windows icon.
208 APPVER=3.50
209 WINVERSION=-DWINVER=0x0350 -D__GNUWIN32__ # Generic WIN32
210 else
211 APPVER=4.0 # 3.50
212 # This means 'enable Windows 95 features' (in wxWindows and in the compiler).
213 WINVERSION=-DWINVER=0x0400 -D__WIN95__ -D__GNUWIN32__
214 endif
215
216 # This is never used and should be expunged.
217 # CPU=i386
218
219 # Suffixes
220 OBJSUFF=o
221 SRCSUFF=cpp
222 LIBPREFIX=lib
223 LIBSUFF=a
224 EXESUFF=.exe
225 RESSUFF=res
226 RSCSUFF=rsc
227
228 # Warnings
229 WARN = -Wall
230
231 # build wxbase/wxMSW
232 ifeq ($(wxUSE_GUI),1)
233 TOOLKIT=msw
234 GUI = -D__WXMSW__ -D__WINDOWS__
235 else
236 TOOLKIT=base
237 GUI = -D__WXMSW__ -D__WINDOWS__ -DwxUSE_GUI=0
238 endif
239
240 ifeq ($(FINAL),1)
241 OPT = -O2 -fno-rtti -fno-exceptions
242 else
243 OPT = -fno-rtti -fno-exceptions
244 endif
245
246 # Options for ar archiver
247 AROPTIONS = ruv
248 AR = ar
249 RANLIB = ranlib
250
251 # Extra compiler libraries
252 COMPLIBS=
253
254 # Compiler or system-specific include paths
255 COMPPATHS=
256
257 ########################## Directories ###############################
258
259 OLELIBS=-lole32 -loleaut32 -luuid
260 BASELIBS=-lstdc++ -lgcc -lodbc32 -lwsock32
261 ifeq ($(wxUSE_GUI),1)
262 WINLIBS= $(BASELIBS) \
263 -lwinspool -lwinmm -lshell32 \
264 -lcomctl32 -lctl3d32 -lodbc32 -ladvapi32 \
265 -lodbc32 -lwsock32 -lopengl32 -lglu32 $(OLELIBS) # -loldnames
266 else
267 WINLIBS=$(BASELIBS)
268 endif
269
270 #WINLIBS=-lstdc++ -lgcc \
271 # -lwinspool -lwinmm -lshell32 \
272 # -lcomctl32 -lctl3d32 -lodbc32 -ladvapi32 -lwsock32 # -loldnames
273
274 # Shouldn't need to change these...
275 WXSRC=$(WXDIR)/src/msw
276 WXINC=$(WXDIR)/include
277 WXBASESRC=$(WXDIR)/src/common
278
279 #ifeq ($(MINGW32),1)
280 #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)
281 #else
282 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)
283 #endif
284
285 RCLFLAGS=-cpp "cpp -lang-c++ $(OBSOLETE_DEFINES) -DRCL_INVOKED -I$(WXWIN)/include"
286
287 ifdef WXUSINGDLL
288 # png, jpeg, etc are exported from wx dll, so skip and save on link time.
289 LIBS = $(EXTRALIBS) $(WXLIB) $(WINLIBS) $(COMPLIBS)
290 else
291 LIBS = $(EXTRALIBS) $(WXLIB) -lregex -lpng -ljpeg -lzlib -ltiff $(WINLIBS) $(COMPLIBS)
292 endif
293
294 WINFLAGS = $(OBSOLETE_DEFINES) $(WINVERSION)
295
296 #for windows 95
297 XINCLUDE=$(WINFLAGS)
298 XLIB=$(LIBS)
299 LDLIBS = $(LIBS)
300
301 # Directory for object files (don't change)
302 # OBJDIR = objects$(GUISUFFIX)
303 OBJDIR = .
304
305 ifeq ($(FINAL),1)
306 DEBEXT=
307 else
308 DEBEXT=d
309 endif
310
311 ifeq ($(UNICODE),1)
312 UNIEXT=u
313 else
314 UNIEXT=
315 endif
316
317 ifeq ($(WXMAKINGDLL)$(WXUSINGDLL),)
318 INCEXT=$(UNIEXT)$(DEBEXT)
319 else
320 INCEXT=dll$(UNIEXT)$(DEBEXT)
321 endif
322
323 WXLIB=$(WXDIR)/lib/$(LIBPREFIX)wx$(TOOLKIT)$(UNIEXT)$(DEBEXT).$(LIBSUFF)
324
325 ifdef WXMAKINGDLL
326 EXTRADLLFLAGS = -DWXMAKINGDLL=1 -D_DLL=1 -D_WINDLL=1
327 WXLIB=$(WXDIR)/lib/$(LIBPREFIX)wx$(TOOLKIT)$(WXVERSION)$(UNIEXT)$(DEBEXT).$(LIBSUFF)
328 endif
329
330 ifdef WXUSINGDLL
331 EXTRADLLFLAGS = -DWXUSINGDLL=1
332 WXLIB=$(WXDIR)/lib/$(LIBPREFIX)wx$(TOOLKIT)$(WXVERSION)$(UNIEXT)$(DEBEXT).$(LIBSUFF)
333 endif
334
335
336 ifeq ($(wxUSE_GUI),1)
337 WINDOWSLDFLAGS=-Wl,--subsystem,windows
338 WINDOWSLDLIBS=-mwindows
339 endif
340
341 # Note: WIN32_LEAN_AND_MEAN is defined only for C and not for C++ compiles.
342 # Defining this macro means that a great deal of less commonly used stuff
343 # is ignored in the windows headers, resulting in faster compiles. It can't
344 # be used with some C++ source files. It just so happens that it can be
345 # used with all C source files.
346
347 CFLAGS = -DWIN32_LEAN_AND_MEAN
348
349 WXLIBDIRS = -L$(WXDIR)/lib -L$(WXDIR)/contrib/lib
350
351 # You shouldn't need to change these flags, which are merely composed of
352 # the options selected above. You can add more flags by specifying them on
353 # the make command line, e.g.
354 # make CXXFLAGS='-O3 -march=i686' -f makefile.g95
355 # The gnu make manual says
356 # 'Users expect to be able to specify CFLAGS freely themselves'
357 # That was unsafe with older versions of this makefile, but now it works.
358 #
359 # C preprocessor flags
360 # Some makefiles pass extra flags in $(EXTRACPPFLAGS); although earlier
361 # versions of this file used CPPFLAGS as C++ compiler flags (instead of
362 # as C preprocessor flags), it is OK to add them to the preprocessor
363 # flags, which are always used for C++ compiles. Because other makefiles
364 # use this method to override these flags, they are added after $(CPPFLAGS),
365 # which would normally come last.
366 ALL_CPPFLAGS = $(XINCLUDE) $(INC) $(CPPFLAGS) $(EXTRACPPFLAGS)
367 # C and C++ compiler flags for compatibility with old gcc versions
368 REQUIRED_GCC_FLAGS = $(_STRUCT_RETURN_WORKAROUND) $(_THUNK_WORKAROUND)
369 # C++ compiler flags
370 ALL_CXXFLAGS = $(COMMON_THREADFLAGS) $(REQUIRED_GCC_FLAGS) $(OPTIONS) $(GUI) $(DEBUGFLAGS) $(WARN) $(OPT) $(EXTRADLLFLAGS) $(CXXFLAGS)
371 # C compiler flags
372 ALL_CFLAGS = $(COMMON_THREADFLAGS) $(REQUIRED_GCC_FLAGS) $(OPTIONS) $(GUI) $(DEBUGFLAGS) $(WARN) $(OPT) $(EXTRADLLFLAGS) $(CFLAGS)
373 # Linker flags
374 ALL_LDFLAGS = $(COMMON_THREADFLAGS) $(WINDOWSLDFLAGS) $(WINDOWSLDLIBS) $(WXLIBDIRS) $(EXTRALDFLAGS) $(LDFLAGS)
375 # under Cygwin, Dlls must not be linked with subsystem=windows
376 ALL_LDFLAGS_DLL = $(COMMON_THREADFLAGS) $(WINDOWSLDLIBS) $(WXLIBDIRS) $(EXTRALDFLAGS) $(LDFLAGS)
377
378 .SUFFIXES: .rc .$(RESSUFF) .$(RSCSUFF) .cpp .cxx .cc .c
379
380 .c.o:
381 $(CC) -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) -o $@ $*.c
382
383 .cc.o:
384 $(CXX) -c $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -o $@ $*.cc
385
386 .cxx.o:
387 $(CXX) -c $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -o $@ $*.cxx
388
389 # This '.cpp.o' rule is apparently written this way because
390 # the 'tmake' file g95.t expects it.
391 .$(SRCSUFF).$(OBJSUFF):
392 $(CXX) -c $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -o $@ $*.$(SRCSUFF)