xref: /plan9/sys/src/cmd/gs/src/msvccmd.mak (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1#    Copyright (C) 1997, 2000 Aladdin Enterprises.  All rights reserved.
2#
3# This software is provided AS-IS with no warranty, either express or
4# implied.
5#
6# This software is distributed under license and may not be copied,
7# modified or distributed except as expressly authorized under the terms
8# of the license contained in the file LICENSE in this distribution.
9#
10# For more information about licensing, please refer to
11# http://www.ghostscript.com/licensing/. For information on
12# commercial licensing, go to http://www.artifex.com/licensing/ or
13# contact Artifex Software, Inc., 101 Lucas Valley Road #110,
14# San Rafael, CA  94903, U.S.A., +1(415)492-9861.
15
16# $Id: msvccmd.mak,v 1.27 2005/07/12 17:54:55 igor Exp $
17# Command definition section for Microsoft Visual C++ 4.x/5.x,
18# Windows NT or Windows 95 platform.
19# Created 1997-05-22 by L. Peter Deutsch from msvc4/5 makefiles.
20# edited 1997-06-xx by JD to factor out interpreter-specific sections
21# edited 2000-03-30 by lpd to make /FPi87 conditional on MSVC version
22# edited 2000-06-05 by lpd to treat empty MSINCDIR and LIBDIR specially.
23
24# Set up linker differently for MSVC 4 vs. later versions
25
26!if $(MSVC_VERSION) == 4
27
28# MSVC version 4.x doesn't recognize the /QI0f switch, which works around
29# an unspecified bug in the Pentium decoding of certain 0F instructions.
30QI0f=
31
32!else
33#else $(MSVC_VERSION) != 4
34
35# MSVC 5.x does recognize /QI0f.
36QI0f=/QI0f
37
38# Define separate CCAUX command-line switch that must be at END of line.
39
40CCAUX_TAIL= /link
41
42!endif
43#endif #$(MSVC_VERSION) == 4
44
45
46# Define the current directory prefix and shell invocations.
47
48D=\#
49
50SH=
51
52# Define switches for the compilers.
53
54C_=
55O_=-Fo
56RO_=$(O_)
57
58# Define the arguments for genconf.
59
60CONFILES=-p %%s
61CONFLDTR=-ol
62
63# Define the generic compilation flags.
64
65PLATOPT=
66
67INTASM=
68PCFBASM=
69
70# Make sure we get the right default target for make.
71
72dosdefault: default
73	@attrib -H dosdefault > nul:
74	@echo Done. > dosdefault
75	@attrib +H dosdefault
76
77# Define the compilation flags.
78
79# MSVC 8 (2005) warns about deprecated unsafe common functions like strcpy.
80!if ($(MSVC_VERSION) == 8) || defined(WIN64)
81VC8WARN=/wd4996 /wd4224
82!else
83VC8WARN=
84!endif
85
86!if ($(MSVC_VERSION) < 8)
87CDCC=/Gi /ZI
88!else
89CDCC=/ZI
90!endif
91
92!if "$(CPU_FAMILY)"=="i386"
93
94!if ($(MSVC_VERSION) >= 8) || defined(WIN64)
95# MSVC 8 (2005) attempts to produce code good for all processors.
96# and doesn't used /G5 or /GB.
97# MSVC 8 (2005) avoids buggy 0F instructions.
98CPFLAGS=
99!else
100!if $(CPU_TYPE)>500
101CPFLAGS=/G5 $(QI0f)
102!else if $(CPU_TYPE)>400
103CPFLAGS=/GB $(QI0f)
104!else
105CPFLAGS=/GB $(QI0f)
106!endif
107!endif
108
109!if $(FPU_TYPE)>0 && $(MSVC_VERSION)<5
110FPFLAGS=/FPi87
111!else
112FPFLAGS=
113!endif
114
115!endif
116
117!if "$(CPU_FAMILY)"=="ppc"
118
119!if $(CPU_TYPE)>=620
120CPFLAGS=/QP620
121!else if $(CPU_TYPE)>=604
122CPFLAGS=/QP604
123!else
124CPFLAGS=/QP601
125!endif
126
127FPFLAGS=
128
129!endif
130
131!if "$(CPU_FAMILY)"=="alpha"
132
133# *** alpha *** This needs fixing
134CPFLAGS=
135FPFLAGS=
136
137!endif
138
139!if $(NOPRIVATE)!=0
140CP=/DNOPRIVATE
141!else
142CP=
143!endif
144
145!if $(DEBUG)!=0
146CD=/DDEBUG
147!else
148CD=
149!endif
150
151# Precompiled headers
152!if $(MSVC_VERSION) >= 8
153CPCH=/Fp$(GLOBJDIR)\gs.pch
154!else
155CPCH=/YX /Fp$(GLOBJDIR)\gs.pch
156!endif
157
158!if $(TDEBUG)!=0
159# /Fd designates the directory for the .pdb file.
160# Note that it must be followed by a space.
161CT=/Od /Fd$(GLOBJDIR) $(NULL) $(CDCC) $(CPCH)
162LCT=/DEBUG /INCREMENTAL:YES
163COMPILE_FULL_OPTIMIZED=    # no optimization when debugging
164COMPILE_WITH_FRAMES=    # no optimization when debugging
165COMPILE_WITHOUT_FRAMES=    # no optimization when debugging
166CMT=/MTd
167!else
168!if $(DEBUGSYM)==0
169CT=
170LCT=
171CMT=/MT
172!else
173CT=/Zi /Fd$(GLOBJDIR) $(NULL)
174LCT=/DEBUG
175CMT=/MTd
176!endif
177!if $(MSVC_VERSION) == 5
178# NOTE: With MSVC++ 5.0, /O2 produces a non-working executable.
179# We believe the following list of optimizations works around this bug.
180COMPILE_FULL_OPTIMIZED=/GF /Ot /Oi /Ob2 /Oy /Oa- /Ow-
181!else
182COMPILE_FULL_OPTIMIZED=/GF /O2 /Ob2
183!endif
184COMPILE_WITH_FRAMES=
185COMPILE_WITHOUT_FRAMES=/Oy
186!endif
187
188!if $(MSVC_VERSION) >= 8
189# MSVC 8 (2005) always does stack probes and checking.
190CS=
191!else
192!if $(DEBUG)!=0 || $(TDEBUG)!=0
193CS=/Ge
194!else
195CS=/Gs
196!endif
197!endif
198
199!if ($(MSVC_VERSION) == 7) && defined(WIN64)
200# Need to specify DDK include directories before .NET 2003 directories.
201MSINCFLAGS=-I"$(INCDIR64A)" -I"$(INCDIR64B)"
202!else
203MSINCFLAGS=
204!endif
205
206# Specify output object name
207CCOBJNAME=-Fo
208
209# Specify function prolog type
210COMPILE_FOR_DLL=
211COMPILE_FOR_EXE=
212COMPILE_FOR_CONSOLE_EXE=
213
214# The /MT is for multi-threading.  We would like to make this an option,
215# but it's too much work right now.
216GENOPT=$(CP) $(CD) $(CT) $(CS) $(WARNOPT) $(VC8WARN) /nologo $(CMT)
217
218CCFLAGS=$(PLATOPT) $(FPFLAGS) $(CPFLAGS) $(CFLAGS) $(XCFLAGS) $(MSINCFLAGS)
219CC=$(COMP) /c $(CCFLAGS) @$(GLGENDIR)\ccf32.tr
220CPP=$(COMPCPP) /c $(CCFLAGS) @$(GLGENDIR)\ccf32.tr
221!if $(MAKEDLL)
222WX=$(COMPILE_FOR_DLL)
223!else
224WX=$(COMPILE_FOR_EXE)
225!endif
226
227!if $(COMPILE_INITS)
228ZM=/Zm600
229!else
230ZM=
231!endif
232
233
234# /Za disables the MS-specific extensions & enables ANSI mode.
235CC_WX=$(CC) $(WX)
236CC_=$(CC_WX) $(COMPILE_FULL_OPTIMIZED) /Za $(ZM)
237CC_D=$(CC_WX) $(COMPILE_WITH_FRAMES)
238CC_INT=$(CC_)
239CC_NO_WARN=$(CC_)
240
241# Compiler for auxiliary programs
242
243CCAUX=$(COMPAUX) $(VC8WARN)
244
245# Compiler for Windows programs.
246CCWINFLAGS=$(COMPILE_FULL_OPTIMIZED)
247
248#end msvccmd.mak
249