#
# This is the MIDL compile phase of the build process.
#
# The following is where you put the name of your .idl file without
# the .idl extension:
#

!INCLUDE $(NTMAKEENV)\makefile.plt
O = $(_OBJ_DIR)\$(TARGET_DIRECTORY)

IDL_NAME  = jetrpc
#IMPORT    = wtypes

UNICODE=1

SDKBIN = $(BASEDIR)\public\sdk\bin
SDKINC = $(BASEDIR)\public\sdk\inc
OAKINC = $(BASEDIR)\public\oak\inc
SDKCRTINC = $(BASEDIR)\public\sdk\inc\crt
INCS  = -I. -I$(SDKINC)  -I$(SDKCRTINC) -I$(OAKINC) -I$(TERMSRV_INC_PATH)

CPP = -cpp_cmd "$(MIDL_CPP)" -DNO_STRICT $(MIDL_FLAGS)

HEADER_TARGETS = inc\$(O)\$(IDL_NAME).h
CLIENT_TARGETS = inc\$(O)\$(IDL_NAME)_c.c
SERVER_TARGETS = inc\$(O)\$(IDL_NAME)_s.c

EXTRN_DEPENDS = $(SDKINC)\windef.h   \

#                $(IMPORT).h

#
# Define Products and Dependencies
#

all:    $(CLIENT_TARGETS) $(SERVER_TARGETS) $(EXTRN_DEPENDS)
!IF "$(BUILDMSG)" != ""
    @ech ; $(BUILDMSG) ;
!ENDIF

clean: delete_source all

delete_source:
    erase $(CLIENT_TARGETS) $(SERVER_TARGETS) $(HEADER_TARGETS)

#
# MIDL COMPILE
#

$(CLIENT_TARGETS) : $(IDL_NAME).idl $(EXTRN_DEPENDS)
    -md inc\$(O)
    midl -Oicf -robust -server none -oldnames -error allocation -error ref -ms_ext -c_ext $(CPP) $(IDL_NAME).idl $(INCS) -header $(HEADER_TARGETS)
    IF EXIST $(IDL_NAME)_c.c copy $(IDL_NAME)_c.c $(CLIENT_TARGETS) &  \
        del $(IDL_NAME)_c.c

$(SERVER_TARGETS) : $(IDL_NAME).idl $(EXTRN_DEPENDS)
    -md inc\$(O)
    midl -Oicf -robust -client none -oldnames -error stub_data -error bounds_check -error allocation -error ref -ms_ext -c_ext $(CPP) $(IDL_NAME).idl $(INCS) -header $(HEADER_TARGETS)
    IF EXIST $(IDL_NAME)_s.c copy $(IDL_NAME)_s.c $(SERVER_TARGETS) & \
        del $(IDL_NAME)_s.c