# Make for pcps
###########################################################################
#									  #
#		     USER CUSTOMISABLE AREA				  #
#									  #
###########################################################################


###########################################################################
# COMPILER								  #	   #
###########################################################################
# CC defines the C compiler to be used - must be ansi (ie. old cc no good)
#CC=gcc
# a good one for HP_UX
CC=c89


###########################################################################
# LIBRARIES								  #
###########################################################################
# LIBS defines the libraries to be used
# since removing the use of curses, none should be required.
LIBS=
#LIBS=-lcurses -ltermcap
#LIBS=-lcurses


###########################################################################
# ENVIRONMENT - USED INSIDE PCPS					  #
###########################################################################
# define the default printer, the "more" command, and the lpr command

#		  "more" TYPE COMMAND TO PIPE TO
# your preferred more type command.  Most often this will be "more" but
# some people prefer to use "less" or "pg" for extra functionality.

MORE="-DMORECMD=\"more\""


#		   DEFAULT PRINTER
# the default printer to send the PostScript.  Most systems will have an
# alias "PostScript" but some systems may just call it "lp" or "lp0"

DEFP="-DDEFPRINT=\"PostScript\""
# DEFP="-DDEFPRINT=\"lp\""


#		   DEFAULT PRINT COMMAND				    */
# the print command to pipe the PostScript.  It should be formatted so	    */
# that the printer name will follow it with no intermediate white-space.    */
# HP_UX uses "lp -d" so I have this defined also                            */

# Most older systems
#PIPE="-DPIPECMD=\"lpr -P\""

# HP_UX, AIX, SOLARIS2.4 etc.
PIPE="-DPIPECMD=\"lp -d\""




###########################################################################
# SYSTEM DEFINES							  #
###########################################################################
# defines for system architecture - examples follow. Uncomment the
# applicable line

# sun3, sun4 running SunOS    :
#DEFINES=-DUNIX -DSUNOS
# sun4 running Solaris <= 2.3 :
#DEFINES=-DUNIX -DSYSV -DSOLARIS
# sun4 running Solaris > 2.3  :
#DEFINES=-DUNIX -DSYSV -DSOLARIS24
# sun386i		      :
#DEFINES=-DUNIX -DSUN386i
# bull dpx20, ibm rs6000      :
#DEFINES=-DUNIX -DRS6K
# DEC ULTRIX, bull dpx2       :
#DEFINES=-DUNIX -DULTRIX
# HP_UX using c89	      :
DEFINES=-DUNIX -D_PROTOTYPES -D_INCLUDE_POSIX_SOURCE -D_XPG2 -DHP_UX
# NeXT using cc 	      :
#DEFINES=-DUNIX -DULTRIX -DNEXT
# Linux 		      :
#DEFINES=-DUNIX -DLINUX
# SGI IRIX (only needs to find <unistd.h> properly):
#DEFINES=-DUNIX

###########################################################################
# BINDIR								  #
###########################################################################
# BINDIR defines where the binaries are to be moved
# when a 'make install' is executed.
BINDIR=/usr/local/bin


###########################################################################
# INCLUDES								  #
###########################################################################
# put your standard include directories here
INCLUDE=-I/usr/include

#debug
DEBUG=


###########################################################################
#									  #
#		    END USER CUSTOMISABLE AREA				  #
#									  #
###########################################################################


CFLAGS=$(DEFINES) $(MORE) $(DEFP) $(PIPE) $(INCLUDE) $(DEBUG)

COM    = pcps
OBJS   = pcps.o unix.o
DBGOBJ = pcpsdb.o unixdb.o
HEAD   = pcps.h unix.h struct.h define.h valargs.h

pcps:	$(OBJS)
	$(CC) $(CFLAGS) -o $(COM) $(OBJS) $(LIBS)
	@echo Build of pcps complete

db1:	$(DBGOBJ)
	$(CC) $(CFLAGS) -DDEBUG1 -o $(COM) $(DBGOBJ) $(LIBS)
	@echo Build of pcps with DEBUG1 complete

cvarg:	cvarg.o
	$(CC) -o cvarg cvarg.o
	@echo Build of cvarg complete

pcps.o: $(HEAD) pcps.c makefile
	$(CC) -c $(CFLAGS) pcps.c

unix.o: $(HEAD) unix.c makefile
	$(CC) -c $(CFLAGS) unix.c

pcpsdb.o:	$(HEAD) pcps.c makefile
	$(CC) -c $(CFLAGS) -DDEBUG1 -o pcpsdb.o pcps.c

unixdb.o:	$(HEAD) unix.c makefile
	$(CC) -c $(CFLAGS) -DDEBUG1 -o unixdb.o unix.c

cvarg.o:	cvarg.h cvarg.c
	$(CC) -c cvarg.c


# -------------------------------------------------------------------------
# remove all object files
# -------------------------------------------------------------------------
clean:
	rm -f *.o $(COM)

# -------------------------------------------------------------------------
# install binaries
# -------------------------------------------------------------------------
install:	$(COM)
	for i in $(COM); do \
	cp $$i $(BINDIR); \
	done

.SUFFIXES: .c .o
.c.o:
	$(CC) $(CFLAGS) -c $< $(LIBS)
