!include <ntwin32.mak>
OS_SPEC=/nologo -DWINNT -DMS_WINDOWS -Dwx_msw
ALLFLAGS= $(OS_SPEC) $(cflags) $(cvars) $(cdebug)
# Makefile : Builds Tex2RTF for Windows 3.1

# Change WXDIR to wherever wxWindows is found
WXDIR = $(WX)
WXLIB = $(WXDIR)\lib\wx.lib
WXINC = $(WXDIR)\include

TEX2RTFDIR = $(WXDIR)\utils\tex2rtf
WXHELPDIR = $(WXDIR)\utils\wxhelp
DOCDIR = $(TEX2RTFDIR)\docs
TEX2ANYLIB = $(TEX2RTFDIR)\lib\tex2any.lib

INC=/I$(WXDIR)\include\base /I$(WXDIR)\include\msw /I$(WXHELPDIR)\src
#
# Not used
#
#LIBS=$(WXLIB) $(HYPLIB) libw llibcew commdlg ddeml shell


#---------------------------------------------------------------------
# Not yet tested with NT
#
#!ifndef FINAL
#FINAL=0
#!endif

#INC=/I$(HYPINC) /I$(WXDIR)\include\base /I$(WXDIR)\include\msw
#PRECOMP=/YuWX.H

#!if "$(FINAL)" == "0"
#OPT=/Od
#CPPFLAGS= /AL /W3 /Zi /G2sw $(OPT) $(PRECOMP) /Dwx_msw $(INC) /Fp$(WXDIR)\src\msw\wx.pch
#CFLAGS= /AL /W3 /Zi /G2sw /Od /Dwx_msw
#LINKFLAGS=/NOD /CO /ONERROR:NOEXE
#!else
#OPT=/Ox
#CPPFLAGS= /AL /W3 /G2sw $(OPT) $(PRECOMP) /Dwx_msw $(INC) /Fp$(WXDIR)\src\msw\wx.pch
#CFLAGS= /AL /W3 /Od /G2sw /Dwx_msw
#LINKFLAGS=/NOD /ONERROR:NOEXE
#!endif
#---------------------------------------------------------------------

all:    wx tex2rtf.exe

compact:
        -wrun clean

wx:
        cd $(WXDIR)\src
        nmake -f makefile.nt $(WXLIB) FINAL=$(FINAL) OPT=$(OPT) PRECOMP=$(PRECOMP)
        cd $(TEX2RTFDIR)\src

#
# NT Lib.
#
$(TEX2ANYLIB): tex2any.obj texutils.obj
	-erase $(TEX2ANYLIB)
	$(implib) @<<
-out:$(TEX2ANYLIB)
-machine:$(CPU)
tex2any.obj texutils.obj
<<

tex2any.obj: tex2any.cc tex2any.h
	$(cc) @<<
$(ALLFLAGS) $(INC) /c /Tp $*.cc
<<

texutils.obj: texutils.cc tex2any.h
	$(cc) @<<
$(ALLFLAGS) $(INC) /c /Tp $*.cc
<<

ref2xlp.obj: ref2xlp.cc
	$(cc) @<<
$(ALLFLAGS) $(INC) /c /Tp $*.cc
<<

tex2rtf.obj: tex2rtf.cc bmputils.h tex2rtf.h tex2any.h
	cl @<<
$(ALLFLAGS) $(INC) /c /Tp $*.cc
<<

rtfutils.obj: rtfutils.cc tex2rtf.h bmputils.h tex2any.h
	cl @<<
$(ALLFLAGS) $(INC) /c /Tp $*.cc
<<

xlputils.obj: xlputils.cc tex2rtf.h rtfutils.h tex2any.h
	cl @<<
$(ALLFLAGS) $(INC) /c /Tp $*.cc
<<

htmlutil.obj: htmlutil.cc tex2rtf.h tex2any.h
	cl @<<
$(ALLFLAGS) $(INC) /c /Tp $*.cc
<<

#
# NT exe
#
tex2rtf.exe:      $(WXDIR)\src\msw\dummy.obj $(WXLIB) $(TEX2RTFOBJ) tex2rtf.res $(TEX2ANYLIB)
	$(link) @<<
-out:tex2rtf.exe
-machine:$(CPU)
-subsystem:windows
$(LINKFLAGS)
$(WXDIR)\src\msw\dummy.obj $(TEX2RTFOBJ) tex2rtf.res
$(WXLIB) $(HYPLIB) $(TEX2ANYLIB)
shell32.lib $(guilibs)
<<

tex2rtf.res :      tex2rtf.rc $(WXDIR)\include\msw\wx.rc
    $(rc) -r /i$(WXDIR)\include\msw -fotex2rtf.tmp tex2rtf.rc
    $(cvtres) -$(CPU) -o tex2rtf.res tex2rtf.tmp
    del tex2rtf.tmp

clean:
        erase *.obj *.exe *.res *.lib $(TEX2ANYLIB)

cleanall:	clean
