#
# fv makefile for Watcom C under Windows 95 / Windows NT
#

#
# Feature options:   (add to OPTIONS line)
#	-DSTRICT_VI
#		Typematic mode at prompt starts in editor state when defined,
#		keys in search functions act more close to vi
#	-DZERO_START
#		'0' takes you to start of file rather than beginning of line
#	-DEMACS_FEEL
#		Give program more of Emacs feel, some compromise to vi feel
#	-DALIGN_VIEW
#		Always align the display address by current cursor size
#	-DSHOW_EXTASCII
#		Display ASCII codes 161-255 in viewer when defined
#		This mode is not appreciated by all terminal types
#	-DEDIT_MEMORY
#		Enable memory edit functions
#	-DCOLON_MODE
#		Enable colon mode prompt
#	-DHUGE_BUFFER
#		Make the search buffer very large for screenless edits
#	-DCOLOR_CURSES
#		Use curses colors for different display regions.  This is
#		not well-tested as color_xterm has curses emulation bugs.
#   -DCURSES_UPDATE_BUG
#       When displaying the screen, force buggy curses (Linux 2.0.29)
#       to redraw screen rather than attempting to just update it.
#

#OPTIONS=-DSTRICT_VI -DCOLON_MODE -DEDIT_MEMORY -x -oc -d2 -of -DWin32
OPTIONS=-DSTRICT_VI -DCOLON_MODE -DEDIT_MEMORY -x -oc -DWin32

HOST_ARCH=Win32


#
# Possible CC=
#	CC=gcc
#	CC=wcl386
CC=wcl386


# Normal make, curses.h in C:\CURSES
CFLAGS=$(OPTIONS) -IC:\CURSES


# Include flags
INCLUDE=

# Linker flags
LDFLAGS=

ROOTDIR=C:\
BINDIR=$(ROOTDIR)\bin
WIN32LIBS=nt\kernel32.lib pdcurses.lib

PROG=fv
#RM=rm -f
RM=del
NROFF=nroff -man
PSROFF=psroff -t -man
#PSROFF=ptroff -t -man

# Watcom C definitions
O=obj
TO_EXE=-fe=$(PROG)
TO_O=-c

# Watcom for Win32 definitions
MAKE=wmake

OBJDIR=obj$(HOST_ARCH)
DOCDIR=doc
SRCDIR=.
MISC=Makefile todo relnotes $(DOCDIR)\$(PROG).keymap $(DOCDIR)\$(PROG).man &
	$(DOCDIR)\$(PROG).catman $(DOCDIR)\$(PROG).catman.ps
INCLUDES=lint.h edit.h main.h screen.h pcurses.h curses.h io.h
SRCS=$(SRCDIR)\main.c $(SRCDIR)\edit.c $(SRCDIR)\screen.c $(SRCDIR)\io.c &
	 $(SRCDIR)\search.c $(SRCDIR)\prompt.c $(SRCDIR)\help.c
OBJS=$(OBJDIR)\main.$O $(OBJDIR)\edit.$O $(OBJDIR)\screen.$O $(OBJDIR)\io.$O &
	 $(OBJDIR)\search.$O $(OBJDIR)\prompt.$O $(OBJDIR)\help.$O

all:
	$(MAKE) -f makefile.dos host$(HOST_ARCH)

hostWin32: $(OBJDIR) $(OBJS)
	$(CC) $(CFLAGS) $(TO_EXE) $(OBJS) $(LDFLAGS) $(WIN32LIBS)

$(OBJDIR)\main.$(O):   $(SRCDIR)\main.c   main.h screen.h edit.h io.h
$(OBJDIR)\edit.$(O):   $(SRCDIR)\edit.c   main.h screen.h edit.h
$(OBJDIR)\screen.$(O): $(SRCDIR)\screen.c main.h screen.h pcurses.h io.h
$(OBJDIR)\search.$(O): $(SRCDIR)\search.c main.h screen.h io.h
$(OBJDIR)\prompt.$(O): $(SRCDIR)\prompt.c main.h screen.h io.h
$(OBJDIR)\io.$(O):     $(SRCDIR)\io.c     main.h io.h
$(OBJDIR)\help.$(O):   $(SRCDIR)\help.c   main.h screen.h

$(OBJS):
	$(CC) $(CFLAGS) $[*.c $(TO_O) -fo=$@

$(OBJDIR):
	mkdir $@

clean:
	$(RM) $(OBJS)
