Echo Usage: macmake  n
Expects current directory to be top level directory of the PGPLOT distribution. n
Also sys_mac needs to be a subdirectory of current directory. n
drivers.list needs to be in current directory. n
Some error checking is done to ensure that all the files are in n
their proper places.  The library is built in current directory. n

# PGPLOT source directories.
#-----------------------------------------------------------------------
Set SRCDIR :src:
Set DEMDIR :examples:
Set FNTDIR :fonts:
Set DRVDIR :drivers:
Set GENDIR :sys:
Set SYSDIR :sys_mac:

# FCOMPL contains the name of the fortran compiler.  FFLAGC contains the
# compiler options for the pgplot routines.  FFLAGD contains the compiler
# options used for the example programs.  To produce 68020 or
# or 68030 code, add -mc68020 to FFLAGC or FFLAGD.  If you to produce
# 68881 or 68882 code, add -mc68881 to FFLAGC or FFLAGD.  If you do
# use the 68020 or the 68881 then you should used them when compiling the
# other files that are link with the pgplot library.  If you use the 68881
# option then you also need to link in the FPU libraries, 
# {FLibraries}IntrinsicLibFPU.o", "{FLibraries}FSANELibFPU.o".  FLINK contains
# the name of the fortran link command used for creating the example programs.
# If mc68881 is used to create pgplot.lib, change FLINK to LinkFortranFPU 
# instead of LinkFortran.  However, I did not get pgdemo1 to work with mc68881.
# The other example programs work fine.
Set FCOMPL  FORTRAN
Set FFLAGC  '-u -saveall -b -opt=0 -bkg=0 -mc68020'
Set FFLAGD  '-u -saveall -b -opt=0 -bkg=0 -mc68020'
Set FLINK LinkFortran

# FFLAGU contains the compiler options for create_grexec, create_doc, and
# pgpack.  FLINK contains the link options for these same programs. Using
# the mc68881 compiler option probably will not speed up performance in
# these programs because very little real operations are performed.  I set
# the optimization lower since compile time is more important.  I also set 
# the background option higher since these programs do not call many
# subroutines.
Set FFLAGU '-opt=0 -bkg=3 -mc68020'

# Determine name of script file which sets the memory partition size.
If "{MPW}"Scripts:AddSizeResource == `Exists -f "{MPW}"Scripts:AddSizeResource`
    Set SizRes AddSizeResource
Else if "{MPW}"Scripts:Fsize == `Exists -f "{MPW}"Scripts:Fsize`
    Set SizRes Fsize
Else
    Echo nError: Could not find either AddSizeResource or Fsize in the "{MPW}"Scripts:  n
folder.  They are needed to change the memory setting in the demo programs. n
	Exit
End


# We need a drivers.list file in the current directory, from which to
# determine the drivers to be compiled.

If 'drivers.list' == `Exists -f drivers.list`
    Echo `Date -t` 'Selecting uncommented drivers from drivers.list'
Else
   Echo `Date -t` 'Could not find drivers.list.  Please specify required ' n
  'drivers by un-commenting them in drivers.list.  Then re-run'
  Exit 1
End

# Get a list of driver names.
Set driv_list ''
Echo `Date -t` "Found drivers"
For Driver in `Search -q -r ! drivers.list | Sort -unique -f 1 | StreamEdit -e '/DRIV/ Replace /DRIV/ "DRIV"'`
	Set driv_list "{driv_list} {Driver}.f"
	Echo {Driver}'.f'
End 


# Language Systems FORTRAN compiler expects their include files to appear in the
# directory in which you actually do the compilation.

Duplicate -y {SRCDIR}.inc :

#-----------------------------------------------------------------------
# Routine lists:
#   PG_ROUTINES: basic PGPLOT routines (Fortran-77).
#   PG_NON_STANDARD: non-Fortran-77 aliases for basic routines.
#   GR_ROUTINES: support routines, not called directly by applications
#	(Fortran-77).
#   SYSTEM_ROUTINES: potentially non-portable routines, usually
#	operating-system dependent.
#   OBSOLETE_ROUTINES: obsolete routines used by some programs.
#   DEMOS: demonstration programs
#-----------------------------------------------------------------------
Set PG_ROUTINES "
 pgarro.f 
 pgask.f  
 pgband.f 
 pgbbuf.f 
 pgbeg.f  
 pgbin.f  
 pgbox.f  
 pgbox1.f 
 pgcirc.f 
 pgcl.f   
 pgcn01.f 
 pgcnsc.f 
 pgconb.f 
 pgconl.f 
 pgcons.f 
 pgcont.f 
 pgconx.f 
 pgcp.f   
 pgctab.f 
 pgcurs.f 
 pgdraw.f 
 pgebuf.f 
 pgend.f  
 pgenv.f  
 pgeras.f 
 pgerrb.f 
 pgerrx.f 
 pgerry.f 
 pgetxt.f 
 pgfunt.f 
 pgfunx.f 
 pgfuny.f 
 pggray.f 
 pghi2d.f 
 pghis1.f 
 pghist.f 
 pghtch.f 
 pgiden.f 
 pgimag.f 
 pglab.f  
 pglcur.f 
 pgldev.f 
 pglen.f  
 pgline.f 
 pgmove.f 
 pgmtxt.f 
 pgncur.f 
 pgnoto.f 
 pgnpl.f  
 pgnumb.f 
 pgolin.f 
 pgpage.f 
 pgpanl.f 
 pgpap.f  
 pgpixl.f 
 pgpnts.f 
 pgpoly.f 
 pgpt.f   
 pgptxt.f 
 pgqah.f  
 pgqcf.f  
 pgqch.f  
 pgqci.f  
 pgqcir.f 
 pgqcol.f 
 pgqcr.f  
 pgqcs.f  
 pgqfs.f  
 pgqhs.f  
 pgqinf.f 
 pgqitf.f 
 pgqls.f  
 pgqlw.f  
 pgqpos.f 
 pgqtbg.f 
 pgqtxt.f 
 pgqvp.f  
 pgqvsz.f 
 pgqwin.f 
 pgrect.f 
 pgrnd.f  
 pgrnge.f 
 pgsah.f  
 pgsave.f 
 pgscf.f  
 pgsch.f  
 pgsci.f  
 pgscir.f 
 pgscr.f  
 pgscrn.f 
 pgsfs.f  
 pgshls.f 
 pgshs.f  
 pgsitf.f 
 pgsls.f  
 pgslw.f  
 pgstbg.f 
 pgsubp.f 
 pgsvp.f  
 pgswin.f 
 pgtbox.f 
 pgtext.f 
 pgupdt.f 
 pgvect.f 
 pgvsiz.f 
 pgvstd.f 
 pgvw.f   
 pgwedg.f 
 pgwnad.f 
"

Set PG_NON_STANDARD "
 pgadvance.f 
 pgbegin.f 
 pgcurse.f 
 pglabel.f 
 pgmtext.f 
 pgncurse.f 
 pgpaper.f 
 pgpoint.f 
 pgptext.f 
 pgvport.f 
 pgvsize.f 
 pgvstand.f 
 pgwindow.f 
"

Set GR_ROUTINES "
 grarea.f 
 grbpic.f 
 grchsz.f 
 grclip.f 
 grclos.f 
 grclpl.f 
 grctoi.f 
 grcurs.f 
 grdot0.f 
 grdtyp.f 
 gresc.f  
 grepic.f 
 gretxt.f 
 grfa.f   
 grfao.f  
 grgfil.f 
 grgray.f 
 grimg0.f 
 grimg1.f 
 grimg2.f 
 grimg3.f 
 gritoc.f 
 grldev.f 
 grlen.f  
 grlin0.f 
 grlin1.f 
 grlin2.f 
 grlin3.f 
 grlina.f 
 grmcur.f 
 grmker.f 
 grmova.f 
 grmsg.f 
 gropen.f 
 grpage.f 
 grpars.f 
 grpixl.f 
 grpocl.f 
 grprom.f 
 grpxpo.f 
 grpxps.f 
 grpxpx.f 
 grpxre.f 
 grqcap.f 
 grqci.f  
 grqcol.f 
 grqcr.f  
 grqdev.f 
 grqdt.f  
 grqfnt.f 
 grqls.f  
 grqlw.f  
 grqpos.f 
 grqtxt.f 
 grqtyp.f 
 grquit.f 
 grrec0.f 
 grrect.f 
 grsci.f  
 grscr.f  
 grsetc.f 
 grsets.f 
 grsfnt.f 
 grsize.f 
 grskpb.f 
 grslct.f 
 grsls.f  
 grslw.f  
 grsyds.f 
 grsymk.f 
 grsyxd.f 
 grterm.f 
 grtext.f 
 grtoup.f 
 grtrim.f 
 grtrn0.f 
 grtxy0.f 
 grvct0.f 
 grwarn.f 
 grxhls.f 
 grxrgb.f 
"

Set SYSTEM_ROUTINES "
 grdate.f 
 grflun.f 
 grgcom.f 
 grgenv.f 
 grglun.f 
 grgmem.f 
 grgmsg.f 
 grlgtr.f 
 groptx.f 
 grsy00.f 
 grtrml.f 
 grtter.f 
 gruser.f 
"

Set OBSOLETE_ROUTINES "
 grchar.f 
 grchr0.f 
 grdat2.f 
 grgtc0.f 
 grinqfont.f 
 grinqli.f 
 grinqpen.f 
 grlinr.f 
 grmark.f 
 grmovr.f 
 grsetfont.f 
 grsetli.f 
 grsetpen.f 
 grtran.f 
 grvect.f 
 pgsetc.f 
 pgsize.f 
"

Set DEMOS "
 pgdemo1 
 pgdemo2 
 pgdemo3 
 pgdemo4 
 pgdemo5 
 pgdemo6 
 pgdemo7 
 pgdemo8 
 pgdemo9 
 pgdemo10 
 pgdemo11 
 pgdemo12 
"

Set MAC_ROUTINES "pgblck.f"

Begin
Echo -n "# Makefile for PGPLOT. n
# This file is automatically generated.  n
# n
# This generates the PGPLOT binary files (libraries and demos) in the n
# current default directory. n
#----------------------------------------------------------------------- n
#	PGPLOT subdirectories n
SRCDIR = {SRCDIR} n
DEMDIR = {DEMDIR} n
FNTDIR = {FNTDIR} n
DRVDIR = {DRVDIR} n
SYSDIR = {SYSDIR} n
GENDIR = {GENDIR} n
# n
# FCOMPL contains the name of the fortran compiler.  FFLAGC contains the n
# compiler options for the pgplot routines.  FFLAGD contains the compiler n
# options used for the example programs.  To produce 68020 or n
# or 68030 code, add -mc68020 to FFLAGC or FFLAGD.  If you to produce n
# 68881 or 68882 code, add -mc68881 to FFLAGC or FFLAGD.  If you do n
# use the 68020 or the 68881 then you should used them when compiling the n
# other files that are link with the pgplot library.  If you use the 68881 n
# option then you also need to link in the FPU libraries,  n
# "{FLibraries}IntrinsicLibFPU.o", "{FLibraries}FSANELibFPU.o".  FLINK contains n
# the name of the fortran link command used for creating the example programs. n
# If mc68881 is used to create pgplot.lib, change FLINK to LinkFortranFPU  n
# instead of LinkFortran.  However, I did not get pgdemo1 to work with mc68881. n
# The other example programs work fine. n
# FFLAGU contains the compiler options for create_grexec, create_doc, and n
# pgpack.  FLINK contains the link options for these same programs. Using n
# the mc68881 compiler option probably will not speed up performance in n
# these programs because very little real operations are performed.  I set n
# the optimization lower since compile time is more important.  I also set n
# the background option higher since these programs do not call many n
# subroutines. n
# n
FCOMPL = {FCOMPL} n
FFLAGC = {FFLAGC} n
FFLAGD = {FFLAGD} n
FFLAGU = {FFLAGU} n
FLINK = {FLINK} n
#  n
#  Name of script to set memory size in demo programs. n
#  n
SizRes = {SizRes}  n
# n
# Routine lists. n
# n
"
End > pgplot.make

Echo `Date -t` "Finding files in PG Standard routines"

Begin
  Set PG_ROUTINES_F ""
  Quote -n  PG_ROUTINES = 
  For files in {PG_ROUTINES}
  	Echo ' '
    If {SYSDIR}{files} == `Exists -f {SYSDIR}{files}`
	   Set PG_ROUTINES_f "{PG_ROUTINES_f} {SYSDIR}{FILES}"
	   Echo -n tt '{SYSDIR}'{files}.o 
	Else 
	   Set PG_ROUTINES_f "{PG_ROUTINES_f} {SRCDIR}{FILES}"
	   Echo -n tt '{SRCDIR}'{files}.o
	End 
  End
  Echo
  Echo
End >> pgplot.make

Echo `Date -t` "Finding files in PG Non Standard routines"

Begin
  Set PG_NON_STANDARD_f ""
  Quote -n PG_NON_STANDARD =
  For files in {PG_NON_STANDARD}
    Echo ' '
    If {SYSDIR}{files} == `Exists -f {SYSDIR}{files}`
	   Set PG_NON_STANDARD_f "{PG_NON_STANDARD_f} {SYSDIR}{FILES}"
	   Echo -n tt '{SYSDIR}'{files}.o 
	Else 
	   Set PG_NON_STANDARD_f "{PG_NON_STANDARD_f} {SRCDIR}{FILES}"
	   Echo -n tt '{SRCDIR}'{files}.o
	End
  End
  Echo
  Echo
End >> pgplot.make

Echo `Date -t` "Finding files in GR Routines"

Begin
  Set GR_ROUTINES_f ""
  Quote -n GR_ROUTINES = 
  For files in {GR_ROUTINES}
  	Echo ' '
    If {SYSDIR}{files} == `Exists -f {SYSDIR}{files}`
	   Set GR_ROUTINES_f "{GR_ROUTINES_f} {SYSDIR}{FILES}"
	   Echo -n tt '{SYSDIR}'{files}.o 
	Else 
	   Set GR_ROUTINES_f "{GR_ROUTINES_f} {SRCDIR}{FILES}"
	   Echo -n tt '{SRCDIR}'{files}.o
	End
  End
  Echo
  Echo
End >> pgplot.make

Echo `Date -t` "Finding files in System Routines"

Begin
  Set SYSTEM_ROUTINES_f ""
  Quote -n SYSTEM_ROUTINES =
  For files in {SYSTEM_ROUTINES}
  Echo ' '
    If {SYSDIR}{files} == `Exists -f {SYSDIR}{files}`
	   Set SYSTEM_ROUTINES_f "{SYSTEM_ROUTINES_f} {SYSDIR}{FILES}"
	   Echo -n tt '{SYSDIR}'{files}.o 
	Else 
	   Set SYSTEM_ROUTINES_f "{SYSTEM_ROUTINES_f} {GENDIR}{FILES}"
	   Echo -n tt '{GENDIR}'{files}.o 
	End
  End
  Echo
  Echo
End >> pgplot.make

Echo `Date -t` "Finding files in Driver Routines"

Begin
  Set Driv_list_f ""
  Quote -n  DRIV_LIST = 
  For files in {driv_list}
  	Echo ' '
    If {SYSDIR}{files} == `Exists -f {SYSDIR}{files}`
	   Set Driv_list_f "{Driv_list_f} {SYSDIR}{FILES}"
	   Echo -n tt '{SYSDIR}'{files}.o 
	Else 
	   Set Driv_list_f "{Driv_list_f} {DRVDIR}{FILES}"
	   Echo -n tt '{DRVDIR}'{files}.o
	End 
  End
  Echo
  Echo
End >> pgplot.make

Echo `Date -t` "Finding files in Obsolete Routines"

Begin
  Set OBSOLETE_ROUTINES_f ""
  Quote -n  OBSOLETE_ROUTINES = 
  For files in {OBSOLETE_ROUTINES}
  	Echo ' '
    If {SYSDIR}{files} == `Exists -f {SYSDIR}{files}`
	   Set OBSOLETE_ROUTINES_f "{OBSOLETE_ROUTINES_f} {SYSDIR}{FILES}"
	   Echo -n tt '{SYSDIR}'{files}.o 
	Else 
	   Set OBSOLETE_ROUTINES_f "{OBSOLETE_ROUTINES_f} {SRCDIR}{FILES}"
	   Echo -n tt '{SRCDIR}'{files}.o 
	End
  End
  Echo
  Echo
End >> pgplot.make

Begin
  Set MAC_ROUTINES_f ""
  Quote -n  MAC_ROUTINES = 
  For files in {MAC_ROUTINES}
  	Echo ' '
	Echo -n tt '{SYSDIR}'{files}.o 
	Set MAC_ROUTINES_f "{MAC_ROUTINES_f} {SYSDIR}{files}"
  End
  Echo
  Echo
End >> pgplot.make



#-----------------------------------------------------------------------
# Target pgplot.lib is used to built the PGPLOT subroutine library.
# pgplot.lib is the primary PGPLOT object library.
#-----------------------------------------------------------------------

Echo `Date -t` 'Writing pgplot.lib target.'

Begin
Echo "# n
#----------------------------------------------------------------------- n
# Rules for compiling the .o files n
#----------------------------------------------------------------------- n
#"
Echo 'all  pgplot.lib grfont.dat demos'
Echo 'pgplot.lib  {PG_ROUTINES} {PG_NON_STANDARD} {GR_ROUTINES} '
Echo  'grexec.f.o {DRIV_LIST} {SYSTEM_ROUTINES} {MAC_ROUTINES}'
Echo  t  'Lib -f -mf {PG_ROUTINES} '
Echo tt '{PG_NON_STANDARD} '
Echo tt '{GR_ROUTINES} '
Echo tt '{DRIV_LIST} '
Echo tt '{SYSTEM_ROUTINES} '
Echo tt '{MAC_ROUTINES} '
Echo tt 'grexec.f.o  -o pgplot.lib'
End >> pgplot.make

Echo `Date -t` 'Determining object file dependencies.'

# List source code file dependencies explicitly.
Echo `Date -t` 'Writing PG_ROUTINES dependencies'

Begin
  For file in {PG_ROUTINES_f}
	If `evaluate "{file}" =~ '/{()1}()2/'`
		if {1} == SRCDIR
		   Set dir `Echo -n {SRCDIR}{2}`
		Else If {1} == DEMDIR
		   Set dir `Echo -n {DEMDIR}{2}`
		Else If {1} == FNTDIR
		   Set dir `Echo -n {FNTDIR}{2}`
		Else If {1} == DRVDIR
		   Set dir `Echo -n {DRVDIR}{2}`
		Else If {1} == GENDIR
		   Set dir `Echo -n {GENDIR}{2}`
		Else If {1} == SYSDIR
		   Set dir `Echo -n {SYSDIR}{2}`
		End
	End
	Echo -n {file}.o   {file}; 
	search  -sf -i -q /include'grpckg1.inc'/  "{dir}" > Dev:Null && Echo -n " grpckg1.inc"; 
	search  -sf -i -q /include'pgplot.inc'/  "{dir}" > Dev:Null && Echo -n " pgplot.inc"
	Echo  nt '{FCOMPL} ' {file} ' {FFLAGC}'
  End
End >> pgplot.make

Echo `Date -t` 'Writing PG_NON_STANDARD dependencies'

Begin
  For file in {PG_NON_STANDARD_f}
	If `evaluate "{file}" =~ '/{()1}()2/'`
		if {1} == SRCDIR
		   Set dir `Echo -n {SRCDIR}{2}`
		Else If {1} == DEMDIR
		   Set dir `Echo -n {DEMDIR}{2}`
		Else If {1} == FNTDIR
		   Set dir `Echo -n {FNTDIR}{2}`
		Else If {1} == DRVDIR
		   Set dir `Echo -n {DRVDIR}{2}`
		Else If {1} == GENDIR
		   Set dir `Echo -n {GENDIR}{2}`
		Else If {1} == SYSDIR
		   Set dir `Echo -n {SYSDIR}{2}`
		End
	End
	Echo -n {file}.o   {file}; 
	search  -sf -i -q /include'grpckg1.inc'/  "{dir}" > Dev:Null && Echo -n " grpckg1.inc"; 
	search  -sf -i -q /include'pgplot.inc'/  "{dir}" > Dev:Null && Echo -n " pgplot.inc"
	Echo  nt '{FCOMPL} ' {file} ' {FFLAGC}'
  End
End >> pgplot.make

Echo `Date -t` 'Writing GR_ROUTINES dependencies'

Begin
  For file in {GR_ROUTINES_f}
	If `evaluate "{file}" =~ '/{()1}()2/'`
		if {1} == SRCDIR
		   Set dir `Echo -n {SRCDIR}{2}`
		Else If {1} == DEMDIR
		   Set dir `Echo -n {DEMDIR}{2}`
		Else If {1} == FNTDIR
		   Set dir `Echo -n {FNTDIR}{2}`
		Else If {1} == DRVDIR
		   Set dir `Echo -n {DRVDIR}{2}`
		Else If {1} == GENDIR
		   Set dir `Echo -n {GENDIR}{2}`
		Else If {1} == SYSDIR
		   Set dir `Echo -n {SYSDIR}{2}`
		End
	End
	Echo -n {file}.o   {file}; 
	search  -sf -i -q /include'grpckg1.inc'/  "{dir}" > Dev:Null && Echo -n " grpckg1.inc"; 
	search  -sf -i -q /include'pgplot.inc'/  "{dir}" > Dev:Null && Echo -n " pgplot.inc"
	Echo  nt '{FCOMPL} ' {file} ' {FFLAGC}'
  End
End >> pgplot.make

Echo `Date -t` 'Writing SYSTEM_ROUTINES dependencies'

Begin
  For file in {SYSTEM_ROUTINES_f}
	If `evaluate "{file}" =~ '/{()1}()2/'`
		if {1} == SRCDIR
		   Set dir `Echo -n {SRCDIR}{2}`
		Else If {1} == DEMDIR
		   Set dir `Echo -n {DEMDIR}{2}`
		Else If {1} == FNTDIR
		   Set dir `Echo -n {FNTDIR}{2}`
		Else If {1} == DRVDIR
		   Set dir `Echo -n {DRVDIR}{2}`
		Else If {1} == GENDIR
		   Set dir `Echo -n {GENDIR}{2}`
		Else If {1} == SYSDIR
		   Set dir `Echo -n {SYSDIR}{2}`
		End
	End
	Echo -n {file}.o   {file}; 
	search  -sf -i -q /include'grpckg1.inc'/  "{dir}" > Dev:Null && Echo -n " grpckg1.inc"; 
	search  -sf -i -q /include'pgplot.inc'/  "{dir}" > Dev:Null && Echo -n " pgplot.inc"
	Echo  nt '{FCOMPL} ' {file} ' {FFLAGC}'
  End
End >> pgplot.make

Echo `Date -t` 'Writing driv_list dependencies'

Begin
  For file in {Driv_list_f}
	If `evaluate "{file}" =~ '/{()1}()2/'`
		if {1} == SRCDIR
		   Set dir `Echo -n {SRCDIR}{2}`
		Else If {1} == DEMDIR
		   Set dir `Echo -n {DEMDIR}{2}`
		Else If {1} == FNTDIR
		   Set dir `Echo -n {FNTDIR}{2}`
		Else If {1} == DRVDIR
		   Set dir `Echo -n {DRVDIR}{2}`
		Else If {1} == GENDIR
		   Set dir `Echo -n {GENDIR}{2}`
		Else If {1} == SYSDIR
		   Set dir `Echo -n {SYSDIR}{2}`
		End
	End
	Echo -n {file}.o   {file}; 
	search  -sf -i -q /include'grpckg1.inc'/  "{dir}" > Dev:Null && Echo -n " grpckg1.inc"; 
	search  -sf -i -q /include'pgplot.inc'/  "{dir}" > Dev:Null && Echo -n " pgplot.inc"
	Echo  nt '{FCOMPL} ' {file} ' {FFLAGC}'
  End
  Echo grexec.f.o  grexec.f n
t '{FCOMPL} ' grexec.f ' {FFLAGC}' n
grexec.f  drivers.list {SYSDIR}create_grexec.f n
t  Directory '{SYSDIR}' n
t  '{FCOMPL}' create_grexec.f '{FFLAGU}' n
t  LinkFORTRANtool create_grexec create_grexec.f.o n
t  Move -y create_grexec :: n
t  Directory :: n
t create_grexec
End >> pgplot.make


Echo `Date -t` 'Writing MAC_ROUTINES dependencies'
#  Mac routines are always in {SYSDIR}, so don't need if structure
Begin
  For file in {MAC_ROUTINES_f}
	If `evaluate "{file}" =~ '/{()1}()2/'`
		Set dir `Echo -n {SYSDIR}{2}`
	End
	Echo -n {file}.o   {file}; 
	search  -sf -i -q /include'grpckg1.inc'/  "{dir}" > Dev:Null && Echo -n " grpckg1.inc"; 
	search  -sf -i -q /include'pgplot.inc'/  "{dir}" > Dev:Null && Echo -n " pgplot.inc"
	Echo  nt '{FCOMPL} ' {file} ' {FFLAGC}'
  End
End >> pgplot.make
Echo `Date -t` 'Writing OBSOLETE_ROUTINES dependencies'


Begin
	Echo 'pgplotold.lib  {OBSOLETE_ROUTINES}'
	Echo t Lib -f -mf ' {OBSOLETE_ROUTINES} -o pgplotold.lib'
End >> pgplot.make

Begin
  For file in {OBSOLETE_ROUTINES_f}
	If `evaluate "{file}" =~ '/{()1}()2/'`
		if {1} == SRCDIR
		   Set dir `Echo -n {SRCDIR}{2}`
		Else If {1} == DEMDIR
		   Set dir `Echo -n {DEMDIR}{2}`
		Else If {1} == FNTDIR
		   Set dir `Echo -n {FNTDIR}{2}`
		Else If {1} == DRVDIR
		   Set dir `Echo -n {DRVDIR}{2}`
		Else If {1} == GENDIR
		   Set dir `Echo -n {GENDIR}{2}`
		Else If {1} == SYSDIR
		   Set dir `Echo -n {SYSDIR}{2}`
		End
	End
	Echo -n {file}.o   {file}; 
	search  -sf -i -q /include'grpckg1.inc'/  "{dir}" > Dev:Null && Echo -n " grpckg1.inc"; 
	search  -sf -i -q /include'pgplot.inc'/  "{dir}" > Dev:Null && Echo -n " pgplot.inc"
	Echo  nt '{FCOMPL} ' {file} ' {FFLAGC}'
  End
End >> pgplot.make


#-----------------------------------------------------------------------
# Target "demos" is used to make the demo programs. They can also be made
# individually.
#-----------------------------------------------------------------------
Echo `Date -t` 'Writing Demos target'

Begin
  Echo -n 'demos  '
  For file in {DEMOS}
	Echo -n '{DEMDIR}'"{file} "
  End
  Echo 'pgplot.lib'
  Echo t 'Echo `Date -t` Creating demonstration programs.'
  For file in {DEMOS}
    Echo '{DEMDIR}'{file}  '{DEMDIR}'{file}.f.o pgplot.lib
	Echo t '{FLINK}' '{DEMDIR}'{file} '{DEMDIR}'{file}.f.o pgplot.lib
	Echo t AddResourceFile '{DEMDIR}'{file}
	If {file} == "pgdemo3"
		Echo t '{SizRes}' '{DEMDIR}'{file} 1024
	Else 
		Echo t '{SizRes}' '{DEMDIR}'{file} 512
    End
  End
  For file in {DEMOS}
	Echo '{DEMDIR}'{file}.f.o   '{DEMDIR}'{file}.f
	Echo t '{FCOMPL} {DEMDIR}'{file}.f ' {FFLAGD}'
  End
End >> pgplot.make

#-----------------------------------------------------------------------
# Target "grfont.dat" is the binary font file.
# This is created from grfont.txt with the "pgpack" program.
#    (a) compile the `pgpack' program; then
#    (b) run `pgpack' to convert the ASCII version of the font file
#    (grfont.txt) into the binary version (grfont.dat). When executed,
#    `pgpack' should report:
#	Characters defined:   996
#	Array cells used:   26732
#-----------------------------------------------------------------------
Echo `Date -t` 'Writing grfont.dat target.'
Begin
   Echo grfont.dat  '{FNTDIR}grfont.txt {SYSDIR}pgpack.f' n
	t Duplicate -y '{SYSDIR}pgpack.f {FNTDIR}' n
	t Directory '{FNTDIR}' n
	t If grfont.dat == '`Exists -f grfont.dat`' n
	tt Delete grfont.dat n
	t  End n
	t FORTRAN pgpack.f '{FFLAGU}' n
	t LinkFORTRANtool pgpack pgpack.f.o  n
	t 'Echo `Date -t` Executing pgpack, which takes a while and the ball does not spin. n'n
	t 'Should report: n'n
	t 'Characters defined:   996 n'n
	t 'Array cells used:   26732' n
	t pgpack n
	t 'Echo `Date -t` Finished creating grfont.dat.' n
	t Directory ::
End >> pgplot.make

Echo `Date -t` 'Writing pgplot.doc target.'
Begin
	Echo pgplot.doc  {SYSDIR}create_doc.f n
	t  Directory '{SYSDIR}' n
	t  '{FCOMPL}' create_doc.f '{FFLAGU}' n
	t  LinkFORTRANtool create_doc create_doc.f.o n
	t  Move -y create_doc :: n
	t  Directory :: n
	t 'Echo `Date -t` Executing create_doc, which takes a long time and the ball does not spin.' 
	Echo -n t create_doc '{SRCDIR}'
	For files in {PG_ROUTINES}
		Echo ' '
		Echo -n tt {files} 
	End 
	Echo
	Echo t 'Echo `Date -t` Finished creating pgplot.html and pgplot.doc.' 
End >> pgplot.make

Echo `Date -t` 'Writing clean target.'
Begin
	Echo clean  n
	t  Delete -i '{PG_ROUTINES} 'n
	t '{PG_NON_STANDARD} 'n
	t '{GR_ROUTINES} 'n
	t	grexec.f.o '{DRIV_LIST} 'n
	t '{SYSTEM_ROUTINES} 'n
	t '{MAC_ROUTINES}'
End >> pgplot.make

Echo `Date -t` 'Finished.'
