# Makefile for PGPLOT use with Microsoft Fortran	AFT 91-Jun-27
#
# This generates the PGPLOT binary files (libraries and demos) in the
# current default directory (which need not be the source directory).
#
#	Directory containing PGPLOT source code
PGTOP=\pgplot
SRCDIR=$(PGTOP)\src
#	Directory containing demo programs
DEMODIR=$(PGTOP)\examples
#	Directory containing device drivers
DRIVDIR=$(PGTOP)\DRIVERS
#	Directory containing font stuff
FONTDIR=$(PGTOP)\fonts
#	Directory containing system-dependent code
SYSDIR=$(PGTOP)\sys_dos
#	Directory to put the libraries
LIBDIR=.
#	Fortran compiler
FCOMPL=FL
FFLAGC=/Gt /FPc
#	C compiler
CCOMPL=
CFLAGC=
# Libraries required for linking
LIBS   = .\PGPLOT+GRAPHICS

#	Rules for compiling Fortran
.SUFFIXES: .F .OBJ

{$(SRCDIR)}.F.OBJ:
	COPY $(SRCDIR)\$*.F $*.FOR
	$(FCOMPL) /c $(FFLAGC) $*.FOR
	DEL $*.FOR

{$(DRIVDIR)}.F.OBJ:
	COPY $(DRIVDIR)\$*.F $*.FOR
	$(FCOMPL) /c $(FFLAGC) $*.FOR
	DEL $*.FOR

{$(SYSDIR)}.F.OBJ:
	COPY $(SYSDIR)\$*.F $*.FOR
	$(FCOMPL) /c $(FFLAGC) $*.FOR
	DEL $*.FOR

all: PGPLOT.LIB GRFONT.DAT PROG

#-----------------------------------------------------------------------
# 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
#-----------------------------------------------------------------------
PGPLOT.LIB:: pgplot.inc grpckg1.inc
	REM
PGPLOT.LIB:: pgask.obj pgarro.obj pgband.obj pgbbuf.obj pgbeg.obj
	LIB PGPLOT -+$?;
PGPLOT.LIB:: pgbin.obj pgbox.obj pgbox1.obj
	LIB PGPLOT -+$?;
PGPLOT.LIB:: pgcirc.obj pgcl.obj   pgclos.obj pgcn01.obj pgcnsc.obj
	LIB PGPLOT -+$?;
PGPLOT.LIB:: pgconb.obj pgconl.obj pgcons.obj pgcont.obj pgconx.obj pgcp.obj
	LIB PGPLOT -+$?;
PGPLOT.LIB:: pgctab.obj pgcurs.obj pgdraw.obj pgebuf.obj pgend.obj pgenv.obj
	LIB PGPLOT -+$?;
PGPLOT.LIB:: pgeras.obj pgerrb.obj pgerrx.obj pgerry.obj pgetxt.obj
	LIB PGPLOT -+$?;
PGPLOT.LIB:: pgfunt.obj pgfunx.obj pgfuny.obj pggray.obj pghi2d.obj
	LIB PGPLOT -+$?;
PGPLOT.LIB:: pghis1.obj pghist.obj pghtch.obj pgiden.obj pgimag.obj pginit.obj
	LIB PGPLOT -+$?;
PGPLOT.LIB:: pglab.obj pglcur.obj pgldev.obj pglen.obj pgline.obj pgmove.obj
	LIB PGPLOT -+$?;
PGPLOT.LIB:: pgmtxt.obj pgncur.obj pgnoto.obj pgnpl.obj pgnumb.obj
	LIB PGPLOT -+$?;
PGPLOT.LIB:: pgolin.obj pgopen.obj pgpage.obj
	LIB PGPLOT -+$?;
PGPLOT.LIB:: pgpap.obj pgpixl.obj pgpnts.obj pgpoly.obj pgpt.obj pgptxt.obj
	LIB PGPLOT -+$?;
PGPLOT.LIB:: pgqah.obj pgqcf.obj  pgqch.obj  pgqci.obj  pgqcir.obj pgqcol.obj
	LIB PGPLOT -+$?;
PGPLOT.LIB:: pgqcr.obj pgqcs.obj pgqfs.obj pgqhs.obj pgqinf.obj pgqls.obj
	LIB PGPLOT -+$?;
PGPLOT.LIB:: pgqlw.obj  pgqpos.obj pgqtbg.obj pgqtxt.obj pgqvp.obj  pgqvsz.obj
	LIB PGPLOT -+$?;
PGPLOT.LIB:: pgqwin.obj pgrect.obj pgrnd.obj  pgrnge.obj pgsah.obj
	LIB PGPLOT -+$?;
PGPLOT.LIB:: pgsave.obj pgscf.obj  pgsch.obj pgsci.obj pgslct.obj
	LIB PGPLOT -+$?;
PGPLOT.LIB:: pgscr.obj pgscrn.obj pgsfs.obj pgshls.obj pgshs.obj
	LIB PGPLOT -+$?;
PGPLOT.LIB:: pgsls.obj  pgslw.obj  pgstbg.obj pgsubp.obj pgsvp.obj
	LIB PGPLOT -+$?;
PGPLOT.LIB:: pgswin.obj pgtbox.obj pgtext.obj pgupdt.obj pgvect.obj
	LIB PGPLOT -+$?;
PGPLOT.LIB:: pgvsiz.obj pgvstd.obj pgvw.obj   pgwedg.obj pgwnad.obj
	LIB PGPLOT -+$?;
PGPLOT.LIB:: grdot1.obj pgconf.obj pgerr1.obj pgpt1.obj
	LIB PGPLOT -+$?;
PGPLOT.LIB:: pgqclp.obj pgqdt.obj  pgqndt.obj pgsclp.obj pgtikl.obj
	LIB PGPLOT -+$?;

PGPLOT.LIB:: pgadvanc.obj pgbegin.obj  pgcurse.obj  pglabel.obj
	LIB PGPLOT -+$?;
PGPLOT.LIB:: pgmtext.obj   pgncurse.obj pgpaper.obj  pgpoint.obj
	LIB PGPLOT -+$?;
PGPLOT.LIB:: pgptext.obj   pgvport.obj  pgvsize.obj  pgvstand.obj
	LIB PGPLOT -+$?;
PGPLOT.LIB:: pgwindow.obj
	LIB PGPLOT -+$?;

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

# These files come from sys_dos directory
PGPLOT.LIB:: grexec.obj msdriv.obj grdate.obj grflun.obj grgcom.obj
	LIB PGPLOT -+$?;
PGPLOT.LIB:: grgenv.obj grglun.obj groptx.obj grtrml.obj grtter.obj gruser.obj
	LIB PGPLOT -+$?;
# These files are found in pgplot\sys
PGPLOT.LIB:: grlgtr.obj grsy00.obj
	LIB PGPLOT -+$?;

grlgtr.obj:	$(PGTOP)\sys\grlgtr.f
	COPY $(PGTOP)\sys\grlgtr.F grlgtr.FOR
	$(FCOMPL) /c $(FFLAGC) grlgtr.FOR
	DEL grlgtr.FOR
grsy00.obj:	$(PGTOP)\sys\grsy00.f
	COPY $(PGTOP)\sys\grsy00.F grsy00.FOR
	$(FCOMPL) /c $(FFLAGC) grsy00.FOR
	DEL grsy00.FOR

#-----------------------------------------------------------------------
# Device drivers
#-----------------------------------------------------------------------
LJDRIVER=ljdriv.obj grlj00.obj
LLDRIVER=lldriv.obj grlj00.obj
NUDRIVER=nudriv.obj
PSDRIVER=psdriv.obj
QMDRIVER=qmdriv.obj grqm00.obj
QPDRIVER=qpdriv.obj grqm00.obj

# Compile drivers that compile under Microsoft Fortran.
# Not all these drivers have actually been tested.
PGPLOT.LIB:: $(NUDRIVER)
	LIB PGPLOT -+$(NUDRIVER);
PGPLOT.LIB:: $(PSDRIVER)
	LIB PGPLOT -+$(PSDRIVER);

#
# Note that if you want to build a sharable library including these routines,
# specifically grdat2.o, you will have to add grdat2.o to the DATAOBJS list.
#
OBSOLETE_ROUTINES=\
    grchar.obj grchr0.obj grdat2.obj grgtc0.obj grmark.obj grinqli.obj\
    grinqpen.obj\
    grsetli.obj grsetpen.obj grlinr.obj grmovr.obj grtran.obj grvect.obj\
    pgsetc.obj pgsize.obj grinqfon.obj grsetfon.obj

#-----------------------------------------------------------------------
# Target "lib" is used to built the PGPLOT subroutiune library.
# libpgplot.a is the primary PGPLOT library.
#-----------------------------------------------------------------------
lib : PGPLOT.LIB

#-----------------------------------------------------------------------
# libpgobs.a contains obsolete routines used by some programs
#-----------------------------------------------------------------------
PGOBS.LIB : $(OBSOLETE_ROUTINES)
	LIB PGOBS -+$?;

#-----------------------------------------------------------------------
# Target "prog" is used to make the demo programs. They can also be made
# individually.
#-----------------------------------------------------------------------
# List of demo programs
DEMOS = pgdemo1.exe  pgdemo2.exe  pgdemo3.exe  pgdemo4.exe  pgdemo5.exe \
	pgdemo6.exe  pgdemo7.exe  pgdemo8.exe  pgdemo9.exe  pgdemo10.exe \
	pgdemo11.exe pgdemo12.exe pgdemo13.exe pgdemo14.exe pgdemo15.exe \
	pgdemo16.exe pgdemo17.exe

prog: $(DEMOS)

pgdemo1.exe: $(DEMODIR)\pgdemo1.f
	COPY $(DEMODIR)\pgdemo1.f pgdemo1.for
	$(FCOMPL) /c $(FFLAGC) pgdemo1.FOR
	LINK /SEGMENTS:256 pgdemo1.obj,,NUL,$(LIBS);
	DEL pgdemo1.for
pgdemo2.exe: $(DEMODIR)\pgdemo2.f
	COPY $(DEMODIR)\pgdemo2.f pgdemo2.for
	$(FCOMPL) /c $(FFLAGC) pgdemo2.FOR
	LINK /SEGMENTS:256 pgdemo2.obj,,NUL,$(LIBS);
	DEL pgdemo2.for
pgdemo3.exe: $(DEMODIR)\pgdemo3.f
	COPY $(DEMODIR)\pgdemo3.f pgdemo3.for
	$(FCOMPL) /c $(FFLAGC) pgdemo3.FOR
	LINK /SEGMENTS:256 pgdemo3.obj,,NUL,$(LIBS);
	DEL pgdemo3.for
pgdemo4.exe: $(DEMODIR)\pgdemo4.f
	COPY $(DEMODIR)\pgdemo4.f pgdemo4.for
	$(FCOMPL) /c $(FFLAGC) pgdemo4.FOR
	LINK /SEGMENTS:256 pgdemo4.obj,,NUL,$(LIBS);
	DEL pgdemo4.for
pgdemo5.exe: $(DEMODIR)\pgdemo5.f
	COPY $(DEMODIR)\pgdemo5.f pgdemo5.for
	$(FCOMPL) /c $(FFLAGC) pgdemo5.FOR
	LINK /SEGMENTS:256 pgdemo5.obj,,NUL,$(LIBS);
	DEL pgdemo5.for
pgdemo6.exe: $(DEMODIR)\pgdemo6.f
	COPY $(DEMODIR)\pgdemo6.f pgdemo6.for
	$(FCOMPL) /c $(FFLAGC) pgdemo6.FOR
	LINK /SEGMENTS:256 pgdemo6.obj,,NUL,$(LIBS);
	DEL pgdemo6.for
pgdemo7.exe: $(DEMODIR)\pgdemo7.f
	COPY $(DEMODIR)\pgdemo7.f pgdemo7.for
	$(FCOMPL) /c $(FFLAGC) pgdemo7.FOR
	LINK /SEGMENTS:256 pgdemo7.obj,,NUL,$(LIBS);
	DEL pgdemo7.for
pgdemo8.exe: $(DEMODIR)\pgdemo8.f
	COPY $(DEMODIR)\pgdemo8.f pgdemo8.for
	$(FCOMPL) /c $(FFLAGC) pgdemo8.FOR
	LINK /SEGMENTS:256 pgdemo8.obj,,NUL,$(LIBS);
	DEL pgdemo8.for
pgdemo9.exe: $(DEMODIR)\pgdemo9.f
	COPY $(DEMODIR)\pgdemo9.f pgdemo9.for
	$(FCOMPL) /c $(FFLAGC) pgdemo9.FOR
	LINK /SEGMENTS:256 pgdemo9.obj,,NUL,$(LIBS);
	DEL pgdemo9.for
pgdemo10.exe: $(DEMODIR)\pgdemo10.f
	COPY $(DEMODIR)\pgdemo10.f pgdemo10.for
	$(FCOMPL) /c $(FFLAGC) pgdemo10.FOR
	LINK /SEGMENTS:256 pgdemo10.obj,,NUL,$(LIBS);
	DEL pgdemo10.for
pgdemo11.exe: $(DEMODIR)\pgdemo11.f
	COPY $(DEMODIR)\pgdemo11.f pgdemo11.for
	$(FCOMPL) /c $(FFLAGC) pgdemo11.FOR
	LINK /SEGMENTS:256 pgdemo11.obj,,NUL,$(LIBS);
	DEL pgdemo11.for
pgdemo12.exe: $(DEMODIR)\pgdemo12.f
	COPY $(DEMODIR)\pgdemo12.f pgdemo12.for
	$(FCOMPL) /c $(FFLAGC) pgdemo12.FOR
	LINK /SEGMENTS:256 pgdemo12.obj,,NUL,$(LIBS);
	DEL pgdemo12.for
pgdemo13.exe: $(DEMODIR)\pgdemo13.f
	COPY $(DEMODIR)\pgdemo13.f pgdemo13.for
	$(FCOMPL) /c $(FFLAGC) pgdemo13.FOR
	LINK /SEGMENTS:256 pgdemo13.obj,,NUL,$(LIBS);
	DEL pgdemo13.for
pgdemo14.exe: $(DEMODIR)\pgdemo14.f
	COPY $(DEMODIR)\pgdemo14.f pgdemo14.for
	$(FCOMPL) /c $(FFLAGC) pgdemo14.FOR
	LINK /SEGMENTS:256 pgdemo14.obj,,NUL,$(LIBS);
	DEL pgdemo14.for
pgdemo15.exe: $(DEMODIR)\pgdemo15.f
	COPY $(DEMODIR)\pgdemo15.f pgdemo15.for
	$(FCOMPL) /c $(FFLAGC) pgdemo15.FOR
	LINK /SEGMENTS:256 pgdemo15.obj,,NUL,$(LIBS);
	DEL pgdemo15.for
pgdemo16.exe: $(DEMODIR)\pgdemo16.f
	COPY $(DEMODIR)\pgdemo16.f pgdemo16.for
	$(FCOMPL) /c $(FFLAGC) pgdemo16.FOR
	LINK /SEGMENTS:256 pgdemo16.obj,,NUL,$(LIBS);
	DEL pgdemo16.for
pgdemo17.exe: $(DEMODIR)\pgdemo17.f
	COPY $(DEMODIR)\pgdemo17.f pgdemo17.for
	$(FCOMPL) /c $(FFLAGC) pgdemo17.FOR
	LINK /SEGMENTS:256 pgdemo17.obj,,NUL,$(LIBS);
	DEL pgdemo17.for

#-----------------------------------------------------------------------
# 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
#-----------------------------------------------------------------------
pgpack.exe: $(FONTDIR)\pgpack.f
	COPY $(FONTDIR)\pgpack.F pgpack.FOR
	$(FCOMPL) $(FFLAGC) pgpack.FOR
	DEL pgpack.FOR

grfont.dat: $(FONTDIR)\grfont.txt pgpack.exe
	DEL grfont.dat
	pgpack <$(FONTDIR)\grfont.txt

#-----------------------------------------------------------------------
# Target "install" is required for Figaro.
#-----------------------------------------------------------------------
install:

#-----------------------------------------------------------------------
# Target "clean" is used to remove all the intermediate files.
#-----------------------------------------------------------------------
clean :
	DEL *.OBJ
	DEL *.FOR
	DEL PGPLOT.BAK
	DEL PGPACK.EXE
	DEL PGPLOT.INC
	DEL GRPCKG1.INC

SPOTLESS: CLEAN
	DEL *.EXE
	DEL GRFONT.DAT
	DEL PGPLOT.LIB

# Include file dependencies:
# The following PG routines reference `pgplot.inc'

grgray.o \
pgask.o  pgbbuf.o pgbeg.o  pgbin.o  pgbox.o  pgcont.o pgcp.o \
pgcurs.o pgebuf.o pgend.o  pgerrb.o pgerrx.o pgerry.o pggray.o pghi2d.o \
pghist.o pgiden.o pglcur.o pglen.o  pgmtxt.o pgncur.o pgolin.o \
pgpage.o pgpap.o  pgpixl.o pgpoly.o pgpt.o   pgptxt.o pgqch.o pgqfs.o \
pgqinf.o pgqvp.o  pgqwin.o pgrect.o pgsch.o  pgsfs.o  pgsvp.o \
pgswin.o pgupdt.o pgvsiz.o pgvstd.o pgvw.o   pgwnad.o: $(SRC)/pgplot.inc

# The following GR routines reference `grpckg.inc'

grarea.o grbpic.o grchr0.o grchsz.o grclos.o grclpl.o grcurs.o \
grdot0.o grdtyp.o gresc.o  gretxt.o grfa.o   grgray.o grgrgr.o \
grldev.o grlen.o  grlin0.o grlin1.o grlin2.o grlin3.o \
grlina.o grlinr.o grmker.o grmova.o grmovr.o gropen.o grpage.o \
grpixl.o grpxpo.o grpxpx.o \
grqci.o  grqcol.o grqdev.o grqdt.o  grqfnt.o grqls.o  \
grqlw.o  grqpos.o grqtyp.o grrec0.o grrect.o \
grsci.o  grscr.o  grsetc.o grsetli.o grsets.o grsfnt.o grsize.o \
grslct.o grsls.o  grslw.o  grterm.o grtext.o grtrn0.o grtxy0.o \
grvct0.o: $(SRCDIR)/grpckg1.inc

pgplot.inc: $(SRCDIR)\pgplot.inc
	COPY $(SRCDIR)\pgplot.inc .

grpckg1.inc: $(SRCDIR)\grpckg1.inc
	COPY $(SRCDIR)\grpckg1.inc .
