#        File:  make_dos.met
#        Makefile for Metagraphics DOS versions of the kernal library
#   %kw # %v    %n    %d    %t #
# 53    MAKE_DOS.MET    25-Nov-95    7:31:50 # # 

#*****************************************************************************
#*                                                                           *
#*         Copyright (c) 1990-92  Metagraphics Software Corporation	           *
#*      269 Mount Hermon Road, PO Box 66779, Scotts Valley, CA 95066	        *
#*                Phone: 408-438-1550     FAX:408-438-5379		              *
#*									                                                  *
#*    The source code included herein contains proprietary information of    *
#*  Metagraphics Software Corporation.  Use and distribution of this source  *
#*   code is strictly limited to the terms of the Metagraphics Source Code   *
#*                          License Agreement.				                    *
#*									                                                  *
#*           DISSEMINATION OF SOURCE CODE INFORMATION, IN ANY FORM,	        *
#*               TO UNLICENSED PARTIES IS STRICTLY PROHIBITED.		           *
#*									                                                  *
#*****************************************************************************

 
#
#
# Suggested batch file: 
# 
# nmake -f make_dos.met PRODUCT=X ENVIRON=D1 DRIVER=D %1
#
# This makes the MetaWINDOW - DOS real mode dynamic load driver kernal
#
# The argument at the end can be any of the targets below:
# Some of the more usefull targets are:
#
# drivers->  Makes driver files  
# clean  ->  Wipes off the temp files, obj's, etc. Forces a complete build
# libonly->  Makes the library from the objs. Handy if you're including 
#             debug info.   
# pack	->	 Zips the build together before switching to a new lib build		
# unpack ->  Unzips a build
# masm   ->  Invokes masm specifically for some of the modules that optasm
#             won't assemble
#

#DEBUG = /Zi

# ************ These are normally defined on the command line ************
METNAME =  $(PRODUCT)$(ENVIRON)$(DRIVER)

!IF  "$(DRIVER)" == "D" || "$(DRIVER)" == "O"
FULLLIB = 0
!ENDIF

!IF  "$(DRIVER)" == "L" || "$(DRIVER)" == "I"
FULLLIB = 1
!ENDIF

!IF  "$(ENVIRON)" == "H3" || "$(ENVIRON)" == "W3" || "$(ENVIRON)" == "R3" || "$(ENVIRON)" == "T3"  || "$(ENVIRON)" == "B3"
IS386 = 1
!ELSE
IS386 = 0
!ENDIF


#You need a lib type 
!IFNDEF FULLLIB
!ERROR You must define a library build variant
!ENDIF 

LD = ..\lib          #lib directory
DD = ..\drv          #driver directory
AD = ..\archive      #archive directory

#set librarian prefix and suffix to add an obj into lib

# Microsoft or compatible
LIBPFX =
LIBSFX = &
LIBLINE = lib $(LD)\met_$(METNAME) @lib.tmp

# Borland/Turbo Pascal (no link, but zip all objs)
!IF  "$(ENVIRON)" == "TP" || "$(ENVIRON)" == "T2"
LIBPFX =
LIBSFX =
LIBLINE = pkzip $(LD)\$(METNAME)tpu *.obj
!ENDIF

# Phar Lap 386, & Rational 4G
!IF  $(IS386)
LIBPFX = -add
LIBSFX =
#Watcom librarian, ok for MetaWare, MSVC32, and Borland 32)
LIBLINE = wlib $(LD)\met_$(METNAME) /l @lib.tmp
!ENDIF


# ---------------------------- TARGETS ---------------------------------

# must do multiple OBJ because of DOS line length limits when linking
#OBJ1  = arcs0.obj arcs1.obj arcs2.obj arcs3.obj arcs4.obj arcs8.obj
OBJ1  = arcs0.obj arcs1.obj arcs4.obj arcs8.obj
#OBJ2  = bits0.obj bits1.obj bits2.obj bits3.obj bits8.obj 
OBJ2  = bits0.obj bits1.obj bits2.obj bits3.obj 
#OBJ3  = curs0.obj curs2.obj curs3.obj curs7.obj curs8.obj curs9.obj 
OBJ4  = devc0.obj devc1.obj devc2.obj devc3.obj    
#OBJ5  = dpen0.obj dpen1.obj dpen2.obj dpen3.obj dpen4.obj dpen5.obj dpen6.obj
OBJ5  = dpen2.obj dpen3.obj dpen4.obj dpen5.obj 
#OBJ6  = evnt0.obj 
#OBJ7  = file0.obj file1.obj file2.obj file3.obj file4.obj file5.obj file6.obj  
OBJ7  = file0.obj file1.obj file6.obj  
OBJ8  = graf0.obj  graf2.obj 
OBJ9  = graf1.obj
OBJ10 = hcvp0.obj hcvp1.obj hcvp2.obj hcvp3.obj hcvp4.obj hcvp5.obj hcvp6.obj
#OBJ11 = idev0.obj idev1.obj inon0.obj 
OBJ11 = idev0.obj idev1.obj  
#OBJ12 = kvir0.obj kvir1.obj kvir2.obj kvir3.obj kvir6.obj kvir9.obj
OBJ12 = kvir9.obj
#OBJ13 = lin07.obj line0.obj line1.obj line2.obj line8.obj line9.obj 
OBJ13 = lin07.obj line0.obj line1.obj line9.obj
#OBJ14 = list0.obj mous0.obj 
OBJ14 = mous0.obj 
#OBJ15 = npen0.obj npen1.obj npen2.obj npen3.obj npen4.obj npen5.obj npen8.obj npen9.obj
OBJ15 = npen0.obj npen1.obj npen2.obj npen3.obj npen4.obj npen8.obj
#OBJ16 = oval0.obj oval1.obj oval2.obj oval3.obj oval4.obj oval8.obj oval9.obj
OBJ16 = oval0.obj oval1.obj oval4.obj oval8.obj oval9.obj
#OBJ17 = poly0.obj poly1.obj poly2.obj poly3.obj poly4.obj poly5.obj poly6.obj
OBJ17 = poly0.obj poly1.obj poly4.obj 
#OBJ18 = qury0.obj qury1.obj qury2.obj qury3.obj qury4.obj qury6.obj
OBJ18 = qury4.obj qury6.obj
#OBJ19 = rect0.obj rect1.obj rect2.obj rect3.obj rect4.obj rect9.obj roth8.obj rotr8.obj 
OBJ19 = rect0.obj rect1.obj rect4.obj roth8.obj rotr8.obj 
#OBJ20 = seed1.obj 
#OBJ21 = str00.obj str02.obj str04.obj str10.obj str12.obj str14.obj str20.obj str22.obj
OBJ21 = str02.obj str12.obj str20.obj str22.obj
#OBJ22 = syst0.obj text1.obj text2.obj text3.obj text8.obj text9.obj
OBJ22 = syst0.obj text1.obj text2.obj text3.obj text9.obj
#OBJ23 = util0.obj util1.obj util2.obj util3.obj util4.obj util5.obj util6.obj util7.obj util8.obj util9.obj
OBJ23 = util8.obj
OBJ24 = view0.obj view1.obj view2.obj view3.obj view4.obj view5.obj view6.obj view7.obj view8.obj view9.obj 
OBJ25 = wndo0.obj wndo1.obj wndo2.obj wndo3.obj wndo4.obj wndo5.obj wndo7.obj wndo8.obj wndo9.obj
OBJ26 = xpol4.obj xpol5.obj xpol6.obj xpol7.obj
#OBJ27 = xypt0.obj xypt1.obj xypt2.obj xypt3.obj xypt4.obj xypt5.obj xypt6.obj 
#OBJ28 = yore3.obj yore4.obj yore5.obj 
OBJ28 = yore5.obj 
#OBJ29 = zect0.obj zect1.obj zect2.obj zect3.obj zect4.obj zect5.obj zect6.obj zect7.obj zect8.obj zect9.obj
OBJ29 = zect0.obj zect4.obj 
#OBJ30 = inon1.obj inon2.obj inon3.obj inon4.obj inon5.obj inon6.obj inon7.obj inon8.obj inon9.obj
#OBJ31 = bits5.obj bits7.obj poly7.obj wndo6.obj
OBJ31 = bits5.obj bits7.obj  
#OBJ32 = ptin0.obj ptin1.obj rect5.obj rect6.obj rect7.obj rect8.obj xypt7.obj
#OBJ33 = strk0.obj strk1.obj strk2.obj strk3.obj strk4.obj strk5.obj strk6.obj strk7.obj strk8.obj
OBJ33 = strk0.obj strk1.obj strk8.obj
#OBJ34 = text0.obj text4.obj text5.obj text6.obj text7.obj 
#OBJ35 = str01.obj str03.obj str05.obj str11.obj str13.obj str15.obj
#OBJ36 = reg00.obj reg01.obj reg02.obj reg03.obj reg04.obj reg05.obj reg06.obj reg07.obj reg08.obj reg09.obj
#OBJ37 = reg10.obj reg11.obj reg12.obj reg13.obj reg14.obj reg15.obj reg16.obj reg17.obj reg18.obj reg19.obj
#OBJ38 = reg20.obj curs1.obj kvir8.obj npen6.obj npen7.obj
#OBJ39 = bezr0.obj bezr1.obj bezr2.obj bezr3.obj bezr4.obj bezr5.obj bezr6.obj bezr7.obj bezr8.obj bezr9.obj

DRV1 = blt50.obj blit6.obj blit7.obj blit9.obj 
DRV2 = blt03.obj blt04.obj blt05.obj blt06.obj blt07.obj
DRV3 = fil10.obj fil15.obj fil16.obj fil25.obj fil50.obj 
DRV4 = fill3.obj fill6.obj fill7.obj fill8.obj fill9.obj
DRV5 = img01.obj img02.obj img03.obj img04.obj img05.obj
DRV6 = lin00.obj lin02.obj lin03.obj lin04.obj lin05.obj lin06.obj 
DRV7 = setp0.obj setp1.obj setp2.obj setp3.obj setp5.obj
DRV8 = getp0.obj getp1.obj getp2.obj getp3.obj getp5.obj

#8514
DRV9 = fill4.obj blt00.obj blit8.obj blt01.obj blt02.obj img07.obj img06.obj lin01.obj setp4.obj getp4.obj

#16BIT
DRV10 = fil35.obj blt09.obj blt08.obj img08.obj img09.obj 

#24BIT
DRV11 = fil45.obj


# -------- the fully linked library is the primary target --------
$(LD)\met_$(METNAME).lib: objA objB objC objD objE objF drvA drvB lib.tmp
   del $(LD)\met_$(METNAME).lib
   $(LIBLINE)

# must use these pseudo targets because of makes line length limits
objA: $(OBJ1)  $(OBJ2)  $(OBJ3)  $(OBJ4)  $(OBJ5)  $(OBJ6)
objB: $(OBJ7)  $(OBJ8)  $(OBJ9)  $(OBJ10) $(OBJ11) $(OBJ12)
objC: $(OBJ13) $(OBJ14) $(OBJ15) $(OBJ16) $(OBJ17) $(OBJ18)
objD: $(OBJ19) $(OBJ20) $(OBJ21) $(OBJ22) $(OBJ23) $(OBJ24) $(OBJ25)
objE: $(OBJ26) $(OBJ27) $(OBJ28) $(OBJ29) $(OBJ30) $(OBJ31) $(OBJ32)
objF: $(OBJ33) $(OBJ34) $(OBJ35) $(OBJ36) $(OBJ37) $(OBJ38) $(OBJ39)


!IF  $(FULLLIB)
# fully linked lib

!IF  "$(PRODUCT)" == "C"
# include all drivers
drvA: devc4.obj $(DRV1)	$(DRV2)  $(DRV3)  $(DRV4) $(DRV5)
drvB: $(DRV6)  $(DRV7)  $(DRV8)  $(DRV9) $(DRV10) $(DRV11)
!ENDIF

!IF  "$(PRODUCT)" == "A"
# omit 16 & 24 bit driver 
drvA: devc4.obj $(DRV1)	$(DRV2)  $(DRV3)  $(DRV4) $(DRV5)
drvB: $(DRV6)  $(DRV7)  $(DRV8)  $(DRV9)
!ENDIF

!IF  "$(PRODUCT)" == "B"
# omit 8514 driver 
drvA: devc4.obj $(DRV1)	$(DRV2)  $(DRV3)  $(DRV4) $(DRV5)
drvB: $(DRV6)  $(DRV7)  $(DRV8)  $(DRV10) $(DRV11)
!ENDIF

!IF  "$(PRODUCT)" == "X" || "$(PRODUCT)" == "V"
# omit 8514, 16-bit (***and 24-bit drivers***)
drvA: devc4.obj $(DRV1)	$(DRV2)  $(DRV3)  $(DRV4) $(DRV5)
drvB: $(DRV6)  $(DRV7)  $(DRV8) 
!ENDIF

!ELSE
# driver based lib
drvA: devc5.obj 
drvB: 
!ENDIF


# re-generate the librarian response file
# if either it doesn't exist, or this makefile has been edited
lib.tmp: make_dos.met
	echo $(LIBPFX) $(OBJ1) $(LIBSFX) > lib.tmp
 	echo $(LIBPFX) $(OBJ2) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ3) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ4) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ5) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ6) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ7) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ8) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ9) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ10) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ11) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ12) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ13) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ14) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ15) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ16) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ17) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ18) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ19) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ20) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ21) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ22) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ23) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ24) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ25) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ26) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ27) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ28) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ29) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ30) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ31) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ32) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ33) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ34) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ35) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ36) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ37) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ38) $(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(OBJ39) $(LIBSFX) >> lib.tmp

!IF  $(FULLLIB)  #include driver code too
 	echo $(LIBPFX) devc4.obj$(LIBSFX) >> lib.tmp
 	echo $(LIBPFX) $(DRV1)$(LIBSFX)  >> lib.tmp
 	echo $(LIBPFX) $(DRV2)$(LIBSFX)  >> lib.tmp
 	echo $(LIBPFX) $(DRV3)$(LIBSFX)  >> lib.tmp
 	echo $(LIBPFX) $(DRV4)$(LIBSFX)  >> lib.tmp
 	echo $(LIBPFX) $(DRV5)$(LIBSFX)  >> lib.tmp
 	echo $(LIBPFX) $(DRV6)$(LIBSFX)  >> lib.tmp
 	echo $(LIBPFX) $(DRV7)$(LIBSFX)  >> lib.tmp

!IF  "$(PRODUCT)" == "C"
# include all drivers
 	echo $(LIBPFX) $(DRV9)$(LIBSFX)  >> lib.tmp
 	echo $(LIBPFX) $(DRV10)$(LIBSFX)  >> lib.tmp
 	echo $(LIBPFX) $(DRV11)$(LIBSFX)  >> lib.tmp
!ENDIF

!IF  "$(PRODUCT)" == "A"
# omit 16- and 24-bit drivers
 	echo $(LIBPFX) $(DRV9)$(LIBSFX)  >> lib.tmp
!ENDIF

!IF  "$(PRODUCT)" == "B"
# omit 8514 driver 
 	echo $(LIBPFX) $(DRV10)$(LIBSFX)  >> lib.tmp
 	echo $(LIBPFX) $(DRV11)$(LIBSFX)  >> lib.tmp
!ENDIF

 	echo $(LIBPFX) $(LIBSFX)          >> lib.tmp
 	echo $(LIBPFX) $(DRV8)            >> lib.tmp


!ELSE
#driver based lib
 	echo $(LIBPFX) devc5.obj >> lib.tmp
!ENDIF

!IF  "$(LIBSFX)" == "&"    # MS lib needs this
   echo $(LD)\met_$(METNAME); >> lib.tmp
!ENDIF


# --------  driver resource targets --------
!IF  "$(ENVIRON)" == "D1"
DFX = drv
!ELSE
DFX = drp
!ENDIF
DLINK = link /PACKC/TINY/MAP/NOI @lkdrv.tmp

!IF  $(IS386) 
DFX = dll
DLINK = tlink32 /Tpd /ap @lkdrv.tmp
DDEF = drv.def
!ENDIF

drivers: metwnd01.$(DFX) metwnd03.$(DFX) metwnd04.$(DFX) metwnd05.$(DFX) metwnd07.$(DFX) metwnd08.$(DFX) metwnd09.$(DFX)

#monochrome
metwnd01.$(DFX): drv01.obj fil10.obj fil15.obj fil16.obj blt05.obj img01.obj img02.obj lin00.obj lin05.obj setp2.obj getp2.obj
   del $(DD)\metwnd01.$(DFX)
 	echo drv01 fil10 fil15 fil16 blt05 img01 img02 lin00 lin05 setp2 getp2 > lkdrv.tmp
   $(DLINK), $(DD)\metwnd01.$(DFX),$(DD)\metwnd01.map,,$(DDEF); 
	del lkdrv.tmp    

#multi plane
metwnd03.$(DFX): drv03.obj fil10.obj fil15.obj fil16.obj blt05.obj img01.obj img02.obj lin00.obj lin05.obj setp5.obj getp5.obj
   del $(DD)\metwnd03.$(DFX)
 	echo drv03 fil10 fil15 fil16 blt05 img01 img02 lin00 lin05 setp5 getp5 > lkdrv.tmp
   $(DLINK), $(DD)\metwnd03.$(DFX),$(DD)\metwnd03.map,,$(DDEF); 
	del lkdrv.tmp    

#EGA
metwnd04.$(DFX): drv04.obj fil51.obj blt03.obj blt05.obj blt04.obj img01.obj img03.obj lin00.obj lin03.obj setp3.obj getp3.obj\
 fill3.obj fill6.obj fill8.obj fill9.obj fil10.obj fil15.obj fil16.obj\
 blt51.obj blit6.obj blit9.obj img02.obj
   del $(DD)\metwnd04.$(DFX)
 	echo  drv04 fil51 blt03 blt05 blt04 img01 img03 lin00 lin03 setp3 getp3+ > lkdrv.tmp
   echo  fill3 fill6 fill8 fill9 fil10 fil15 fil16+ >> lkdrv.tmp
   echo  blt51 blit6 blit9 img02 >> lkdrv.tmp
   $(DLINK), $(DD)\metwnd04.$(DFX),$(DD)\metwnd04.map,,$(DDEF); 
 	del lkdrv.tmp    

#VGA
metwnd05.$(DFX): drv05.obj fil52.obj blt03.obj blt05.obj blt04.obj img01.obj img03.obj lin00.obj lin04.obj setp3.obj getp3.obj\
 fill3.obj fill6.obj fill7.obj fill8.obj fill9.obj fil10.obj fil15.obj fil16.obj\
 blt52.obj blit7.obj blit9.obj img02.obj
   del $(DD)\metwnd05.$(DFX)
 	echo  drv05 fil52 blt03 blt05 blt04 img01 img03 lin00 lin04 setp3 getp3+ > lkdrv.tmp
   echo  fill3 fill6 fill7 fill8 fill9 fil10 fil15 fil16+ >> lkdrv.tmp
   echo  blt52 blit7 blit9 img02 >> lkdrv.tmp
   $(DLINK), $(DD)\metwnd05.$(DFX),$(DD)\metwnd05.map,,$(DDEF); 
	del lkdrv.tmp    

#8514
metwnd07.$(DFX): drv07.obj fill4.obj blt00.obj blit8.obj blt01.obj blt02.obj blt06.obj \
img07.obj img06.obj lin00.obj lin01.obj setp4.obj getp4.obj
   del $(DD)\metwnd07.$(DFX)
 	echo drv07 fill4 blt00 blit8 blt01 blt02 blt06 img07 img06 lin00 lin01 setp4 getp4 > lkdrv.tmp
   $(DLINK), $(DD)\metwnd07.$(DFX),$(DD)\metwnd07.map,,$(DDEF); 
	del lkdrv.tmp    

#8 bit
metwnd08.$(DFX): drv08.obj fil25.obj blt06.obj blt07.obj img04.obj img05.obj lin00.obj lin02.obj setp0.obj getp0.obj 
   del $(DD)\metwnd08.$(DFX)
 	echo drv08 fil25 blt06 blt07 img04 img05 lin00 lin02 setp0 getp0 > lkdrv.tmp
   $(DLINK), $(DD)\metwnd08.$(DFX),$(DD)\metwnd08.map,,$(DDEF);
	del lkdrv.tmp    

#16 bit
metwnd09.$(DFX): drv09.obj fil35.obj blt09.obj blt08.obj img08.obj img09.obj lin00.obj lin06.obj setp1.obj getp1.obj
   del $(DD)\metwnd09.$(DFX)
 	echo drv09 fil35 blt09 blt08 img08 img09 lin00 lin06 setp1 getp1 > lkdrv.tmp
   $(DLINK), $(DD)\metwnd09.$(DFX),$(DD)\metwnd09.map,,$(DDEF); 
	del lkdrv.tmp    

#24 bit
metwnd11.$(DFX): drv11.obj fil45.obj blt09.obj blt08.obj img08.obj img09.obj lin00.obj lin06.obj setp1.obj getp1.obj
   del $(DD)\metwnd11.$(DFX)
 	echo drv11 fil45 blt09 blt08 img08 img09 lin00 lin06 setp1 getp1 > lkdrv.tmp
   $(DLINK), $(DD)\metwnd11.$(DFX),$(DD)\metwnd11.map,,$(DDEF); 
	del lkdrv.tmp    

# ---------------------------- DEPENDENCIES ---------------------------------

# standard dependency set

METINCS = metawndo.inc metalibs.inc metlinks.inc
METMACS = metmacs1.inc metmacs2.inc metconst.inc metports.inc 
GRAFDATA = grafdata.inc metaproc.inc system08.inc

# touch files - must do this due to limit complexity of dependencies
MET = met.tch
$(MET): $(METINCS) $(METMACS) $(GRAFDATA)
    rem one of the standard dependencies has changed!
    @yesno would you like to halt make for lib $(METNAME)
    echo fred > $(MET)

# separate touch file for driver code, since it doesn't depend on grafdata
DRV = drv.tch
$(DRV): $(METINCS) $(METMACS)
    echo fred > $(DRV)


# make sure metlinks.inc is up to date
metlinks.inc: lnk_$(METNAME).inc   
    copy  lnk_$(METNAME).inc  metlinks.inc
    touch metlinks.inc


# asm routines
arcs0.obj: arcs0.asm $(MET) xpol_4.inc metmacs3.inc
arcs1.obj: arcs1.asm $(MET)  
arcs2.obj: arcs2.asm $(MET)  
arcs3.obj: arcs3.asm $(MET)  
arcs4.obj: arcs4.asm $(MET)  
arcs8.obj: arcs8.asm $(MET) xpol_4.inc metmacs3.inc
bezr0.obj: bezr0.asm $(MET)
bezr1.obj: bezr1.asm $(MET)
bezr2.obj: bezr2.asm $(MET)
bezr3.obj: bezr3.asm $(MET)
bezr4.obj: bezr4.asm $(MET)
bezr5.obj: bezr5.asm $(MET)
bezr6.obj: bezr6.asm $(MET) metmacs3.inc
bezr7.obj: bezr7.asm $(MET) metmacs3.inc
bezr8.obj: bezr8.asm $(MET) metmacs3.inc
bezr9.obj: bezr9.asm $(MET)
bits0.obj: bits0.asm $(MET)
bits1.obj: bits1.asm $(MET) blit_0.inc
bits2.obj: bits2.asm $(MET) metmacs3.inc
bits3.obj: bits3.asm $(MET) metmacs3.inc
bits5.obj: bits5.asm $(MET) bits_5.inc
bits6.obj: bits6.asm $(MET)
bits7.obj: bits7.asm $(MET)
bits8.obj: bits8.asm $(MET) metmacs3.inc
curs0.obj: curs0.asm $(MET) curs_ega.inc metmacs3.inc
curs1.obj: curs1.asm $(MET) 
curs2.obj: curs2.asm $(MET) curs_ega.inc
curs3.obj: curs3.asm $(MET) 
curs7.obj: curs7.asm $(MET) metmacs3.inc
curs8.obj: curs8.asm $(MET) 
curs9.obj: curs9.asm $(MET) metmacs3.inc
devc0.obj: devc0.asm $(MET) wndo.inc
devc1.obj: devc1.asm $(MET) wndo.inc
devc2.obj: devc2.asm $(MET) wndo.inc devc.inc 8514a.inc
devc3.obj: devc3.asm $(MET) devc.inc 8514a.inc
devc4.obj: devc4.asm $(MET) 
devc5.obj: devc5.asm $(MET) file.inc
dpen0.obj: dpen0.asm $(MET) dpen.inc
dpen1.obj: dpen1.asm $(MET) dpen.inc 
dpen2.obj: dpen2.asm $(MET)  
dpen3.obj: dpen3.asm $(MET)  
dpen4.obj: dpen4.asm $(MET)  
dpen5.obj: dpen5.asm $(MET) 
dpen6.obj: dpen6.asm $(MET) 
evnt0.obj: evnt0.asm $(MET) metmacs3.inc
file0.obj: file0.asm $(MET) file.inc
file1.obj: file1.asm $(MET) file.inc
file2.obj: file2.asm $(MET) file.inc
file3.obj: file3.asm $(MET) file.inc
file4.obj: file4.asm $(MET) file.inc
file5.obj: file5.asm $(MET) file.inc
file6.obj: file6.asm $(MET) file.inc
graf0.obj: graf0.asm $(MET)  
graf1.obj: graf1.asm $(MET)  
graf2.obj: graf2.asm $(MET)  
hcvp0.obj: hcvp0.asm $(MET) 
hcvp1.obj: hcvp1.asm $(MET) 
hcvp2.obj: hcvp2.asm $(MET) 
hcvp3.obj: hcvp3.asm $(MET) 
hcvp4.obj: hcvp4.asm $(MET) 
hcvp5.obj: hcvp5.asm $(MET) 
hcvp6.obj: hcvp6.asm $(MET) 
idev0.obj: idev0.asm $(MET) 
idev1.obj: idev1.asm $(MET) wndo.inc
inon0.obj: inon0.asm $(MET) inon_0.inc
inon1.obj: inon1.asm $(MET) inon_0.inc metmacs3.inc
inon2.obj: inon2.asm $(MET) inon_0.inc metmacs3.inc
inon3.obj: inon3.asm $(MET) inon_0.inc metmacs3.inc
inon4.obj: inon4.asm $(MET) inon_0.inc metmacs3.inc
inon5.obj: inon5.asm $(MET) inon_0.inc metmacs3.inc
inon6.obj: inon6.asm $(MET) inon_0.inc metmacs3.inc
inon7.obj: inon7.asm $(MET) inon_0.inc metmacs3.inc
inon8.obj: inon8.asm $(MET) inon_0.inc metmacs3.inc
inon9.obj: inon9.asm $(MET) inon_0.inc metmacs3.inc
kvir0.obj: kvir0.asm $(MET) 
kvir1.obj: kvir1.asm $(MET) 
kvir2.obj: kvir2.asm $(MET) 
kvir3.obj: kvir3.asm $(MET)
kvir6.obj: kvir6.asm $(MET) devc.inc
kvir8.obj: kvir8.asm $(MET)
kvir9.obj: kvir9.asm $(MET) devc.inc
lin07.obj: lin07.asm $(MET) line_2.inc
line0.obj: line0.asm $(MET) metmacs3.inc
line1.obj: line1.asm $(MET) metmacs3.inc
line2.obj: line2.asm $(MET) metmacs3.inc
line8.obj: line8.asm $(MET) metmacs3.inc
line9.obj: line9.asm $(MET) metmacs3.inc
list0.obj: list0.asm $(MET)   
mous0.obj: mous0.asm $(MET) wndo.inc
npen0.obj: npen0.asm $(MET) metmacs3.inc
npen1.obj: npen1.asm $(MET) 
npen2.obj: npen2.asm $(MET) 
npen3.obj: npen3.asm $(MET) 
npen4.obj: npen4.asm $(MET) 
npen5.obj: npen5.asm $(MET)
npen6.obj: npen6.asm $(MET)
npen7.obj: npen7.asm $(MET)
npen8.obj: npen8.asm $(MET) 
npen9.obj: npen9.asm $(MET) 
oval0.obj: oval0.asm $(MET) xpol_4.inc metmacs3.inc
oval1.obj: oval1.asm $(MET) xpol_4.inc metmacs3.inc
oval2.obj: oval2.asm $(MET) 
oval3.obj: oval3.asm $(MET) 
oval4.obj: oval4.asm $(MET) xpol_4.inc
oval8.obj: oval8.asm $(MET) metmacs3.inc
oval9.obj: oval9.asm $(MET) metmath1.inc metmacs3.inc 
poly0.obj: poly0.asm $(MET) poly.inc
poly1.obj: poly1.asm $(MET) poly_4.inc
poly2.obj: poly2.asm $(MET) poly_4.inc
poly3.obj: poly3.asm $(MET) poly_4.inc
poly4.obj: poly4.asm $(MET) poly.inc poly_4.inc  metmacs3.inc
poly5.obj: poly5.asm $(MET) poly.inc
poly6.obj: poly6.asm $(MET) poly.inc
poly7.obj: poly7.asm $(MET) 
ptin0.obj: ptin0.asm $(MET) inon_0.inc metmacs3.inc
ptin1.obj: ptin1.asm $(MET) inon_0.inc metmacs3.inc
qury0.obj: qury0.asm $(MET) 
qury1.obj: qury1.asm $(MET) 
qury2.obj: qury2.asm $(MET) 
qury3.obj: qury3.asm $(MET) devc.inc
qury4.obj: qury4.asm $(MET) 
qury6.obj: qury6.asm $(MET) 
rect0.obj: rect0.asm $(MET) metmacs3.inc
rect1.obj: rect1.asm $(MET) metmacs3.inc
rect2.obj: rect2.asm $(MET) metmacs3.inc
rect3.obj: rect3.asm $(MET) metmacs3.inc
rect4.obj: rect4.asm $(MET) metmacs3.inc
rect5.obj: rect5.asm $(MET) xpol_4.inc metmacs3.inc
rect6.obj: rect6.asm $(MET) xpol_4.inc metmacs3.inc
rect7.obj: rect7.asm $(MET)
rect8.obj: rect8.asm $(MET) 
rect9.obj: rect9.asm $(MET) 
reg00.obj: reg00.asm $(MET)  
reg01.obj: reg01.asm $(MET) metmacs3.inc
reg02.obj: reg02.asm $(MET)
reg03.obj: reg03.asm $(MET) metmacs3.inc
reg04.obj: reg04.asm $(MET)
reg05.obj: reg05.asm $(MET)
reg06.obj: reg06.asm $(MET)
reg07.obj: reg07.asm $(MET)
reg08.obj: reg08.asm $(MET)
reg09.obj: reg09.asm $(MET) 
reg10.obj: reg10.asm $(MET)
reg11.obj: reg11.asm $(MET)
reg12.obj: reg12.asm $(MET)
reg13.obj: reg13.asm $(MET)
reg14.obj: reg14.asm $(MET)
reg15.obj: reg15.asm $(MET)
reg16.obj: reg16.asm $(MET)
reg17.obj: reg17.asm $(MET)
reg18.obj: reg18.asm $(MET) metmacs3.inc
reg19.obj: reg19.asm $(MET)
reg20.obj: reg20.asm $(MET)
roth8.obj: roth8.asm $(MET) metmath2.inc
rotr8.obj: rotr8.asm $(MET) metmath2.inc
seed1.obj: seed1.asm $(MET) regclip.inc metmacs3.inc
str00.obj: str00.asm $(MET)
str01.obj: str01.asm $(MET)
str02.obj: str02.asm $(MET)
str03.obj: str03.asm $(MET)
str04.obj: str04.asm $(MET)
str05.obj: str05.asm $(MET)
str10.obj: str10.asm $(MET) metfonts.inc
str11.obj: str11.asm $(MET) metfonts.inc
str12.obj: str12.asm $(MET) metfonts.inc
str13.obj: str13.asm $(MET) metfonts.inc
str14.obj: str14.asm $(MET) metfonts.inc
str15.obj: str15.asm $(MET) metfonts.inc
str20.obj: str20.asm $(MET) metfonts.inc metmacs3.inc
str22.obj: str22.asm $(MET) metfonts.inc
strk0.obj: strk0.asm $(MET) metfonts.inc metmacs3.inc
strk1.obj: strk1.asm $(MET) metfonts.inc
strk2.obj: strk2.asm $(MET) metfonts.inc
strk3.obj: strk3.asm $(MET) metfonts.inc metmacs3.inc
strk4.obj: strk4.asm $(MET) metfonts.inc
strk5.obj: strk5.asm $(MET)  
strk6.obj: strk6.asm $(MET)  
strk7.obj: strk7.asm $(MET) metmacs3.inc
strk8.obj: strk8.asm $(MET) metfonts.inc markers.inc
syst0.obj: syst0.asm $(MET) devc.inc
text0.obj: text0.asm $(MET) 
text1.obj: text1.asm $(MET) metfonts.inc
text2.obj: text2.asm $(MET) 
text3.obj: text3.asm $(MET) 
text4.obj: text4.asm $(MET) 
text5.obj: text5.asm $(MET) 
text6.obj: text6.asm $(MET) 
text7.obj: text7.asm $(MET) 
text8.obj: text8.asm $(MET) 
text9.obj: text9.asm $(MET) metfonts.inc
util0.obj: util0.asm $(MET)
util1.obj: util1.asm $(MET)
util2.obj: util2.asm $(MET)
util3.obj: util3.asm $(MET)
util4.obj: util4.asm $(MET)
util5.obj: util5.asm $(MET)
util6.obj: util6.asm $(MET)
util7.obj: util7.asm $(MET)
util8.obj: util8.asm $(MET) wndo.inc
util9.obj: util9.asm $(MET) metmacs3.inc file.inc
view0.obj: view0.asm $(MET)
view1.obj: view1.asm $(MET) 
view2.obj: view2.asm $(MET)
view3.obj: view3.asm $(MET) 
view4.obj: view4.asm $(MET) 
view5.obj: view5.asm $(MET) 
view6.obj: view6.asm $(MET)
view7.obj: view7.asm $(MET) 
view8.obj: view8.asm $(MET) 
view9.obj: view9.asm $(MET) metmacs3.inc
wndo0.obj: wndo0.asm $(MET) file.inc  
wndo1.obj: wndo1.asm $(MET) devc.inc  
wndo2.obj: wndo2.asm $(MET) wndo.inc file.inc  
wndo3.obj: wndo3.asm $(MET)
wndo4.obj: wndo4.asm $(MET)
wndo5.obj: wndo5.asm $(MET)
wndo6.obj: wndo6.asm $(MET) 
wndo7.obj: wndo7.asm $(MET) 
wndo8.obj: wndo8.asm $(MET) 
wndo9.obj: wndo9.asm $(MET) 
xpol4.obj: xpol4.asm $(MET) xpol_4.inc xpol_5.inc metmacs3.inc
xpol5.obj: xpol5.asm $(MET) xpol_4.inc xpol_5.inc
xpol6.obj: xpol6.asm $(MET) xpol_4.inc
xpol7.obj: xpol7.asm $(MET) xpol_4.inc xpol_5.inc metmacs3.inc
xypt0.obj: xypt0.asm $(MET)
xypt1.obj: xypt1.asm $(MET)
xypt2.obj: xypt2.asm $(MET)
xypt3.obj: xypt3.asm $(MET)
xypt4.obj: xypt4.asm $(MET) 
xypt5.obj: xypt5.asm $(MET) 
xypt6.obj: xypt6.asm $(MET) metmacs3.inc
xypt7.obj: xypt7.asm $(MET) inon_0.inc metmacs3.inc
yore3.obj: yore3.asm $(MET) metmacs3.inc
yore4.obj: yore4.asm $(MET) metmacs3.inc
yore5.obj: yore5.asm $(MET) metmacs3.inc
zect0.obj: zect0.asm $(MET) 
zect1.obj: zect1.asm $(MET)
zect2.obj: zect2.asm $(MET)
zect3.obj: zect3.asm $(MET) 
zect4.obj: zect4.asm $(MET)
zect5.obj: zect5.asm $(MET)
zect6.obj: zect6.asm $(MET)
zect7.obj: zect7.asm $(MET) 
zect8.obj: zect8.asm $(MET) 
zect9.obj: zect9.asm $(MET) 

#primitive code
drv01.obj: drv01.asm $(DRV) drv386.inc
drv03.obj: drv03.asm $(DRV) drv386.inc
drv04.obj: drv04.asm $(DRV) drv386.inc
drv05.obj: drv05.asm $(DRV) drv386.inc
drv07.obj: drv07.asm $(DRV) drv386.inc
drv08.obj: drv08.asm $(DRV) drv386.inc
drv09.obj: drv09.asm $(DRV) drv386.inc

blit6.obj: blit6.asm $(DRV) blit_5.inc fill_var.inc regclipv.inc
blit7.obj: blit7.asm $(DRV) blit_5.inc fill_var.inc regclipv.inc
blit8.obj: blit8.asm $(DRV) regclip.inc 8514a.inc blit_8.inc regclipv.inc
blit9.obj: blit9.asm $(DRV) blit_5.inc fill_var.inc regclipv.inc
blt00.obj: blt00.asm $(DRV) regclip.inc 8514a.inc regclipv.inc
blt01.obj: blt01.asm $(DRV) regclip.inc 8514a.inc regclipv.inc
blt02.obj: blt02.asm $(DRV) regclip.inc 8514a.inc regclipv.inc
blt03.obj: blt03.asm $(DRV) regclip.inc blit_5.inc fill_var.inc regclipv.inc
blt04.obj: blt04.asm $(DRV) regclip.inc blit_5.inc fill_var.inc regclipv.inc
blt05.obj: blt05.asm $(DRV) regclip.inc blit_5.inc fill_var.inc regclipv.inc
blt06.obj: blt06.asm $(DRV) regclip.inc  regclipv.inc
blt07.obj: blt07.asm $(DRV) regclip.inc blit_7.inc regclipv.inc
blt08.obj: blt08.asm $(DRV) regclip.inc regclipv.inc
blt09.obj: blt09.asm $(DRV) regclip.inc regclipv.inc 
blt50.obj: blt50.asm $(DRV) blit5.asm regclip.inc blit_5.inc fill_var.inc regclipv.inc
blt51.obj: blt51.asm $(DRV) blit5.asm regclip.inc blit_5.inc fill_var.inc regclipv.inc
blt52.obj: blt52.asm $(DRV) blit5.asm regclip.inc blit_5.inc fill_var.inc regclipv.inc

fil10.obj: fil10.asm $(DRV) regclip.inc fillm.inc regclipv.inc
fil15.obj: fil15.asm $(DRV) regclip.inc fillm.inc regclipv.inc
fil16.obj: fil16.asm $(DRV) regclip.inc fillm.inc regclipv.inc
fil25.obj: fil25.asm $(DRV) fill_6.inc regclipv.inc
fil35.obj: fil35.asm $(DRV) regclip.inc regclipv.inc
fil45.obj: fil45.asm $(DRV) regclip.inc regclipv.inc fill_8.inc
fil50.obj: fil50.asm $(DRV) fill5.asm regclip.inc fill_5.inc fill_var.inc regclipv.inc
fil51.obj: fil51.asm $(DRV) fill5.asm regclip.inc fill_5.inc fill_var.inc regclipv.inc
fil52.obj: fil52.asm $(DRV) fill5.asm regclip.inc fill_5.inc fill_var.inc regclipv.inc
fill3.obj: fill3.asm $(DRV) fill_5.inc fill_var.inc regclipv.inc
fill4.obj: fill4.asm $(DRV) regclip.inc 8514a.inc fill_5.inc fill_var.inc regclipv.inc
fill6.obj: fill6.asm $(DRV) fill_5.inc fill_var.inc regclipv.inc
fill7.obj: fill7.asm $(DRV) fill_5.inc fill_var.inc regclipv.inc
fill8.obj: fill8.asm $(DRV) fill_5.inc fill_var.inc regclipv.inc
fill9.obj: fill9.asm $(DRV) fill_5.inc fill_var.inc regclipv.inc

img01.obj: img01.asm $(DRV)
img02.obj: img02.asm $(DRV)
img03.obj: img03.asm $(DRV) regclip.inc regclipv.inc
img04.obj: img04.asm $(DRV)
img05.obj: img05.asm $(DRV) regclip.inc regclipv.inc
img06.obj: img06.asm $(DRV) regclip.inc 8514a.inc regclipv.inc
img07.obj: img07.asm $(DRV) 8514a.inc 
img08.obj: img08.asm $(DRV) 
img09.obj: img09.asm $(DRV) regclip.inc regclipv.inc

lin00.obj: lin00.asm $(DRV) regclip.inc line_2.inc line_0.inc regclipv.inc
lin01.obj: lin01.asm $(DRV) regclip.inc 8514a.inc line_2.inc line_0.inc regclipv.inc
lin02.obj: lin02.asm $(DRV) regclip.inc line_2.inc line_0.inc regclipv.inc
lin03.obj: lin03.asm $(DRV) regclip.inc line_2.inc line_0.inc regclipv.inc
lin04.obj: lin04.asm $(DRV) regclip.inc line_2.inc line_0.inc regclipv.inc
lin05.obj: lin05.asm $(DRV) regclip.inc line_2.inc line_0.inc regclipv.inc
lin06.obj: lin06.asm $(DRV) regclip.inc line_2.inc line_0.inc regclipv.inc

setp0.obj: setp0.asm $(DRV) regclip.inc regclipv.inc
setp1.obj: setp1.asm $(DRV) regclip.inc regclipv.inc
setp2.obj: setp2.asm $(DRV) regclip.inc regclipv.inc
setp3.obj: setp3.asm $(DRV) regclip.inc regclipv.inc
setp4.obj: setp4.asm $(DRV) regclip.inc regclipv.inc 8514a.inc
setp5.obj: setp5.asm $(DRV) regclip.inc regclipv.inc

getp0.obj: getp0.asm $(DRV)
getp1.obj: getp1.asm $(DRV)
getp2.obj: getp2.asm $(DRV)
getp3.obj: getp3.asm $(DRV)
getp4.obj: getp4.asm $(DRV) 8514a.inc
getp5.obj: getp5.asm $(DRV) 



# ------------------------ UTILITY TARGETS ---------------------------------

# pseudo target to pack and unpack a library object set
pack:
	pkzip -a $(AD)\$(METNAME).zip *.obj metlinks.inc *.tch

unpack:
	pkunzip  $(AD)\$(METNAME).zip *.*

# pseudo target to clean up
clean:
   @yesno This will ERASE all .obj files. Would you like to halt erase ?
   del *.obj      
   del metlinks.inc
   del lib.tmp
   del *.lst
   del *.err
   del *.crf
   del *.tch

#pseudo target to only build lib, no dependency checks
libonly:	lib.tmp
   del $(LD)\met_$(METNAME).lib
   $(LIBLINE)

masm: $(DRV)
   masm /MX /ML /Z $(DEBUG) fil16.asm, fil16.obj  ;
   masm /MX /ML /Z $(DEBUG) fil25.asm, fil25.obj  ;
   masm /MX /ML /Z $(DEBUG) fil35.asm, fil35.obj  ;
   masm /MX /ML /Z $(DEBUG) fil45.asm, fil45.obj  ;
   masm /MX /ML /Z $(DEBUG) img02.asm, img02.obj  ;

# ----------------------- TRANSLATION RULES --------------------------------
.asm.obj:
!IF  $(IS386) || "$(ENVIRON)" == "TP" || "$(ENVIRON)" == "T2"
#    tasm32 -mx -ml -z /m /q /w+ $(DEBUG) $*.asm, $*.obj ;
   tasmX -mx -ml -z /m /q /w+ $(DEBUG) $*.asm, $*.obj ;
#   386ASM -nolist -twocase $*.asm 
!ELSE
#   masm /MX /ML /Z $(DEBUG) $*.asm, $*.obj ;
   optasm /MX /ML /V /Z $(DEBUG) $*.asm, $*.obj ;
#   tasmX -mx -ml -z /m /q /w+ $(DEBUG) $*.asm, $*.obj ;
!ENDIF
   if errorlevel 1 del $@
   if errorlevel 1 echo 


#  End-Of-File   "make_dos.met"
