# A makefile for ctree Plus sample program

# Time-stamp: <2003-09-15 15:30:29 ccurley Makefile>

# This was written for GNU make and GCC on Linux, but should run with
# almost any make program. There is one GNU make-ism, in the command
# for the target clean.

# Debug option. Define this if you want debugging information in the
# program.
DEBUG=-g

# Compile options. Produce object only, no linking, and, if defined,
# include debug information.  -ansi and -pedantic are gcc specific to
# enforce ANSI compatibility.
COPT=-c $(DEBUG) -ansi -pedantic -Wall

# Link options. Include debug data if it is defined.
LOPT=$(DEBUG)

# The compiler
CC=gcc

# I swiped these two and the paths definitions from from a file that
# FairCom builds as part of the installation process,
# ctree/mtree/ctree.mak. Your system will no doubt have different
# values, so you'll have to do the same. The definition in ctree.mak
# whence I swiped it is indicated after the define.
DEFS=-D_LARGEFILE64_SOURCE	# from CFLAG 
LIBS=lib.cli/libctclient.so -lm -lcurses -ldl -lpthread	# from SYSLIB1 and SYSLIB2

# PATH Definition Section
fcBAS =/home/ccurley/programs/ctree
fcOBJ =/home/ccurley/programs/ctree/obj.mtc
fcBIN =/home/ccurley/programs/ctree/bin.mtc
fcLIB =/home/ccurley/programs/ctree/lib.mtc
fcSRC =/home/ccurley/programs/ctree/ctree/source
fcINC =/home/ccurley/programs/ctree/ctree/include
fcTOM =/home/ccurley/programs/ctree/ctree/custom
fcSAM =/home/ccurley/programs/ctree/ctree/samples
fcIII =-I$(fcTOM) -I$(fcINC) -I$(fcSRC)
fcCOM =$(fcSRC)/ntree/sockets
fcSFX =_m

OBJECTS=demo.o functions.o database.o

demo: $(OBJECTS)
	$(CC) $(LOPT) $(OBJECTS) -o demo $(LIBS)

demo.o: demo.c database.h functions.h
	$(CC) $(COPT) $(DEFS) $(fcIII) demo.c

functions.o: functions.c functions.h
	$(CC) $(COPT) $(DEFS) $(fcIII) functions.c

database.o: database.c database.h
	$(CC) $(COPT) $(DEFS) $(fcIII) database.c

# A GNU make-ism: The - in front of the rm indicates that make should
# proceed in spite of any errors.
clean:
	-rm *.o demo

# Create tags so that we can browse by name in Emacs
tags:
	etags --members *.[cChH]


tarball:
	cd .. ; tar -cvzf ctree.transaction.processing.tar.gz ctree/*.c ctree/*.h ctree/Makefile ctree/*.c.txt ctree/transaction.processing.txt

# Make a package for Dr. Dobb's
zip:
	cd .. ; zip ctree.transaction.processing.zip ctree/*.c ctree/*.h ctree/*.c.txt ctree/transaction.processing.txt ctree/Makefile
