#
# makefile for vile on WIN32 using Microsoft Visual C++
#
# $Header: /usr/build/vile/vile/RCS/makefile.wnt,v 1.20 1997/12/05 20:40:03 tom Exp $
#
#
!include <ntwin32.mak>

!IF "$(CFG)" == ""
CFG=vile
!MESSAGE No configuration (CFG) specified.  Defaulting to vile (console)
!ENDIF 

!IF "$(CFG)" != "vile" && "$(CFG)" != "winvile"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE on this makefile
!MESSAGE by defining the macro CFG on the command line.  For example:
!MESSAGE 
!MESSAGE NMAKE /f "makefile.wnt" CFG="winvile"
!MESSAGE 
!MESSAGE Possible choices for configuration are:
!MESSAGE 
!MESSAGE "vile   - console"
!MESSAGE "winvile - gui"
!MESSAGE 
!ERROR An invalid configuration is specified.
!ENDIF 

# remove the "#" to get debugging info (and a larger executable)
CC_DEBUG = # $(cdebug)
LD_DEBUG = # $(ldebug)
CON_LDFLAGS = -nologo -pdb:none

!IF  "$(CFG)" == "vile"
TARGET  = vile.exe
UTILS   = vile-c-filt.exe
CFLAGS  = $(cvars) $(CC_DEBUG) -nologo -DWIN32_LEAN_AND_MEAN -G4 -Dscrn_chosen -DDISP_NTCONS	
LDFLAGS = -nologo -pdb:none
SCREEN  = ntconio
LIBS    = $(LD_DEBUG) $(conlflags) $(conlibs) user32.lib
!endif

!IF  "$(CFG)" == "winvile"
TARGET  = winvile.exe
UTILS   =
CFLAGS  = $(cvars) $(CC_DEBUG) -nologo -DWIN32_LEAN_AND_MEAN -G4 -Dscrn_chosen -DDISP_NTWIN	
LDFLAGS = -nologo /nologo /subsystem:windows /incremental:no -pdb:none
SCREEN  = ntwinio
LIBS    = $(LD_DEBUG) $(conlflags) $(conlibs) user32.lib
LIBS    = kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
 advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
 odbccp32.lib
!endif

# these are normal editable headers
HDRS = estruct.h edef.h proto.h dirstuff.h

# these headers are built by the mktbls program from the information in cmdtbl
# and in modetbl
BUILTHDRS = nebind.h neproto.h nefunc.h nemode.h nename.h nevars.h nefkeys.h nefsms.h

SRC = 	main.c $(SCREEN).c \
	basic.c bind.c btree.c buffer.c crypt.c \
	csrch.c display.c eval.c exec.c externs.c \
	fences.c file.c filec.c \
	fileio.c finderr.c glob.c globals.c history.c \
	input.c insert.c itbuff.c isearch.c \
	line.c modes.c msgs.c npopen.c oneliner.c opers.c \
	path.c random.c regexp.c \
	region.c search.c select.c spawn.c \
	tags.c tbuff.c termio.c undo.c \
	version.c window.c word.c wordmov.c map.c 

OBJ = 	main.obj $(SCREEN).obj \
	basic.obj bind.obj btree.obj buffer.obj crypt.obj \
      	csrch.obj display.obj eval.obj exec.obj externs.obj \
	fences.obj file.obj filec.obj \
	fileio.obj finderr.obj glob.obj globals.obj history.obj \
	input.obj insert.obj itbuff.obj isearch.obj \
	line.obj modes.obj msgs.obj npopen.obj oneliner.obj opers.obj \
	path.obj random.obj regexp.obj \
	region.obj search.obj select.obj spawn.obj \
	tags.obj tbuff.obj termio.obj undo.obj \
	version.obj window.obj word.obj wordmov.obj map.obj 

.c.obj:	
	$(cc) $(CFLAGS) -c $< -Fo$@ 

all:  $(TARGET) $(UTILS)

$(TARGET): 	$(BUILTHDRS) $(OBJ)
	$(link) $(LDFLAGS) $(OBJ) $(LIBS) -out:$(TARGET)

$(OBJ):	estruct.h

neproto.h \
nebind.h \
nefunc.h \
nefkeys.h \
nename.h :	cmdtbl mktbls.exe
	mktbls.exe cmdtbl

nevars.h \
nefsms.h \
nemode.h:	modetbl mktbls.exe
	mktbls.exe modetbl

mktbls.exe:  mktbls.c
	$(cc) $(CFLAGS) mktbls.c -Fomktbls -link $(CON_LDFLAGS)

vile-c-filt.exe: c-filt.c
	$(cc) $(CFLAGS) c-filt.c \
    -Fovile-c-filt -link $(CON_LDFLAGS)

clean:
	del *.exe
	del *.obj
	del ne*.h

bind.obj:	nefunc.h
eval.obj:	nevars.h
exec.obj:	nefunc.h
externs.obj:	nebind.h nename.h neproto.h nefunc.h
filec.obj:	dirstuff.h
glob.obj:	dirstuff.h
globals.obj:	nefunc.h
main.obj:	chgdfunc.h nevars.h
modes.obj:	chgdfunc.h
opers.obj:	nefunc.h
path.obj:	dirstuff.h
random.obj:	nefunc.h
select.obj:	nefunc.h
spawn.obj:	nefunc.h
termio.obj:	nefunc.h
version.obj:	patchlev.h
word.obj:	nefunc.h
