NAME = mciwnd
OBJ  = mciwnd.obj
LIBS = libw slibcew vfw

!if "$(DEBUG)" == "NO"
DEF     =
CLOPT   =
MASMOPT =
LINKOPT =
!else
DEF     = -DDEBUG
CLOPT   = -Zid
MASMOPT = -Zi
LINKOPT = /CO/LI
!endif

CC  = cl -c -W3 -AS -Zp -G2sw -Oxas $(DEF) $(CLOPT) -DWIN31
ASM = masm -Mx $(MASMOPT)
LINK= link /NOE/NOD/LI/MAP/AL:16/ONERROR:NOEXE $(LINKOPT)
RC  = rc 

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

goal: $(NAME).exe

$(NAME).exe: $(OBJ) $(NAME).res $(NAME).def makefile
        $(LINK) $(OBJ), $(NAME), $(NAME),$(LIBS), $(NAME).def
        $(RC) -31 $(NAME).res
        -mapsym $(NAME).map

$(NAME).res: $(NAME).rc $(NAME).ico
        $(RC) -r $(NAME).rc

clean:
        del $(NAME).exe
        del *.res
        del *.obj
        del *.map
        del *.sym
        del *.pdb

copy:
	copy $(NAME).exe ..\..\bin
	copy $(NAME).sym ..\..\bin

depend:
	mv makefile makefile.old
	sed "/^# START Dependencies/,/^# END Dependencies/D" makefile.old > makefile
	del makefile.old
	echo # START Dependencies >> makefile
	includes -l *.c *.asm >> makefile
	echo # END Dependencies >> makefile
