##### Module Macro #####
NAME    = csetup
SRCS    = $(NAME).c setupapi.c
OBJS    =

##### C7 #####
C7     =  1

##### Library Macro #####
!if $(C7)
LIBS    = libw slibcew ddeml oldnames mscomstf msshlstf msuilstf
!else
LIBS    = libw slibcew ddeml mscomstf msshlstf msuilstf
!endif
MOD    = -AS

##### Include Macro #####
INCLS    = $(NAME).h setupapi.h

##### Resource Macro #####
RCFILES = $(NAME).ico $(NAME).rc

##### DEBUG Defined #####
DEBUG    = 1

##### Build Option Macros #####
!if $(DEBUG)
DDEF    = -DDEBUG
CLOPT    = -Zid -Od -DSTRICT
MOPT    = -Zi
LOPT    = /CO /LI /MAP
!else
DDEF    =
CLOPT    = -Os -DSTRICT
LOPT    =
!endif

##### General Macros #####
DEF    =

##### Tool Macros #####
ASM    = masm -Mx $(MOPT) $(DDEF) $(DEF)
CC    = cl -nologo -c $(MOD) -G2sw -Zp -W3 $(CLOPT) $(DDEF) $(DEF)
CD  = cl -nologo -c -AMw -G2w -Zpei -W3 $(CLOPT) $(DDEF) $(DEF)
LINK    = link /NOD /NOE $(LOPT)
RC    = rc $(DDEF) $(DEF)
HC    = hc

##### Inference Rules #####
.c.obj:
    $(CC) $*.c

.asm.obj:
    $(ASM) $*.asm;

.rc.res:
    $(RC) -r $*.rc

##### Main (default) Target #####
goal: mscuistf.dll $(NAME).exe

dialogs.res: dialogs.rc dialogs.dlg bldver.h
    rc -r dialogs.rc

dlgprocs.obj: cui.h dlgprocs.c
    $(CD) dlgprocs.c

##### Dependents For Goal and Command Line #####
$(NAME).exe: $(SRCS:.c=.obj) $(NAME).def $(NAME).res
    $(LINK) @<<
    $(SRCS:.c=.obj) $(OBJS),
    $(NAME).exe,
    $(NAME).map,
    $(LIBS),
    $(NAME).def
<<
    $(RC) -T $(NAME).res
!if $(DEBUG)
!if !$(C7)
    cvpack -p $(NAME).exe
!endif
    mapsym $(NAME).map
!endif

mscuistf.dll: mscuistf.def dlgprocs.obj dialogs.res
    link @<<
    /LI /CO /align:16 libentry  dlgprocs
    mscuistf.dll
    NUL
    /NOD mdllcew libw mscomstf msuilstf msshlstf
    mscuistf ;
<<
    rc -30 dialogs.res  mscuistf.dll

##### Dependents #####
$(SRCS:.c=.obj): $(INCLS)
$(NAME).res: $(RCFILES) $(INCLS)

##### Clean Directory #####
clean:
    -del *.obj
    -del $(NAME).res
    -del *.map
    -del *.sym
    -del dialogs.res
