pull up r24469, r24530, r24533, r24534, r24535, r24537 from trunk
[krb5.git] / src / config / win-pre.in
1 WHAT=windows
2
3 all:: setup-msg outpre-dir
4
5 all:: all-$(WHAT)
6 clean:: clean-$(WHAT)
7 install:: install-$(WHAT)
8 check:: check-$(WHAT)
9
10 all-windows::
11 clean-windows::
12 install-windows::
13 check-windows::
14
15 all-windows:: Makefile
16 clean-windows:: Makefile
17
18 #
19 # Figure out the CPU
20 #
21 !if !defined(CPU) || "$(CPU)" == ""
22 CPU=$(PROCESSOR_ARCHITECTURE)
23 !endif # CPU
24
25 !if "$(CPU)" == ""
26 CPU=i386
27 !endif
28
29 # Change x86 or X86 to i386
30 !if ( "$(CPU)" == "X86" ) || ( "$(CPU)" == "x86" )
31 CPU=i386
32 !endif # CPU == X86
33
34 !if ( "$(CPU)" != "i386" ) && ( "$(CPU)" != "ALPHA" ) && ( "$(CPU)" != "ALPHA64" ) && ( "$(CPU)" != "IA64" ) && ( "$(CPU)" != "AMD64" )
35 !error Must specify CPU environment variable ( CPU=i386, CPU=ALPHA, CPU=ALPHA64,CPU=IA64, CPU=AMD64)
36 !endif
37 #
38 # End of figuring out CPU
39 #
40
41 !if "$(OS)" == "Windows_NT"
42 DIRNUL=
43 !else 
44 DIRNUL=\nul
45 !endif
46
47 # NOTE: ^ is an escape char for NMAKE.
48 !ifdef NODEBUG
49 OUTPRE_DBG=rel
50 !else
51 OUTPRE_DBG=dbg
52 !endif
53 OUTPRE1=obj
54 OUTPRE2=$(OUTPRE1)\$(CPU)
55 OUTPRE3=$(OUTPRE2)\$(OUTPRE_DBG)
56 OUTPRE=$(OUTPRE3)^\
57
58 $(OUTPRE3)$(DIRNUL):
59         -@if not exist $(OUTPRE1)$(DIRNUL) mkdir $(OUTPRE1)
60         -@if not exist $(OUTPRE2)$(DIRNUL) mkdir $(OUTPRE2)
61         -@if not exist $(OUTPRE3)$(DIRNUL) mkdir $(OUTPRE3)
62         @if exist $(OUTPRE3)$(DIRNUL) echo Output going into $(OUTPRE3)
63         @if not exist $(OUTPRE1)$(DIRNUL) echo The directory $(OUTPRE1) could not be created.
64         @if exist $(OUTPRE1)$(DIRNUL) if not exist $(OUTPRE2)$(DIRNUL) echo The directory $(OUTPRE2) could not be created.
65         @if exist $(OUTPRE2)$(DIRNUL) if not exist $(OUTPRE3)$(DIRNUL) echo The directory $(OUTPRE3) could not be created.
66
67
68 clean-windows-dir::
69         -@if exist $(OUTPRE3)$(DIRNUL) rmdir $(OUTPRE3)
70         -@if exist $(OUTPRE2)$(DIRNUL) rmdir $(OUTPRE2)
71         -@if exist $(OUTPRE1)$(DIRNUL) rmdir $(OUTPRE1)
72         @if exist $(OUTPRE2)$(DIRNUL) echo The directory $(OUTPRE2) is not empty.
73         @if not exist $(OUTPRE2)$(DIRNUL) if exist $(OUTPRE1)$(DIRNUL) echo The directory $(OUTPRE1) is not empty.
74
75 # Directory syntax:
76 #
77 # begin absolute path
78 ABS=^\
79 # begin relative path
80 REL=
81 # up-directory
82 U=..
83 # path separator
84 S=^\
85 # this is magic... should only be used for preceding a program invocation
86 C=.^\
87
88 srcdir = .
89 top_srcdir = $(srcdir)\$(BUILDTOP)
90
91 !if defined(KRB5_USE_DNS) || defined(KRB5_USE_DNS_KDC) || defined(KRB5_USE_DNS_REALMS)
92 !if defined(KRB5_NO_WSHELPER)
93 DNSMSG=resolver
94 !else
95 DNSMSG=wshelper
96 DNSFLAGS=-DWSHELPER=1
97 !endif
98 !if !defined(DNS_INC)
99 !message Must define DNS_INC to point to $(DNSMSG) includes dir!
100 !error
101 !endif
102 !if !defined(DNS_LIB)
103 !message Must define DNS_LIB to point to $(DNSMSG) library!
104 !error
105 !endif
106 DNSLIBS=$(DNS_LIB)
107 DNSFLAGS=-I$(DNS_INC) $(DNSFLAGS) -DKRB5_DNS_LOOKUP=1
108 !if defined(KRB5_USE_DNS_KDC)
109 DNSFLAGS=$(DNSFLAGS) -DKRB5_DNS_LOOKUP_KDC=1
110 !endif
111 !if defined(KRB5_USE_DNS_REALMS)
112 DNSFLAGS=$(DNSFLAGS) -DKRB5_DNS_LOOKUP_REALM=1
113 !endif
114 !else
115 DNSLIBS=
116 DNSFLAGS=
117 !endif
118
119 !if ("$(CPU)" == "i386")
120 TIME_T_FLAGS=-D_USE_32BIT_TIME_T
121 !endif
122
123 !if defined(KRB5_KFW_COMPILE)
124 KFWFLAGS=-DUSE_LEASH=1
125 !endif
126
127 #
128 # The name of the C compiler for the target
129 #
130 CC=cl
131
132 PDB_OPTS=-Fd$(OUTPRE)\ -FD
133 CPPFLAGS=-I$(top_srcdir)\include -I$(top_srcdir)\include\krb5 $(DNSFLAGS) -DWIN32_LEAN_AND_MEAN -DKRB5_DEPRECATED=1 -D_CRT_SECURE_NO_DEPRECATE $(KFWFLAGS) $(TIME_T_FLAGS)
134 CCOPTS=-nologo /W3 $(PDB_OPTS) $(DLL_FILE_DEF)
135 LOPTS=-nologo -incremental:no
136
137 !if  ("$(CPU)" == "IA64" ) || ("$(CPU)" == "AMD64" ) || ("$(CPU)" == "ALPHA64" )
138 CCLINKOPTION=/link bufferoverflowu.lib
139 SCLIB=bufferoverflowu.lib
140 DEBUGOPT=/Zi
141 !else
142 CCLINKOPTION=
143 SCLIB=
144 DEBUGOPT=/Zi
145 !endif
146
147 #if the compiler is vstudio 8, generate manifest
148 !if exists("$(VCINSTALLDIR)\..\..\MICROSOFT VISUAL STUDIO 8")
149 CCLINKOPTION = $(CCLINKOPTION) /MANIFEST
150 _VC_MANIFEST_EMBED_EXE = if exist $*.exe.manifest mt.exe -manifest $*.exe.manifest -outputresource:$*.exe;1
151 _VC_MANIFEST_EMBED_DLL = if exist $*.dll.manifest mt.exe -manifest $*.dll.manifest -outputresource:$*.dll;2
152 !endif 
153
154 # /ZI gives better debug info in each object file (MSVC 6.0 or higher).
155 # /Zi gives debug info in each object file.
156 # /Gs Avoid stack probes (they don't seem to work anyway)
157 # /Os optimize for space.  FIXME:  Do not use /Ox; it miscompiles the DES lib!
158 # /Od disable optimization (for debugging)
159 # /MD (Win32) thread safe, ML would be single threaded, don't build with ML
160
161 #
162 # CCOPTS  was for DLL compiles
163 # CCOPTS2 was for non-DLL compiles (EXEs, for example)
164 #
165 !ifdef NODEBUG
166 !ifdef DEBUG_SYMBOL
167 CCOPTS=$(DEBUGOPT) $(CCOPTS)
168 LOPTS=$(LOPTS) -debug
169 !endif
170 CCOPTS=/Os /MD $(CCOPTS)
171 LOPTS=$(LOPTS)
172 !else
173 CCOPTS=/Od $(DEBUGOPT) /MDd $(CCOPTS)
174 LOPTS=$(LOPTS) -debug
175 !endif
176
177 # XXX - NOTE: We should probably use DllMainCRTStartup
178 DLL_LINKOPTS=$(LOPTS) -dll -entry:DllMain
179 EXE_LINKOPTS=$(LOPTS)
180
181 RM=$(BUILDTOP)\config\rm.bat
182 LIBECHO=$(BUILDTOP)\util\windows\$(OUTPRE)libecho
183 CP=copy/b nul:+
184 MV=ren
185 LN=copy
186 LIBCMD=lib
187 AWK=rem
188 RC = rc
189 CVTRES = cvtres
190 PERL=perl
191
192 WCONFIG_EXE=$(BUILDTOP)\$(OUTPRE)wconfig.exe
193 WCONFIG=$(WCONFIG_EXE:.exe=) $(WCONFIG_FLAGS)
194
195 CLIB=$(BUILDTOP)\lib\$(OUTPRE)comerr32.lib
196 PLIB=$(BUILDTOP)\lib\$(OUTPRE)xpprof32.lib
197 KLIB=$(BUILDTOP)\lib\$(OUTPRE)krb5_32.lib
198 K4LIB=$(BUILDTOP)\lib\$(OUTPRE)krb4_32.lib
199 SLIB=$(BUILDTOP)\lib\$(OUTPRE)k5sprt32.lib
200 GLIB=$(BUILDTOP)\lib\$(OUTPRE)gssapi32.lib
201 WLIB=
202
203 !if  ("$(CPU)" == "IA64" ) || ("$(CPU)" == "AMD64" ) || ("$(CPU)" == "ALPHA64" )
204 CLIB=$(BUILDTOP)\lib\$(OUTPRE)comerr64.lib
205 PLIB=$(BUILDTOP)\lib\$(OUTPRE)xpprof64.lib
206 KLIB=$(BUILDTOP)\lib\$(OUTPRE)krb5_64.lib
207 K4LIB=$(BUILDTOP)\lib\$(OUTPRE)krb4_64.lib
208 SLIB=$(BUILDTOP)\lib\$(OUTPRE)k5sprt64.lib
209 GLIB=$(BUILDTOP)\lib\$(OUTPRE)gssapi64.lib
210 WLIB=
211
212 !endif
213
214 KRB4_INCLUDES=-I$(BUILDTOP)/include/kerberosIV
215
216 COM_ERR_DEPS    = $(BUILDTOP)/include/com_err.h
217
218 ARADD=rem
219 RANLIB=rem
220 ARCHIVE=rem
221
222 LIBEXT=lib
223 OBJEXT=obj
224 EXEEXT=.exe
225
226 MFLAGS=$(MAKEFLAGS)
227 !ifdef MIGNORE
228 MAKE=-$(MAKE)
229 !endif
230
231 CRYPTO_IMPL     = builtin
232 PRNG_ALG        = yarrow
233
234 CFLAGS = $(CCOPTS)
235 ALL_CFLAGS = $(DEFS) $(DEFINES) $(LOCALINCLUDES) $(CPPFLAGS) $(CFLAGS)
236
237 C_RULE_STUFF=$(CC) $(ALL_CFLAGS) -Fo$(OUTPRE)\ -c
238 C_RULE_PRINT=$(C_RULE_STUFF)
239 C_RULE=$(C_RULE_STUFF) $<
240
241 {}.rc{$(OUTPRE)}.res:
242         $(RC) $(RCFLAGS) -fo $@ -r $<
243
244 {}.c{$(OUTPRE)}.obj:
245         @if "%DO_C_RULE_PRINT%"=="1" echo %C_RULE_PRINT% ...
246         @set DO_C_RULE_PRINT=
247         @$(C_RULE)
248
249 {}.cxx{$(OUTPRE)}.obj:
250         @if "%DO_C_RULE_PRINT%"=="1" echo %C_RULE_PRINT% ...
251         @set DO_C_RULE_PRINT=
252         @$(C_RULE)
253
254 {}.cpp{$(OUTPRE)}.obj:
255         @if "%DO_C_RULE_PRINT%"=="1" echo %C_RULE_PRINT% ...
256         @set DO_C_RULE_PRINT=
257         @$(C_RULE)
258
259 #
260 # End of Win32 pre-config lines (config/win-pre.in)
261 #
262