.SUFFIXES: .cpp .idl .hh .obj .xh .xih

XDIR=.\xhmain
DLLDIR=.\xhmain\dtsdll
INCLUDE=.\;$(DLLDIR);$(INCLUDE)
LIBS=somtk.lib
LINK=ilink

DEBUGFLAGS=/Ti /O- /Os-
BROWSEFLAGS=/Fb
PERFLAGS=/Gh 
CPPFLAGS=$(DEBUGFLAGS) $(BROWSEFLAGS) $(PERFLAGS)
LNKFLAGS=/PM:VIO /NOE /ST:0x360000 /DE

all: $(DLLDIR)\mycls.dll $(XDIR)\xhmain.exe hhmain.exe

$(DLLDIR)\mycls.dll: $(DLLDIR)\mycls.obj $(DLLDIR)\mycls.def {$(LIB)}cppwpa3.obj
     	ilib /geni:$(DLLDIR)\mycls.lib $(DLLDIR)\mycls.def 
        $(LINK) /DLL $(LNKFLAGS) \
	        $(DLLDIR)\mycls.obj cppwpa3.obj \
                /out:$(DLLDIR)\mycls.dll \
        	$(LIBS) $(DLLDIR)\mycls.exp 

hhmain.exe: hhmain.obj  {$(LIB)}cppwpa3.obj $(DLLDIR)\mycls.dll
	icc $(CPPFLAGS) /Fe"hhmain.exe" hhmain.obj cppwpa3.obj \
            /B"$(LNKFLAGS)" $(LIBS) $(DLLDIR)\mycls.lib 

$(XDIR)\xhmain.exe: $(XDIR)\xhmain.obj  {$(LIB)}cppwpa3.obj $(DLLDIR)\mycls.dll
	icc $(CPPFLAGS) /Fe"$(XDIR)\xhmain.exe" $(XDIR)\xhmain.obj \
            cppwpa3.obj /B"$(LNKFLAGS)" \
            $(LIBS) $(DLLDIR)\mycls.lib 


#
.cpp.obj:
	icc /c+ $(CPPFLAGS) /fo$*.obj $<

.idl.xh:
	sc -I $(SOMBASE)\include -sxh -mnoqualifytypes %s

$(DLLDIR)\info.idl: $(DLLDIR)\info.hh
          cd $(DLLDIR)
          icc /c info.hh
          cd ..\..

$(DLLDIR)info.xh:  $(DLLDIR)\info.idl

$(DLLDIR)\mycls.obj: $(DLLDIR)\mycls.cpp {$(INCLUDE)}info.hh
	icc /c $(DEBUGFLAGS) $(BROWSEFLAGS) $(PERFLAGS) /Ge-  \
         /fo$(DLLDIR)\mycls.obj $(DLLDIR)\mycls.cpp

hhmain.obj: hhmain.cpp {$(INCLUDE)}info.hh

$(XDIR)\xhmain.obj: $(XDIR)\xhmain.cpp $(DLLDIR)\info.xh

clean:
        -del $(DLLDIR)\mycls.obj
        -del $(DLLDIR)\mycls.dll
        -del $(DLLDIR)\mycls.lib
        -del $(DLLDIR)\mycls.exp 
        -del $(DLLDIR)\mycls.pdb
	-del $(XDIR)\xhmain.exe 
        -del $(XDIR)\xhmain.obj
        -del $(XDIR)\xhmain.pdb
        -del hhmain.obj
        -del hhmain.exe
        -del hhmain.pdb
