include ..\make.win

COPTS = $(CFLAGS) -I$(CGNSDIR) $(TCLINC)

#--------------------------------------------------

all : cgiowish.exe
dll : cgiotcl.dll

#--------------------------------------------------

cgiowish.exe : winmain.obj cgiotcl.obj $(WINHTML_OBJ)
	$(LINK) $(LFLAGS) /nodefaultlib /subsystem:windows \
	-out:$@ winmain.obj cgiotcl.obj $(WINHTML_OBJ) \
	$(CGNSLIB) $(CLIBS) $(BUILDLIBS) $(TCLLIB) $(TKLIB) \
	$(guilibs) $(WINHTML_LIB)

winmain.obj : winmain.c
	$(CC) $(COPTS) $(WINHTML_OPT) -c winmain.c

cgiotcl.obj : cgiotcl.c
	$(CC) $(COPTS) -c cgiotcl.c

#--------------------------------------------------

cgiotcl.dll : cgiotcl-dll.obj $(CGNSLIB)
	$(LINK) -dll -out:cgiotcl.dll cgiotcl-dll.obj \
	$(CGNSLIB) $(CLIBS) $(TCLLIB) $(TKLIB) $(dlllibs)

cgiotcl-dll.obj : cgiotcl.c
	$(CC) $(COPTS) -DBUILD_DLL -Fo$@ -c cgiotcl.c

#--------------------------------------------------

winhtml.obj : ..\common\winhtml.c
	$(CC) $(COPTS) $(WINHTML_INC) -Fowinhtml.obj -c ..\common\winhtml.c

#---------------------------------------------------------------

install : cgiowish.exe $(BINDIR) $(SHAREDIR)
	-$(INSTALL) cgiowish.exe $(BINDIR)
	-$(INSTALL) cgnsview.bat $(BINDIR)
	-$(INSTALL) cgnsnodes.bat $(BINDIR)
	-$(INSTALL) *.tcl $(SHAREDIR)
	-$(INSTALL) *.ico $(SHAREDIR)
	-$(INSTALL) ..\common\tclIndex $(SHAREDIR)
	-$(INSTALL) ..\common\*.tcl $(SHAREDIR)
	-$(INSTALL) ..\common\*.ico $(SHAREDIR)

$(BINDIR) : $(INSTALLDIR)
	-mkdir $(BINDIR)

$(SHAREDIR) : $(INSTALLDIR)
	-mkdir $(SHAREDIR)

$(INSTALLDIR) :
	-mkdir $(INSTALLDIR)

#--------------------------------------------------

.c.obj :
	$(CC) $(COPTS) -Fo$@ -c $<

.obj.exe :
	$(LINK) $(LFLAGS) /out:$@ $< $(CGNSLIB) $(BUILDLIBS)

clean:
	-$(RM) *.obj
	-$(RM) *.lib
	-$(RM) *.exp
	-$(RM) *.pdb
	-$(RM) *.ilk
	-$(RM) *.exe
	-$(RM) *.dll
	-$(RM) *.bak

