include ..\make.win

CALCDIR = ..\calclib
CALCLIB = $(CALCDIR)\cgnscalc.lib

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

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

all : calcwish.exe
dll : calctcl.dll

install : calcwish.exe $(BINDIR) $(SHAREDIR)
	-$(INSTALL) cgnscalc.bat $(BINDIR)
	-$(INSTALL) calcwish.exe $(BINDIR)
	-$(INSTALL) unitconv.bat $(BINDIR)
	-$(INSTALL) cgnscalc.tcl $(SHAREDIR)
	-$(INSTALL) unitconv.tcl $(SHAREDIR)
	-$(INSTALL) *.ico $(SHAREDIR)

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

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

$(INSTALLDIR) :
	-mkdir $(INSTALLDIR)

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

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

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

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

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

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

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

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

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

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

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

