#     (C) Copyright Microsoft Corp. 1991.  All rights reserved.
#
#     You have a royalty-free right to use, modify, reproduce and 
#     distribute the Sample Files (and/or any modified version) in 
#     any way you find useful, provided that you agree that 
#     Microsoft has no warranty obligations or liability for any 
#     Sample Application Files which are modified. 
#

# /Gh means use C5.0 compatible 'helper' routines for long math
# The 4D asm code depends on these 'old' routine names.

CC  = cl -c -W2 -AM -G2sw -Zip -Otxza /Gh $(DEF)
ASM = masm -t -D?QUIET $(DEF) -Mx -Zi
LINK= link /NOE/CO/LI/MAP/NOD
NAME= triq
DEF =-DDEBUG
RC  = rc $(DEF)

OBJ  = parse.obj dib.obj triangle.obj 
LIBS = libw Mlibcew 4d\4d.lib 

.c.obj:
	$(CC) $*.c

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

goal: 4d\4d.lib $(NAME).exe tri.exe

4d\4d.lib:
	cd 4d
	$(MAKE)
	cd ..

tri.exe: tri.obj dib.obj triangle.obj tri.res tri.def makefile 4d\4d.lib
        $(LINK) @<<
tri.obj +
dib.obj triangle.obj
tri
tri
libw mlibcew 4d\4d.lib
tri.def
<<
        $(RC) -t tri.res
        cvpack -p tri.exe
	mapsym tri.map

$(NAME).exe: $(NAME).obj $(OBJ) $(NAME).res $(NAME).def makefile 4d\4d.lib
        $(LINK) @<<
$(NAME).obj +
$(OBJ)
$(NAME)
$(NAME)
$(LIBS)
$(NAME).def
<<
        $(RC) -t $(NAME).res
        cvpack -p $(NAME).exe
	mapsym $(NAME).map

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

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

clean:
	cd 4d
	$(MAKE) clean
	cd ..
	del 4d.lib
	del $(NAME).exe
	del tri.exe
        del *.res
        del *.obj
        del *.map
        del *.sym

