XCOMM --------------------------
XCOMM	Imakefile for pplot
XCOMM --------------------------

CCOPTIONS = -O
CDEBUGFLAGS =
SHELL = /bin/sh

XCOMM ------------------------------------------------------------------------
XCOMM Change the following to suit your environment:
XCOMM
XCOMM ------------------------------------------------------------------------

PPLOT_BIN_DIR = /home/cad/bin
PPLOT_MAN_DIR = /home/cad/man/man1
PPLOT_LIB_DIR = /home/cad/lib/pplot

XCOMM ------------------------------------------------------------------------
XCOMM You shouldn't have to change the following.
XCOMM Prior use of DEFLT_DEV to refer to device resolution has been
XCOMM superceded by a device-independent method.
XCOMM "TECHNOLOGY" refers to the default use of pat.${TECHNOLOGY} for
XCOMM CIF layer patterns.
XCOMM ------------------------------------------------------------------------

PSPATHNAME = /epspplot.pro
DEFLT_DEV = PS
TECHNOLOGY = analog

XCOMM ------------------------------------------------------------------------
XCOMM SysV systems which use "lp" should define SYSVSPOOLER below.
XCOMM BSD systems which use "lpr" should leave it undefined.
XCOMM ------------------------------------------------------------------------

# SPOOLER=
SPOOLER= -DSYSVSPOOLER

XCOMM ------------------------------------------------------------------------

DEFINES = -DCADDIR=\"${PPLOT_LIB_DIR}\" \
	  -DPSPATHNAME=\"${PSPATHNAME}\" \
	  -DDEFLT_DEV=\"${DEFLT_DEV}\" \
	  -DTECHNOLOGY=\"${TECHNOLOGY}\" \
	  ${SPOOLER}

SRC0 = cifparse.c ciflex.c cells.c pattern.c pplot.c mem.c access.c \
	flatten.c postscript.c date.c devices.c sort.c edges.c \
	scansw.c
SRC1 = file.c
SRC2 = tmpfile.c

SRCS = $(SRC0) $(SRC1) $(SRC2)

OBJS =  cifparse.o ciflex.o cells.o pattern.o pplot.o mem.o access.o \
	file.o flatten.o postscript.o date.o devices.o sort.o edges.o \
	tmpfile.o scansw.o

SCRIPTS = cifplot cifplot-color cifplot-color2 cifplot-large cifplot-largecolor

AllTarget(export)

export: export.o
	RemoveTargetProgram(export)
	$(CC) $(CCOPTIONS) -o export export.o
	./export $(SRC0) exports.h
	./export $(SRC1) file.h
	./export $(SRC2) tmpfile.h

AllTarget(pplot)

pplot: $(OBJS) exports.h tmpfile.h file.h
	RemoveTargetProgram($@)
	$(CC) $(CCOPTIONS) -o $@ $(OBJS) $(LDOPTIONS)
DependTarget()

install::
	InstallProgram(pplot, ${PPLOT_BIN_DIR})
	InstallManPage(pplot, ${PPLOT_MAN_DIR})
	MakeDir(${PPLOT_LIB_DIR})
	for fname in `ls ./lib`; do \
	   $(CP) ./lib/$$fname ${PPLOT_LIB_DIR}; \
	done
	for sname in ${SCRIPTS}; do \
	   sed -e "s#BINDIR#$(PPLOT_BIN_DIR)#g" -e "s#LIBDIR#$(PPLOT_LIB_DIR)#g" \
		 < $${sname}.sh > ${PPLOT_BIN_DIR}/$$sname; \
	done

clean::
	$(RM) pplot export *.o *.bak exports.h file.h tmpfile.h core

