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