PROJ = winvn
PROJFILE = makefile.lwp
DEBUG = 0

NMAKEBSC1  = set
NMAKEBSC2  = nmake
BRFLAGS  = /o $(PROJ).bsc
BROWSE  = 1
BSCMAKE  = bscmake
SBRPACK  = sbrpack
CC  = cl
CFLAGS_G  = /AL /W2 /G2 /GA /GEf /Zp /BATCH /FR$*.sbr /DLWP
CFLAGS_D  = /f /Od /Zi /Ge
CFLAGS_R  = /f- /Oe /Og /Os /Gs
CXX  = cl
CXXFLAGS_G  = /G2 /W2 /GA /GEf /Zp /BATCH /FR$*.sbr
CXXFLAGS_D  = /f /Zi /Od /Gs
CXXFLAGS_R  = /f- /Oe /Og /Os /Gs
MAPFILE_D  = NUL
MAPFILE_R  = NUL
LFLAGS_G  =  /ST:20000 /BATCH /ONERROR:NOEXE
LFLAGS_D  = /CO /NOF
LFLAGS_R  = /NOF
LLIBS_R = /NOD:LLIBCE LLIBCEW
LLIBS_D = /NOD:LLIBCE LLIBCEW
LLIBS_G  = LIBW.LIB
LINKER  = link
ILINK  = ilink
LRF  = echo > NUL
ILFLAGS  = /a /e
RC  = rc
RCFLAGS1 =
RCFLAGS2 = -K
CVFLAGS  = /25 /2 /B
PACK_SBRS  = 1

DEF_FILE = winvnlwp.def

FILES  = winvnlwp.def wvsckpwk.c winvn.c wvblock.c wvcncm.c wvfile.c\
	wvgroup.c wvheader.c wvpost.c wvscreen.c wvusenet.c wvutil.c\
	wvart.c wvlist.c winvn.rc wvmail.c wvauth.c shellsor.c wvprint.c \
	wvmapi.c

OBJS  = winvn.obj wvblock.obj wvcncm.obj wvfile.obj wvgroup.obj\
	wvheader.obj wvpost.obj wvscreen.obj wvsckpwk.obj wvusenet.obj\
	wvutil.obj wvprint.obj wvart.obj wvlist.obj wvmail.obj wvauth.obj\
        SHELLSOR.obj ini-news.obj wvmapi.obj

RCS1 = winvn.c wvblock.c wvcncm.c wvfile.c wvgroup.c wvheader.c
RCS2 = wvpost.c wvscreen.c wvusenet.c wvutil.c ini-news.c  wvsckstd.c
RCS3 = wvart.c wvlist.c wvmail.c wvauth.c shellsor.c wvprint.c wvmapi.c
RCS4 = winvn.h wvglob.h wvdlg.h wvmapi.h winvn.rc

RCSFILES = $(RCS1) $(RCS2) $(RCS3) $(RCS4)

LIBS_EXT  = c:\xln\toolkit\lib\wlibsock.lib c:\prog\ccc\chkdebug.lib
LIBS  = $(LIBS_EXT)
RESS  = winvn.res
SBRS  = winvn.sbr wvblock.sbr wvcncm.sbr wvfile.sbr wvgroup.sbr\
	wvheader.sbr wvpost.sbr wvscreen.sbr wvsckpwk.sbr wvusenet.sbr\
	wvutil.sbr wvart.sbr wvlist.sbr wvmail.sbr wvauth.sbr shellsor.sbr\
        wvprint.sbr ini-news.sbr

all: $(PROJ).exe

!IF $(DEBUG)
CFLAGS = $(CFLAGS_G) $(CFLAGS_D)
!ELSE
CFLAGS = $(CFLAGS_G) $(CFLAGS_R)
!ENDIF

.SUFFIXES: .obj .sbr .res .c .rc

# Rules to create files from RCS database

$(RCSFILES):
	co $@

# rule for making object files
.c.obj:
  $(CC) /c $(CFLAGS) /Fo$*.obj $*.c

# rule for making source code browser files
.c.sbr:
  $(CC) /Zs $(CFLAGS) /Fo$*.sbr $*.c

winvn.obj : winvn.c wvglob.h winvn.h winundoc.h\
	 wvdlg.h

winvn.sbr : winvn.c wvglob.h winvn.h winundoc.h\
	 wvdlg.h

wvblock.obj : wvblock.c wvglob.h winvn.h wvdlg.h

wvblock.sbr : wvblock.c wvglob.h winvn.h wvdlg.h

wvcncm.obj : wvcncm.c wvglob.h winvn.h wvdlg.h

wvcncm.sbr : wvcncm.c wvglob.h winvn.h wvdlg.h

wvfile.obj : wvfile.c wvglob.h winvn.h winundoc.h\
	wvdlg.h

wvfile.sbr : wvfile.c wvglob.h winvn.h winundoc.h\
	wvdlg.h

wvprint.obj : wvprint.c wvglob.h winvn.h winundoc.h\
	wvdlg.h

wvprint.sbr : wvprint.c wvglob.h winvn.h winundoc.h\
	wvdlg.h

wvgroup.obj : wvgroup.c winundoc.h wvglob.h winvn.h\
	wvdlg.h

wvgroup.sbr : wvgroup.c winundoc.h wvglob.h winvn.h\
	wvdlg.h

wvheader.obj : wvheader.c wvglob.h winvn.h winundoc.h\
	wvdlg.h

wvheader.sbr : wvheader.c wvglob.h winvn.h winundoc.h\
	wvdlg.h

wvpost.obj : wvpost.c wvglob.h winvn.h winundoc.h\
	wvdlg.h

wvpost.sbr : wvpost.c wvglob.h winvn.h winundoc.h\
	wvdlg.h

wvscreen.obj : wvscreen.c wvglob.h winvn.h wvdlg.h

wvscreen.sbr : wvscreen.c wvglob.h winvn.h wvdlg.h

wvsckpwk.obj : wvsckpwk.c wvglob.h winvn.h wvdlg.h

wvsckpwk.sbr : wvsckpwk.c wvglob.h winvn.h wvdlg.h

wvusenet.obj : wvusenet.c winundoc.h wvglob.h winvn.h\
	wvdlg.h

wvusenet.sbr : wvusenet.c winundoc.h wvglob.h winvn.h\
	wvdlg.h

wvutil.obj : wvutil.c wvglob.h winvn.h winundoc.h\
	wvdlg.h

wvutil.sbr : wvutil.c wvglob.h winvn.h winundoc.h\
	wvdlg.h

wvart.obj : wvart.c winundoc.h wvglob.h winvn.h\
	wvdlg.h

wvart.sbr : wvart.c winundoc.h wvglob.h winvn.h\
	wvdlg.h

wvlist.obj : wvlist.c wvglob.h winvn.h winundoc.h\
	wvdlg.h

wvlist.sbr : wvlist.c wvglob.h winvn.h winundoc.h\
	wvdlg.h

wvmail.obj : wvmail.c wvglob.h winvn.h winundoc.h\
	wvdlg.h

wvmail.sbr : wvmail.c wvglob.h winvn.h winundoc.h\
	wvdlg.h

wvmapi.obj : wvmapi.c wvmapi.h

wvmail.sbr : wvmapi.c wvmapi.h

wvauth.obj : wvauth.c

wvauth.sbr : wvauth.c

shellsor.obj : shellsor.c

shellsor.sbr : shellsor.c

ini-news.obj : ini-news.c

ini-news.sbr : ini-news.c

winvn.res : winvn.rc winvn.h winvn.ico wvgroup.ico\
	wvart.ico wvpost.ico dish.ico

$(PROJ).bsc : $(SBRS)
	$(BSCMAKE) @<<
$(BRFLAGS) $(SBRS)
<<

$(PROJ).exe : $(DEF_FILE) $(OBJS) $(LIBS) $(RESS)
	-$(NMAKEBSC1) MAKEFLAGS=
	-$(NMAKEBSC2) $(NMFLAGS) -f $(PROJFILE) $(PROJ).bsc
!IF $(DEBUG)
	$(LRF) @<<$(PROJ).lrf
$(RT_OBJS: = +^
) $(OBJS: = +^
)
$@
$(MAPFILE_D)
$(LIBS: = +^
) +
$(LLIBS_G: = +^
) +
$(LLIBS_D: = +^
)
$(DEF_FILE) $(LFLAGS_G) $(LFLAGS_D);
<<
!ELSE
	$(LRF) @<<$(PROJ).lrf
$(RT_OBJS: = +^
) $(OBJS: = +^
)
$@
$(MAPFILE_R)
$(LIBS: = +^
) +
$(LLIBS_G: = +^
) +
$(LLIBS_R: = +^
)
$(DEF_FILE) $(LFLAGS_G) $(LFLAGS_R);
<<
!ENDIF
	$(LINKER) @$(PROJ).lrf
	$(RC) $(RCFLAGS2) $(RESS) $@

.rc.res :
	$(RC) $(RCFLAGS1) /r /fo $@ $<


run: $(PROJ).exe
	WX $(WXFLAGS) $(PROJ).exe $(RUNFLAGS)

debug: $(PROJ).exe
	WX /p $(WXFLAGS) CVW $(CVFLAGS) $(PROJ).exe $(RUNFLAGS)

clean:
	rm -f *.exe
	rm -f *.obj
	rm -f *.sbr
	rm -f *.bsc

#
# YOU must supply the RELEASE string for this.
# example:
# nmake -f makefile.std release RELEASE=V3

release: $(RCSFILES)
   rcs -n$(RELEASE): $(RCS1)
   rcs -n$(RELEASE): $(RCS2)
   rcs -n$(RELEASE): $(RCS3)
   rcs -n$(RELEASE): $(RCS4)

dist:
	zip k:\winvnsrc.zip *.*

