]> git.saurik.com Git - wxWidgets.git/blame - src/makevc.env
guard against errors like in wxStringBase::AllocBeforeWrite code (1123226)
[wxWidgets.git] / src / makevc.env
CommitLineData
227869da 1#
af111fc3 2# File: makevc.env
227869da
JS
3# Author: Ulrich Leodolter
4# Created: Wed May 17 08:36:42 1995
5# Updated:
6#
7# MSVC++ 32-bit makefile include file
8#
9!include <ntwin32.mak>
10
34b6a45a
VZ
11# read version numbers
12!include "version.mak"
13WXVERSION=$(wxMAJOR_VERSION)$(wxMINOR_VERSION)$(wxRELEASE_NUMBER_IFUNSTABLE)
14
0580ae4b
GT
15!if "$(RM)" == ""
16RM= erase
17!endif
18
2b5f62a0 19# WIN95 means "all systems newer than Win95", i.e. Win9x and NT 4+
227869da
JS
20WIN95=1
21
22!if "$(WIN95)" == "0"
23# With 3.50, Win95 will use your existing icons to show smaller ones.
24# With 4.0, you'll have to follow Win95 procedures for icons or you'll get the
25# default Windows icon.
26APPVER=3.50
27WINVERSION=-DWINVER=0x0350 # Generic WIN32
28!else
2b5f62a0 29APPVER=4.0
227869da 30# This means 'enable Windows 95 features' (in wxWindows and in VC++ 4.0).
fb5230de 31WINVERSION=-DWINVER=0x0400
227869da
JS
32!endif
33
34# On Alpha machines, change to CPU=ALPHA
35CPU=i386
36
37# Suffixes
38OBJSUFF=obj
39SRCSUFF=cpp
40
e12f91dc
RD
41WAITFLAG=/w
42
fb5230de
MB
43# If you set wxUSE_IOSTREAMH to 0, remove
44# -Dtry=__try -Dexcept=__except -Dleave=__leave -Dfinally=__finally
4de85398 45#WINFLAGS=-c -W3 -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -D_X86_=1 -DWIN32 -D__WIN32__ $(WINVERSION) -DSTRICT
fb5230de
MB
46WINFLAGS=-c -W3 -nologo -DWIN32 -D_WINDOWS $(WINVERSION) -DSTRICT
47WINLINKFLAGS=-nologo -machine:$(CPU) -subsystem:windows,$(APPVER)
48BASELINKFLAGS=-nologo -machine:$(CPU) -subsystem:console,$(APPVER)
49WINLIBS=kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib \
50 shell32.lib oldnames.lib comctl32.lib odbc32.lib ole32.lib oleaut32.lib \
51 uuid.lib rpcrt4.lib advapi32.lib wsock32.lib \
52 # libci.lib # libci.lib required for VC++ 4.2
227869da 53
b4d1ebf0
RD
54# Set a WXWIN environment variable be the path to your WXWIN directory
55WXDIR=$(WXWIN)
227869da
JS
56
57WXSRC=$(WXDIR)\src\msw
58WXINC=$(WXDIR)\include
59WXBASESRC=$(WXDIR)\src\common
60
61#####################################################################
62# These are the possible DLL/non-DLL usages:
63#
64# Type _DLL/_WINDLL WXUSINGDLL WXMAKINGDLL Library
65#--------------------------------------------------------------------
66# Normal application - - - wx.lib
67#
cb1b6606 68# wxWin as DLL Defined - Defined wx$(WXVERSION).lib
227869da 69#
cb1b6606 70# App using wxWin DLL - Defined - wx$(WXVERSION).lib
227869da
JS
71#
72# App built as one DLL Defined - - wx.lib
73#
74######################################################################
75#
76# Compiling your app:
77#--------------------
78# when compiling an app to use the DLL version of wxWindows
79# (but not to be a DLL itself), set WXUSINGDLL to 1 in your
80# makefile just before including ntwxwin.mak.
81# To compile wxWin _and_ app itself as a DLL, set DLL to 1
82# in ntwxwin.mak, and do not set WXUSINGDLL.
83#
84# Compiling wxWindows:
85#---------------------
86# Use the dll target to compile wxWindows as DLL; then make 'pch'
87# to generate a precompiled header for your apps to use. BUG: must compile without
88# wxExpr (USE_WX_RESOURCES = 0) for this to link properly. Don't know why yet.
89# Use the dllapp target to compile wxWindows for making a DLL app (not implemented yet)
90
91#DLL=0
92
227869da
JS
93!if "$(WXUSINGDLL)" == "1"
94EXTRADLLFLAGS=/DWXUSINGDLL=1
95!endif
96
97!if "$(WXMAKINGDLL)" == "1"
98EXTRADLLFLAGS=/DWXMAKINGDLL=1
99!endif
100
101!if "$(WXMAKINGDLL)" == "0" && "$(DLL)" == "1"
102EXTRADLLFLAGS=
103!endif
104
105!if "$(NOMAIN)" == "1"
106EXTRADLLFLAGS=$(EXTRADLLFLAGS) /DNOMAIN
107!endif
108
b3bd664a
MB
109!ifndef UNICODE
110UNICODE=0
111!endif
112
2417bf69
RD
113!ifndef MSLU
114MSLU=0
115!endif
116
227869da
JS
117!ifndef FINAL
118FINAL=0
fb5230de
MB
119!endif
120
121!ifndef DEBUGINFO
122!if "$(FINAL)" == "0"
123DEBUGINFO=1
124!else
125DEBUGINFO=0
126!endif
227869da
JS
127!endif
128
129!ifndef DLL
130DLL=0
131!endif
132
133# Set this to 1 if you don't want to use precompiled headers
134!ifndef NOPCH
135NOPCH=0
136!endif
137
fb5230de
MB
138# This sets 'D' to a suitable directory name: [Base](Debug|Release|Hybrid)[Dll]
139# for this kind of build, and WXLIBNAME to one of wx(msw|base)[u][d] (static),
140# wx(msw|base)$(WXVERSION)[u][d] (DLL)
ca5c8b2d 141
fb5230de
MB
142!if "$(UNICODE)" == "1"
143_WXLIB_SUFFIX=u
144_WXINC_SUFFIX=u
145_WXDIR_UNICODESUFFIX=Unicode
a4fe6524
RD
146!endif
147
fb5230de
MB
148!if "$(WXMAKINGDLL)" == "1" || "$(WXUSINGDLL)" == "1"
149_WXLIB_VERSION=$(WXVERSION)
150_WXDIR_DLLSUFFIX=Dll
151_WXINC_DLLSUFFIX=dll
152!else
153_WXLIB_VERSION=
154_WXDIR_DLLSUFFIX=
155_WXINC_DLLSUFFIX=
b3bd664a
MB
156!endif
157
ca5c8b2d 158!if "$(FINAL)" == "1"
fb5230de
MB
159_WXDIR_BUILD=Release
160LIBEXT=
161# no _WXDIR_SUFFIX
f641dada 162!else if "$(FINAL)" == "hybrid"
fb5230de 163_WXDIR_BUILD=Hybrid
f641dada 164LIBEXT=h
ca5c8b2d 165!else
f6bcfd97 166guilibsdll= oldnames.lib kernel32.lib \
fbdcff4a
JS
167 ws2_32.lib mswsock.lib advapi32.lib user32.lib \
168 gdi32.lib comdlg32.lib winspool.lib
fb5230de 169_WXDIR_BUILD=Debug
5fa399c9 170LIBEXT=d
ca5c8b2d
JS
171!endif
172
0548ca8d 173!if "$(wxUSE_GUI)" == "0"
fb5230de
MB
174_WXDIR_PREFIX=Base
175_WXLIB_NAME=wxbase
176_WXINC_BUILD=base
177!else
178_WXDIR_PREFIX=
179_WXLIB_NAME=wxmsw
180_WXINC_BUILD=msw
b3bd664a
MB
181!endif
182
183!if "$(UNICODE)" == "1"
fb5230de 184UNIFLAGS=-DUNICODE -D_UNICODE -DwxUSE_UNICODE=1
0548ca8d
GT
185!endif
186
fb5230de
MB
187!if "$(wxUSE_GUI)" == "0"
188UNIFLAGS=$(UNIFLAGS) -DwxUSE_GUI=0
189!endif
b3bd664a 190
ca5c8b2d
JS
191!if "$(WXMAKINGDLL)" == "1" || "$(WXUSINGDLL)" == "1"
192D=$(D)DLL
b3bd664a 193INCEXT=dll$(INCEXT)
ca5c8b2d
JS
194!endif
195
fb5230de
MB
196D=$(_WXDIR_PREFIX)$(_WXDIR_BUILD)$(_WXDIR_UNICODESUFFIX)$(_WXDIR_DLLSUFFIX)
197WXLIBNAME=$(_WXLIB_NAME)$(_WXLIB_VERSION)$(_WXLIB_SUFFIX)$(LIBEXT)
198INCEXT=$(_WXINC_SUFFIX)$(LIBEXT)
199
200!if "$(NEW_WXLIBNAME)" != ""
201WXLIBNAME=$(NEW_WXLIBNAME)
202!endif
203
2417bf69
RD
204#----------------------------------------------------------------------
205# MSLU == Microsoft Layer for Unicode
206# See MSDN or the Platform SDK docs for details
207!if "$(MSLU)" == "1"
208MSLU_FLAGS=/nod:kernel32.lib /nod:advapi32.lib /nod:user32.lib /nod:gdi32.lib /nod:shell32.lib /nod:comdlg32.lib /nod:version.lib /nod:mpr.lib /nod:rasapi32.lib /nod:winmm.lib /nod:winspool.lib /nod:vfw32.lib /nod:secur32.lib /nod:oleacc.lib /nod:oledlg.lib /nod:sensapi.lib
209MSLU_LIBS=$(MSLU_FLAGS) unicows.lib
210!endif
211
ca5c8b2d
JS
212WXLIB=$(WXDIR)\lib\$(WXLIBNAME).lib
213
fb5230de 214INC=$(EXTRAINC) -I$(WXDIR)/lib/$(_WXINC_BUILD)$(_WXINC_DLLSUFFIX)$(_WXINC_SUFFIX)$(LIBEXT) -I$(WXINC) -I$(WXDIR)/contrib/include -I$(WXDIR)/src/regex -I$(WXDIR)/src/png -I$(WXDIR)/src/zlib -I$(WXDIR)/src/jpeg -I$(WXDIR)/src/tiff
4567f2b2 215
0548ca8d 216!if "$(WXUSINGDLL)" == "1" || "$(wxUSE_GUI)" == "0"
2417bf69 217LIBS = $(MSLU_LIBS) $(EXTRALIBS) $(WXLIB) $(WINLIBS) $(WXDIR)\lib\regex$(LIBEXT).lib $(WXDIR)\lib\zlib$(LIBEXT).lib
4567f2b2 218!else
2417bf69 219LIBS = $(MSLU_LIBS) $(EXTRALIBS) $(WXLIB) $(WINLIBS) $(WXDIR)\lib\regex$(LIBEXT).lib $(WXDIR)\lib\png$(LIBEXT).lib $(WXDIR)\lib\zlib$(LIBEXT).lib $(WXDIR)\lib\jpeg$(LIBEXT).lib $(WXDIR)\lib\tiff$(LIBEXT).lib
4567f2b2 220!endif
ca5c8b2d 221
227869da
JS
222OPTIONS=
223
fb5230de
MB
224!if "$(DEBUGINFO)" == "0"
225
226!if "$(FINAL)" == "hybrid"
227OPT = /Ox /Gy
228!else
229# /O1 - smallest code
230# /O2 - fastest code
231OPT = /O1 # /O2 # /Od
232!endif
233
234LINK_DEBUG_FLAGS=/RELEASE
235
236!else
237OPT = /Od /Gy /Zi
238LINK_DEBUG_FLAGS=-debug:full -debugtype:cv
239!endif
240
227869da 241!if "$(FINAL)" == "0"
227869da 242# ***N.B.*** to save space/time, comment out /FR to avoid browse info (.sbr files) being generated
fb5230de 243DEBUG_FLAGS= /D__WXDEBUG__ # /DDEBUG=1 # /FR
7bf54362 244_CRTFLAG=/MDd
f641dada
RD
245
246!else if "$(FINAL)" == "hybrid"
d440a0e7 247DEBUG_FLAGS= /D__WXDEBUG__ /D__NO_VC_CRTDBG__
f641dada
RD
248_CRTFLAG=/MD
249
227869da 250!else
227869da 251DEBUG_FLAGS=
7bf54362 252_CRTFLAG=/MD
fb5230de 253
7bf54362
RD
254!endif
255
f641dada 256
7bf54362
RD
257!if "$(CRTFLAG)" == ""
258CRTFLAG=$(_CRTFLAG)
227869da
JS
259!endif
260
227869da 261!if "$(NOPCH)" == "1"
fb5230de 262
227869da
JS
263PCH=
264PRECOMP=
265MAKEPRECOMP=
fb5230de 266
227869da 267!else
014e19de 268
0548ca8d
GT
269!if "$(wxUSE_GUI)" == "0"
270PCH=wxBase.pch
271!else
3a7bfa06 272PCH=wxWindows.pch
0548ca8d 273!endif
014e19de 274
fb5230de 275PRECOMP=/YuWX/WXPREC.H /Fp$(WXDIR)\$D\$(PCH) /Fd$(WXDIR)\lib\$(WXLIBNAME).pdb
227869da 276MAKEPRECOMP=/YcWX/WXPREC.H
227869da 277
fb5230de 278!endif
014e19de 279
fb5230de 280!if "$(DLL)" == "0"
0548ca8d 281
77e0239d 282CPPFLAGS=$(UNIFLAGS) $(WINFLAGS) $(DEBUG_FLAGS) $(PRECOMP) $(EXTRAFLAGS) $(INC) $(OPT) $(EXTRADLLFLAGS) $(CRTFLAG) $(OVERRIDEFLAGS)
227869da 283# If you don't include wxprec.h, use CPPFLAGS2
77e0239d 284CPPFLAGS2=$(UNIFLAGS) $(WINFLAGS) $(DEBUG_FLAGS) $(INC) $(EXTRAFLAGS) $(OPT) $(EXTRADLLFLAGS) $(CRTFLAG) $(OVERRIDEFLAGS)
fb5230de 285
0548ca8d
GT
286!if "$(wxUSE_GUI)" == "0"
287LINKFLAGS=$(LINK_DEBUG_FLAGS) $(BASELINKFLAGS)
288!else
fb5230de 289LINKFLAGS=$(LINK_DEBUG_FLAGS) $(WINLINKFLAGS)
0548ca8d 290!endif
fb5230de 291
227869da
JS
292DUMMY=dummy
293
294!else
295
fb5230de
MB
296CPPFLAGS= $(UNIFLAGS) $(WINFLAGS) $(DEBUG_FLAGS) $(PRECOMP) $(EXTRAFLAGS) $(INC) $(OPT) /D_DLL $(CRTFLAG) $(EXTRADLLFLAGS) /D_WINDLL
297CPPFLAGS2=$(UNIFLAGS) $(WINFLAGS) $(DEBUG_FLAGS) $(EXTRAFLAGS) $(INC) $(OPT) /D_DLL $(CRTFLAG) $(EXTRADLLFLAGS) /D_WINDLL
298
299!if "$(wxUSE_GUI)" == "0"
300LINKFLAGS=$(LINK_DEBUG_FLAGS) $(BASELINKFLAGS) -dll
301!else
302LINKFLAGS=$(LINK_DEBUG_FLAGS) $(WINLINKFLAGS) -dll
303!endif
304
227869da 305!if "$(WXMAKINGDLL)" == "1"
227869da
JS
306DUMMY=dummydll
307!else
227869da
JS
308DUMMY=dummy
309!endif
310
227869da
JS
311!endif
312
3a7bfa06 313DUMMYOBJ=$(WXDIR)\$D\$(DUMMY).obj
227869da 314
e9c4b1a2
JS
315.c.obj:
316 cl @<<
317$(CPPFLAGS2) /Fo$@ /c $<
318<<
319
320.cpp.obj:
321 cl @<<
322$(CPPFLAGS2) /Fo$@ /c $<
323<<
324
0580ae4b
GT
325#use CPPFLAGS2 so as not to use precompiled headers
326{}.c{$D}.obj:
327 cl @<<
328$(CPPFLAGS2) /Fo$@ /c $<
329<<
330
df801fc6
JS
331{}.cpp{$D}.obj:
332 cl @<<
333$(CPPFLAGS) /Fo$@ /c /Tp $<
334<<
335