#
# 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

IDL_NAME = repl

!IFNDEF DISABLE_NET_UNICODE
UNICODE=1
NET_C_DEFINES=-DUNICODE
!ENDIF

SDKINC = $(BASEDIR)\public\sdk\inc
NETINC = ..\..\inc
SDKCRTINC = $(BASEDIR)\public\sdk\inc\crt
PRIVINC = ..\..\..\inc
COMMONINC = .\common

INCS  = -I$(SDKINC)  -I$(SDKCRTINC) -I$(PRIVINC) -I$(NETINC) -I$(COMMONINC)

TARGETS =   client\$(IDL_NAME)_c.c  \
            client\$(IDL_NAME)_x.c  \
            server\$(IDL_NAME)_y.c  \
            server\$(IDL_NAME)_s.c  \
            $(COMMONINC)\$(IDL_NAME).h

EXTRN_DEPENDS = $(SDKINC)\lmcons.h \
                $(SDKINC)\windef.h \
                $(SDKINC)\lmrepl.h  \
                $(COMMONINC)\imports.h

CPP = -cpp_cmd "$(MIDL_CPP)" -cpp_opt "-nologo -E $(MIDL_FLAGS) $(INCS) $(C_DEFINES) $(NET_C_DEFINES)"

#
# Define Products and Dependencies
#

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

clean: delsrc all

delsrc:
    erase $(TARGETS)

#
# MIDL COMPILE
#

$(TARGETS) : .\$(IDL_NAME).idl .\imports.idl $(EXTRN_DEPENDS) .\$(IDL_NAME).acf
    midl -oldnames -error allocation -error ref -mode c_port $(CPP) .\$(IDL_NAME).idl $(INCS)
    IF EXIST $(IDL_NAME).h copy $(IDL_NAME).h .\$(COMMONINC) & del  $(IDL_NAME).h
    IF EXIST $(IDL_NAME)_x.c copy $(IDL_NAME)_x.c .\client & del  $(IDL_NAME)_x.c
    IF EXIST $(IDL_NAME)_c.c copy $(IDL_NAME)_c.c .\client & del  $(IDL_NAME)_c.c
    IF EXIST $(IDL_NAME)_y.c copy $(IDL_NAME)_y.c .\server & del  $(IDL_NAME)_y.c
    IF EXIST $(IDL_NAME)_s.c copy $(IDL_NAME)_s.c .\server & del  $(IDL_NAME)_s.c
