#
# Makefile for Vim on Win32 (Windows NT and Windows 95), using MS SDK
# and MSVC 2.0 or 2.2 compilers.  Also works with MSVC 4.x compilers.
# It is not known if it will build with other compilers or on non-Intel
# platforms, but it shouldn't be too difficult to get it to do so.
#

# to build the retail version
#	nmake -f Makefile.w32
# to build the debug version
#	nmake DEBUG=1 -f Makefile.w32

# Build on both Windows NT and Windows 95

TARGETOS = BOTH


# CPU isn't defined on Win95, but earlier versions of <ntwin32.mak> require it

!ifndef CPU
CPU=i386
!endif


# Build a retail version by default

!ifndef DEBUG
NODEBUG = 1
!endif


# Get all sorts of useful, standard macros from the SDK.  (Note that
# MSVC 2.2 does not install <ntwin32.mak> in the \msvc20\include
# directory, but you can find it in \msvc20\include on the CD-ROM.
# You may also need <win32.mak> from the same place.)

!include <ntwin32.mak>


#>>>>> Set this appropriately
HELPDIR = c:\vim


#>>>>> path of the compiler and linker; name of include and lib directories
#      Only needed if your environment is not correctly set up
# PATH = c:\msvc20\bin;$(PATH)
# INCLUDE = c:\msvc20\include
# LIB = c:\msvc20\lib

CFLAGS = -c /W3 /nologo $(cvars) $(cflags) $(DEFINES)

#>>>>> end of choices
###########################################################################

!ifdef PROCESSOR_ARCHITECTURE
OS_TYPE	= winnt
!else
OS_TYPE	= win95
!endif

!if "$(OS_TYPE)" == "win95"
DEL_TREE = deltree /y
!else
DEL_TREE = rmdir /s /q
!endif


!ifdef NODEBUG
CFLAGS = $(CFLAGS) -DNDEBUG
!else
CFLAGS = $(CFLAGS) -D_DEBUG -DDEBUG
!endif


DOCS =	vim_ami.txt  vim_arch.txt vim_diff.txt vim_digr.txt vim_dos.txt \
	vim_help.txt vim_idx.txt  vim_mac.txt  vim_w32.txt  vim_ref.txt \
	vim_tips.txt vim_unix.txt vim_win.txt  vim_gui.txt  vim_40.txt  \
	vim_kcc.txt  vim_rlh.txt  vim_menu.txt vim_os2.txt  vim_mint.txt


all: tags

# need a sort that puts output into correct ASCII order.  Built-in
# sort doesn't cut it.

tags: doctags.exe $(DOCS)
	.\doctags $(DOCS) | unixsort >tags
	uniq -d tags

install:
	copy vim_*.txt $(HELPDIR)
	copy tags  $(HELPDIR)

doctags.exe: doctags.obj
	$(link) $(linkdebug) $(conflags) -out:$*.exe $** setargv.obj $(conlibs)

doctags.obj: doctags.c
	$(CC) $(CFLAGS) doctags.c /Fodoctags.obj

clean:
	- del doctags.obj
	- del doctags.exe
