# This file is a product of Sun Microsystems, Inc. and is provided for
# unrestricted use provided that this legend is included on all tape
# media and as a part of the software program in whole or part.  Users
# may copy or modify this file without charge, but are not authorized to
# license or distribute it to anyone else except as part of a product
# or program developed by the user.
# 
# THIS FILE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
# WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
# PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
# 
# This file is provided with no support and without any obligation on the
# part of Sun Microsystems, Inc. to assist in its use, correction,
# modification or enhancement.
# 
# SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
# INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS FILE
# OR ANY PART THEREOF.
# 
# In no event will Sun Microsystems, Inc. be liable for any lost revenue
# or profits or other special, indirect and consequential damages, even
# if Sun has been advised of the possibility of such damages.
# 
# Sun Microsystems, Inc.
# 2550 Garcia Avenue
# Mountain View, California  94043
#
# @(#)Make.NeWS 23.2 90/06/19 
#
# Copyright (c) 1987 by Sun Microsystems, Inc.
#

# Global macro definitions
INSDIR=XXINSDIRXX
OSI=SUN
SYSV=
OPT=-O
BYTES=
COPTS=${BYTES}

# --- Sun Specific Src ---
SUNSPECIFICSRC=
SUNSPECIFICOBJ=
SUNSPECIFICHRD=
SUNSPECIFICPROG=
#
BINDIR=${INSDIR}/bin
DEMODIR=${INSDIR}/demo
LIBDIR=${INSDIR}/lib
INCLUDEDIR=${INSDIR}/include/NeWS
INCLUDE=../../include/NeWS

CFLAGS=${OPT} ${COPTS}  -I${INCLUDE} -D${OSI} ${SYSV}

PROG= cps
PSIOLIB= libpsio.a
CPSLIB= libcps.a

PROGSRCS=	cps.c

PROGOBJS=	cps.o

PROGHDRS=

CPSSRCS=	psio.c \
		psiofprntf.c \
		ctops.c \
		psmacros.c \
		pstoc.c 

CPSOBJS=	psio.o \
		psiofprntf.o \
		ctops.o \
		psmacros.o \
		pstoc.o 

CPSHDRS=

SRCS= ${PROGSRCS} ${CPSSRCS}
OBJS= ${PROGOBJS} ${CPSOBJS}
HDRS= ${PROGHDRS} ${CPSHDRS}



all: 	${CPSLIB} ${PROG}

${CPSLIB}: ${CPSOBJS}
	ar uv ${CPSLIB} $?
	ranlib ${CPSLIB}

${PROG}: ${PROGOBJS}
	cc ${CFLAGS} -o cps cps.o

systoklst.h: ${INCLUDE}/systokenlist
	sed <${INCLUDE}/systokenlist >systoklst.h 's/^.\(.*\)/"\1",/'

cps0:	cps0.o
	cc ${CFLAGS} -o cps0 cps0.o

cps0.o:	${INCLUDE}/encoding.h cps0.c systoklst.h
	cc ${CFLAGS} -DNOHEADER -c cps0.c

cps0.c: cps.c
	-rm -f cps0.c
	ln cps.c cps0.c

pstoctable.h: mkpstoctbl
	./mkpstoctbl>pstoctable.h

mkpstoctbl: mkpstoctbl.o
	cc ${CFLAGS} mkpstoctbl.o -o mkpstoctbl

depend:	../../makedepend ${HDRS} ${SRCS} pstoctable.h systoklst.h
	rm -f cps0.c cps0.o cps0
	../../makedepend ${INCLUDE}

clean:
	rm -f *.o *.a cps0 csp0.c *.BAK pstoctable.h 

install: all bininstall libinstall hdrinstall

bininstall: ${PROG}
	(cd ${BINDIR}; rm -f ${PROG})
	cp ${PROG} ${BINDIR}

libinstall: ${CPSLIB}
	(cd ${LIBDIR}; rm -f ${CPSLIB})
	cp ${CPSLIB} ${LIBDIR}/${CPSLIB}; ranlib ${LIBDIR}/${CPSLIB}

hdrinstall: ${INCLUDE}/psio.h
	rm -f ${INCLUDEDIR}/psio.h
	cp ${INCLUDE}/psio.h ${INCLUDEDIR}/psio.h


# START OF AUTOMATICALLY GENERATED DEPENDENCIES 
cps.o: ../../include/NeWS/encoding.h cps.c systoklst.h
ctops.o: ../../include/NeWS/encoding.h ../../include/NeWS/psio.h ctops.c
mkpstoctbl.o: ../../include/NeWS/encoding.h mkpstoctbl.c
psio.o: ../../include/NeWS/psio.h psio.c
psiofprntf.o: ../../include/NeWS/psio.h psiofprntf.c
pstoc.o: ../../include/NeWS/encoding.h ../../include/NeWS/psio.h 
pstoc.o: pstoc.c pstoctable.h
