Fixes to allow DLL compilation
[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 # CVS_ID: $Id$
9 #
10
11 # If using Cygwin, set this to 0.
12 # If using Mingw32, set this to 1.
13 MINGW32=1
14
15 # Set to the version you have
16 MINGW32VERSION=2.95
17
18 # If building DLL, the version
19 WXVERSION=21_11
20
21 # Say yes if you have a "modern" linker that supports --shared option.
22 # Note that you're probably going to wait forever for dlltool/gcc/etc
23 # to build the DLL, so you should really use a newer linker that
24 # supports --shared.
25 LD_SUPPORTS_SHARED=yes
26
27 # Set to the appropriate remove command
28 RM=rm -f 
29
30 # Set to the appropriate copy command and separator
31 COPY=cp
32
33 ########################## Compiler ##################################
34
35 # C++ compiler
36 # Put a comment before --pipe for Cygwin, remove comment for Mingw32 2.95
37
38 ifeq ($(MINGW32),1)
39   ifneq "$(findstring 2.95, $(MINGW32VERSION))" ""
40     CC = gcc --pipe -fvtable-thunks
41   else
42     CC = gcc
43   endif
44 else
45   CC = gcc
46 endif
47
48 # C compiler for pure C programs
49 CCC = $(CC)
50
51 # Compiler used for LEX generated C
52 CCLEX=gcc
53
54 # GRG: This shouldn't be here! make is supposed to define the
55 # MAKE variable itself.
56 MAKE=make
57
58 # LEX
59 LEX=flex # -t -L
60
61 # YACC. yacc or bison
62 YACC=byacc
63 #YACC=bison
64
65 # Settings for Cyginw/Mingw32
66 RESCOMP=windres
67 RCINPUTSWITCH=-i
68 RCOUTPUTSWITCH=-o
69 RCINCSWITCH=--include-dir
70 RCDEFSWITCH=--define
71
72 RESFLAGS=$(RCINCSWITCH) $(WXDIR)/include $(RCDEFSWITCH) __WIN32__ $(RCDEFSWITCH) __WIN95__ $(RCDEFSWITCH) __GNUWIN32__
73
74 # Needed to build a DLL if your linker does not support --shared option.
75 AS = as
76 DLLTOOL = dlltool
77
78 ########################## Compiler flags #############################
79
80 # Miscellaneous compiler options
81 # GRG: the __MINGW32__ option is not needed anymore
82 OPTIONS = -DSTRICT # -D__MINGW32__
83
84 # Debugging information
85 DEBUGFLAGS = -D__WXDEBUG__
86
87 WIN95=1
88
89 ifeq ($(WIN95),0)
90 # With 3.50, Win95 will use your existing icons to show smaller ones.
91 # With 4.0, you'll have to follow Win95 procedures for icons or you'll get the
92 # default Windows icon.
93 APPVER=3.50
94 WINVERSION=-DWINVER=0x0350 -D__GNUWIN32__ -D__WIN32__ # Generic WIN32
95 else
96 APPVER=3.50 # 4.0
97 # This means 'enable Windows 95 features' (in wxWindows and in VC++ 4.0).
98 WINVERSION=-DWINVER=0x0400 -D__WIN95__ -D__GNUWIN32__ -D__WIN32__
99 endif
100
101 CPU=i386
102
103 # Suffixes
104 OBJSUFF=o
105 SRCSUFF=cpp
106 LIBPREFIX=lib
107 LIBSUFF=a
108 EXESUFF=.exe
109 RESSUFF=res
110 RSCSUFF=rsc
111
112 # Warnings
113 WARN = -Wall
114
115 # Which GUI, -Dwx_xview or -Dwx_motif (don't change this)
116 GUI = -D__WXMSW__ -D__WINDOWS__
117
118 # According to Guillermo Rodriguez Garcia <guille@iies.es>, the
119 # -fno-pcc-struct-return option is needed to make the standard div()
120 # function work - otherwise it returns absolutely incorrect results
121 # which breaks the wxImage class. This is true at least for
122 # mingw32-gcc2.8.1, don't know about others.
123 OPT = -fno-pcc-struct-return -O2 -fno-rtti -fno-exceptions
124
125 # Options for ar archiver
126 # AROPTIONS = crs # For IRIX and Solaris (both SYSVR4).
127 AR = ar
128 AROPTIONS = ruv
129 RANLIB = ranlib
130
131 # Extra compiler libraries
132 COMPLIBS=
133
134 # Compiler or system-specific include paths
135 COMPPATHS=
136
137 ########################## Directories ###############################
138
139 WINLIBS=-lstdc++ -lgcc \
140         -lwinspool -lwinmm -lshell32 \
141         -lcomctl32 -lctl3d32 -lodbc32 -ladvapi32 \
142         -lole32 -loleaut32 -luuid \
143         -lodbc32 -lwsock32#  -loldnames
144
145 #WINLIBS=-lstdc++ -lgcc \
146 #       -lwinspool -lwinmm -lshell32 \
147 #    -lcomctl32 -lctl3d32 -lodbc32 -ladvapi32 -lwsock32 # -loldnames
148
149 # Shouldn't need to change these...
150 WXSRC=$(WXDIR)/src/msw
151 WXINC=$(WXDIR)/include
152 WXBASESRC=$(WXDIR)/src/common
153 WXLIB=$(WXDIR)/lib/$(LIBPREFIX)wx.$(LIBSUFF)
154
155 GNUWIN32EXTRA=-I$(WXDIR)/include/wx/msw/gnuwin32 
156
157 ifeq ($(MINGW32),1)
158   ifneq "$(findstring 2.95, $(MINGW32VERSION))" ""
159     GNUWIN32EXTRA=
160   endif
161 endif
162
163 ifeq ($(MINGW32),1)
164 INC = -I$(WXINC) -I$(WXDIR)/src/png -I$(WXDIR)/src/jpeg -I$(WXDIR)/src/zlib -I$(WXDIR)/src/xpm -I$(WXDIR)/src/tiff $(EXTRAINC) $(COMPPATHS)
165 else
166 INC = -I$(WXINC) -I$(WXDIR)/src/png -I$(WXDIR)/src/jpeg -I$(WXDIR)/src/zlib -I$(WXDIR)/src/xpm -I$(WXDIR)/src/tiff $(EXTRAINC) $(COMPPATHS) -I$(WXDIR)/include/wx/msw/gnuwin32 
167 endif
168
169 RCLFLAGS=-cpp "cpp -lang-c++ -DWIN32 -D_WIN32 -DRCL_INVOKED -I$(WXWIN)/include"
170
171 ifdef WXUSINGDLL
172   # png, jpeg, etc are exported from wx dll, so skip and save on link time.
173   LIBS = $(WXLIB) $(WINLIBS) $(COMPLIBS) $(EXTRALIBS)
174 else
175   LIBS = $(WXLIB) -lpng -ljpeg -lzlib -lxpm -ltiff $(WINLIBS) $(COMPLIBS) $(EXTRALIBS)
176 endif
177
178 WINFLAGS=-D_X86_=1 -DWIN32 -D_WIN32 $(WINVERSION)
179
180 #for windows 95
181 XINCLUDE=$(WINFLAGS)
182 XLIB=$(LIBS)
183 LDLIBS = $(LIBS)
184
185 # Directory for object files (don't change)
186 # OBJDIR = objects$(GUISUFFIX)
187 OBJDIR = .
188
189 ifdef WXMAKINGDLL
190   EXTRADLLFLAGS = -DWXMAKINGDLL=1 -D_DLL=1 -D_WINDLL=1
191   WXLIB=$(WXDIR)/lib/$(LIBPREFIX)wx$(WXVERSION).$(LIBSUFF)
192 endif
193
194 ifdef WXUSINGDLL
195   EXTRADLLFLAGS = -DWXUSINGDLL=1
196   WXLIB=$(WXDIR)/lib/$(LIBPREFIX)wx$(WXVERSION).$(LIBSUFF)
197 endif
198
199
200 # You shouldn't need to change these...
201 CPPFLAGS = $(XINCLUDE) $(INC) $(OPTIONS) $(GUI) $(DEBUGFLAGS) $(WARN) $(OPT) $(EXTRACPPFLAGS) $(EXTRADLLFLAGS)
202 CFLAGS = $(XINCLUDE) $(INC) $(OPTIONS) $(GUI) $(DEBUGFLAGS) $(WARN) $(OPT) $(EXTRACFLAGS) -DWIN32_LEAN_AND_MEAN
203 WINDOWSLDFLAGS=-Wl,--subsystem,windows -mwindows
204 LDFLAGS = $(WINDOWSLDFLAGS) -L$(WXDIR)/lib $(EXTRALDFLAGS)
205
206 .SUFFIXES: .rc .$(RESSUFF) .$(RSCSUFF) .cpp .c
207
208 .$(SRCSUFF).$(OBJSUFF):
209         $(CC) -c $(CPPFLAGS) -o $@ $*.$(SRCSUFF)
210
211 .c.o:
212         $(CC) -c $(CFLAGS) -o $@ $*.c
213
214