#
# makefile for public domain ndbm-clone: covalent_sdbm
# DUFF: use duff's device (loop unroll) in parts of the code
#
CC=gcc
CFLAGS = -g -O2 -O -DSDBM -DDUFF
#LDFLAGS = -p

OBJS = covalent_sdbm.o pair.o hash.o
SRCS = covalent_sdbm.c pair.c hash.c dbu.c dba.c dbd.c util.c
HDRS = tune.h covalent_sdbm.h pair.h
MISC = README CHANGES COMPARE covalent_sdbm.3 dbe.c dbe.1 dbm.c dbm.h biblio \
       readme.ms readme.ps

all: covalent_sdbm

covalent_sdbm: $(OBJS)
	ar cr libcovalent_sdbm.a $(OBJS)
	ranlib libcovalent_sdbm.a
###	cp libcovalent_sdbm.a /usr/lib/libcovalent_sdbm.a

dba.o: covalent_sdbm.h
dbu.o: covalent_sdbm.h
util.o:covalent_sdbm.h

$(OBJS): covalent_sdbm.h tune.h pair.h

#
# dbu using berkelezoid ndbm routines [if you have them] for testing
#
#x-dbu: dbu.o util.o
#	cc $(CFLAGS) -o x-dbu dbu.o util.o
lint:
	lint -abchx $(SRCS)

clean:
	rm -f *.o mon.out core

purge: 	clean
	rm -f dbu libcovalent_sdbm.a dbd dba dbe x-dbu *.dir *.pag

shar:
	shar $(MISC) makefile $(SRCS) $(HDRS) >SDBM.SHAR

readme:
	nroff -ms readme.ms | col -b >README
