#/***************************************************************
# * Makefile
# ****************************************************************/

#/*
# * modification history
# *----------------------
# *
# * 03/31/98: K.C. Chang: created.
# */

PRDIR=    /local/pr
#CS225DIR= /local/cs225 
CS225DIR= ..
CC= cc
OPT= -zp4 -Oneatimrl+ #-s 
#DBG= -g
CFLAGS= -T1 -wx -5r -fp5 -mf $(OPT)
LD= $(CC)
LDFLAGS= $(CFLAGS)
LIBDIR= -L$(PRDIR)/lib
LIBS= -lunix -lsocket -lmatrix -ldriver -lnetwork -lutility

DEFINES= -DPR_QNX

SRC=	\
	libcs225.cpp \
	manips.cpp \
	user.cpp \
	gather.cpp
 
OBJ= $(SRC:.cpp=.o)

SRCDIR= .
INCDIR= -I$(CS225DIR)/include -I$(PRDIR)/include

all : 	$(OBJ) lib install-lib bin install-bin 

%.o :	$(SRCDIR)/%.cpp
	$(CC) $(INCDIR) $(CFLAGS) $(DEFINES) -c $<

lib:	libcs225.o
	$(AR) -b libcs225.a $?

bin:	manips gather user

manips:	manips.o
	$(LD) $(LDFLAGS) -o manips $? $(LIBDIR) $(LIBS)

gather:	gather.o
	$(LD) $(LDFLAGS) -o gather $? $(LIBDIR) $(LIBS)

user:	user.o
	$(LD) $(LDFLAGS) -o user $? $(LIBDIR) $(LIBS)


install: install-lib install-bin

install-lib:
	chmod 644     libcs225.a
	cp libcs225.a $(CS225DIR)/lib

install-bin:
	chmod 4755 manips
	chmod 755  gather
	chmod 755  user
	cp manips  $(CS225DIR)/bin/manips225
	cp gather  $(CS225DIR)/bin/gather225
	cp user    $(CS225DIR)/bin/user225

clean:
	rm -f $(OBJ) *~ *.bak *.err $(CS225DIR)/include/*~ \
			manips gather user libcs225.a


