-# config/win-post.in
+#
+# Start of Win32 post-config lines (config/win-post.in)
+#
+
+!ifndef NO_OUTPRE
+outpre-dir:: $(OUTPRE)
+!else
+outpre-dir::
+!endif
+
+#
# put all:: first just in case no other rules occur here
#
all::
#(where there is already an explicit rule).
!if !defined(ZIP) && !defined(WINFILES)
Makefile: Makefile.in $(BUILDTOP)\config\windows.in $(BUILDTOP)\config\win-post.in
- $(BUILDTOP)\wconfig $(BUILDTOP)\config < Makefile.in > Makefile
+ $(BUILDTOP)\$(OUTPRE)wconfig $(BUILDTOP)\config < Makefile.in > Makefile
!endif
-.c.obj:
- $(CC) $(CFLAGS) /c $*.c
!if defined(LIBNAME)
-!ifndef WIN32 # WIN16
- $(LIBCMD) $(PAGESIZE) /nologo $(LIBNAME) -+$@;
-
-!else # WIN32
!if !defined(OBJFILELIST)
OBJFILELIST=@$(OBJFILE)
$(LIBNAME): $(OBJFILEDEP)
$(LIBCMD) /out:$(LIBNAME) /nologo $(OBJFILELIST)
-!endif # WIN32
!endif # LIBNAME
!if defined(LIBOBJS)
$(OBJFILE): $(LIBOBJS)
$(RM) $(OBJFILE)
-!ifndef WIN32 # WIN16
- $(CP) nul: $(OBJFILE)
-!else # WIN32
!if defined(PREFIXDIR)
$(LIBECHO) -p $(PREFIXDIR)\ $** > $(OBJFILE)
!else
$(LIBECHO) $** > $(OBJFILE)
!endif # !PREFIXDIR
-!endif # WIN32
!endif # LIBOBJS
!endif # OBJFILE
if test -n "$(OBJS)" ; then $(RM) $(OBJS); else :; fi
$(RM) .depend
-clean-windows::
- $(RM) $(OUTPRE)*.$(OBJEXT)
- $(RM) $(OUTPRE)msvc.pdb *.err $(OUTPRE)*.exe *.bak
-
!if defined(LIBNAME)
clean-windows::
$(RM) $(LIBNAME)
clean-windows::
$(RM) $(OBJFILE)
!endif
+
+clean-windows:: clean-windows-files clean-windows-dir
+
+# This needs to be in the post because we need RM to be defined in terms
+# of BUILDTOP
+clean-windows-files::
+ $(RM) .\$(OUTPRE)*.obj .\$(OUTPRE)*.res
+ $(RM) .\$(OUTPRE)*.exe .\$(OUTPRE)*.dll
+ $(RM) .\$(OUTPRE)*.lib .\$(OUTPRE)*.pdb
+ $(RM) .\$(OUTPRE)*.exp .\$(OUTPRE)*.map
+ $(RM) .\$(OUTPRE)*.idb .\$(OUTPRE)*.ilk
-##WIN32##WIN32=1
WHAT=windows
-!ifdef WIN32
+all:: outpre-dir
-!ifndef NO_OUTPRE
-all:: output-prefix-dir
-!endif
+all:: all-$(WHAT)
+clean:: clean-$(WHAT)
+install:: install-$(WHAT)
+check:: check-$(WHAT)
+
+all-windows::
+clean-windows::
+install-windows::
+check-windows::
+all-windows:: Makefile
+clean-windows:: Makefile
+
+#
# Figure out the CPU
+#
!if !defined(CPU) || "$(CPU)" == ""
CPU=$(PROCESSOR_ARCHITECTURE)
!endif # CPU
!if ( "$(CPU)" != "i386" ) && ( "$(CPU)" != "ALPHA" )
!error Must specify CPU environment variable ( CPU=i386, CPU=ALPHA)
!endif
+#
+# End of figuring out CPU
+#
+
-# The OUTPRE lines below cannot end in a backslash. To remedy that,
-# we add a space after the backslash. That works wonderfully,
-# but be we have to watch out for Emacs makefile-mode, which
-# will silently strip out such spaces!
+# NOTE: ^ is an escape char for NMAKE.
!ifdef NODEBUG
-OUTPRE=obj\$(CPU)\rel^\
+OUTPRE_DBG=rel
!else
-OUTPRE=obj\$(CPU)\dbg^\
+OUTPRE_DBG=dbg
!endif
+OUTPRE1=obj
+OUTPRE2=$(OUTPRE1)\$(CPU)
+OUTPRE3=$(OUTPRE2)\$(OUTPRE_DBG)
+OUTPRE=$(OUTPRE3)^\
-PDB_OPTS=-Fd$(OUTPRE)\ -FD
-
-!endif # WIN32
-
-all:: all-$(WHAT)
-clean:: clean-$(WHAT)
-install:: install-$(WHAT)
-check:: check-$(WHAT)
-
-all-windows::
-clean-windows::
-install-windows::
-check-windows::
+$(OUTPRE):
+ -@if not exist $(OUTPRE1)\nul mkdir $(OUTPRE1)
+ -@if not exist $(OUTPRE2)\nul mkdir $(OUTPRE2)
+ -@if not exist $(OUTPRE3)\nul mkdir $(OUTPRE3)
+ -@if exist $(OUTPRE3)\nul echo Output will go to $(OUTPRE3).
+ -@if not exist $(OUTPRE3)\nul echo Could not create $(OUTPRE3).
-all-windows:: Makefile
+clean-windows-dir::
+ -@if exist $(OUTPRE3)\nul rmdir $(OUTPRE3)
+ -@if exist $(OUTPRE2)\nul rmdir $(OUTPRE2)
+ -@if exist $(OUTPRE1)\nul rmdir $(OUTPRE1)
# Directory syntax:
#
srcdir = .
SRCTOP = $(srcdir)\$(BUILDTOP)
-# /* The name of the C compiler for the target */
-CC=cl /nologo
-CL=
#
-# CCOPTS for DLL functions
+# The name of the C compiler for the target
#
-!ifndef WIN32 # WIN16
-CCOPTS=/ALw /Zp /GD2s /Os /Zi /Od /W3 /Ld $(XTRA) $(DLL_FILE_DEF)
-!else # WIN32
-!ifdef NODEBUG
-CCOPTS=/Os /W3 /MD $(PDB_OPTS) $(XTRA) $(DLL_FILE_DEF)
-!else
-CCOPTS=/Os /Zi /Od /W3 /MD $(PDB_OPTS) $(XTRA) $(DLL_FILE_DEF)
-!endif
-!endif # WIN32
+CC=cl /nologo
+CL=
-#
-# CCOPTS for non-DLL compiles
-#
-!ifndef WIN32 # WIN16
-CCOPTS2=/AL /Zp /GA /G2s /Os /Zi /Od /W3 $(XTRA)
-!else # WIN32
-!ifdef NODEBUG
-CCOPTS2=/Os /W3 $(PDB_OPTS) $(XTRA)
-!else
-CCOPTS2=/Os /Zi /Od /W3 $(PDB_OPTS) $(XTRA)
-!endif
-!endif # WIN32
-CPPFLAGS = -I$(SRCTOP)\include -I$(SRCTOP)\include\krb5
-DEFS = $(CPPFLAGS)
-CFLAGS2 = $(CCOPTS2) $(DEFS)
+PDB_OPTS=-Fd$(OUTPRE)\ -FD
+
+# /ZI gives better debug info in each object file (MSVC 6.0 or higher).
+# /Zi gives debug info in each object file.
+# /Gs Avoid stack probes (they don't seem to work anyway)
+# /Os optimize for space. FIXME: Do not use /Ox; it miscompiles the DES lib!
+# /Od disable optimization (for debugging)
+# /MD (Win32) thread safe, ML would be single threaded, don't build with ML
#
-# LOPTS
+# CCOPTS is for DLL compiles
+# CCOPTS2 is for non-DLL compiles (EXEs, for example)
#
!ifdef NODEBUG
+CCOPTS =/Os /W3 /MD $(PDB_OPTS) $(XTRA) $(DLL_FILE_DEF)
+CCOPTS2=/Os /W3 $(PDB_OPTS) $(XTRA)
LOPTS=
!else
-LOPTS=/debug
+CCOPTS =/Od /ZI /W3 /MD $(PDB_OPTS) $(XTRA) $(DLL_FILE_DEF)
+CCOPTS2=/Od /ZI /W3 $(PDB_OPTS) $(XTRA)
+LOPTS=-debug
!endif
-# /Zi gives debug info in each object file.
-# /Zp packs structures: Required for Windows API (but is not default!!!)
-# /Za strict ansi compliance
-# /ALw memory model: Large model for Windows DLL (SS != DS)
-# /GD DLL code generation for Windows 3.0 and up, and defines _WINDOWS
-# /Gs Avoid stack probes (they don't seem to work anyway)
-# /Os optimize for space. FIXME: Do not use /Ox; it miscompiles the DES lib!
-# /G2 generate 286 instructions (it complains if you ask for 386!)
-# /Od disable optimization (for debugging)
-# /MD (Win32) thread safe, ML would be single threaded, don't build with ML
+# XXX - NOTE: We should probably use DllMainCRTStartup
+LINKOPTS=-incremental:no $(LOPTS) -nologo -dll -entry:DllMain
+LINKOPTS2=-incremental:no $(LOPTS) -nologo
-DBG_LIB=/nologo /Zp /ALw /GD /Gs /Os /G2 /Zi /Od
-# /Zi gives debug info in each object file.
-# /Zp packs structures: Required for Windows API (but is not default!!!)
-# /AL large memory model
-# /Mq quickwin ascii stdio window, and defines _WINDOWS
-DBG=/nologo /Zp /AL /Os /Mq /Zi /Od
+CPPFLAGS = -I$(SRCTOP)\include -I$(SRCTOP)\include\krb5
+DEFS = $(CPPFLAGS)
+CFLAGS2 = $(CCOPTS2) $(DEFS)
RM=$(BUILDTOP)\config\rm.bat
LIBECHO=$(BUILDTOP)\util\windows\$(OUTPRE)libecho
MV=ren
LN=copy
LIBCMD=lib
-PAGESIZE=/pagesize:128
AWK=rem
RC = rc
CVTRES = cvtres
-!ifndef WIN32 # WIN16
-WINBITS=16
-!else # WIN32
-WINBITS=32
-!endif # WIN32
-
-CLIB=$(BUILDTOP)\lib\$(OUTPRE)comerr$(WINBITS).lib
-PLIB=$(BUILDTOP)\lib\$(OUTPRE)xpprof$(WINBITS).lib
-KLIB=$(BUILDTOP)\lib\$(OUTPRE)krb5_$(WINBITS).lib
-K4LIB=$(BUILDTOP)\lib\krb4_16.lib
-K4LIB=$(BUILDTOP)\lib\$(OUTPRE)krb4_$(WINBITS).lib
-
-!ifndef WIN32 # WIN16
-GLIB=$(BUILDTOP)\lib\gssapi.lib
-WLIB=$(BUILDTOP)\lib\winsock.lib
-!else # WIN32
+CLIB=$(BUILDTOP)\lib\$(OUTPRE)comerr32.lib
+PLIB=$(BUILDTOP)\lib\$(OUTPRE)xpprof32.lib
+KLIB=$(BUILDTOP)\lib\$(OUTPRE)krb5_32.lib
+K4LIB=$(BUILDTOP)\lib\$(OUTPRE)krb4_32.lib
+
GLIB=$(BUILDTOP)\lib\$(OUTPRE)gssapi32.lib
WLIB=
-!endif # WIN32
ARADD=rem
RANLIB=rem
MFLAGS=$(MAKEFLAGS)
-
-!ifdef WIN32
-output-prefix-dir:: $(OUTPRE)
-
-$(OUTPRE):
- -if not exist $(OUTPRE) mkdir $(OUTPRE)
-
{}.rc{$(OUTPRE)}.res:
$(RC) $(RCFLAGS) -fo $@ -r $<
$(CC) $(CFLAGS) -Fo$(OUTPRE)\ -c $<
{}.cxx{$(OUTPRE)}.obj:
- $(CXX) $(CXXFLAGS) -Fo$(OUTPRE)\ -c $<
+ $(CC) $(CFLAGS) -Fo$(OUTPRE)\ -c $<
{}.cpp{$(OUTPRE)}.obj:
- $(CPP) $(CPPFLAGS) -Fo$(OUTPRE)\ -c $<
-
-#{}.c{$(OUTPRE)}.sbr:
-# $(C_RULE)
-#{}.cxx{$(OUTPRE)}.sbr:
-# $(CXX_RULE)
-#{}.cpp{$(OUTPRE)}.sbr:
-# $(CXX_RULE)
-!endif # WIN32
-
+ $(CC) $(CFLAGS) -Fo$(OUTPRE)\ -c $<
#
-# End of Microsoft Windows config lines
+# End of Win32 pre-config lines (config/windows.in)
#