# Generated automatically from makefile.in by config.
#### Start of system configuration section. ####

srcdir = .
VPATH = .

CC = gcc

INSTALL = copy
INSTALL_PROGRAM = $(INSTALL)
INSTALL_DATA = $(INSTALL)

MAKEINFO = makeinfo
TEXI2DVI = texi2dvi
RANLIB = ranlib

DEFS =

# Where the system [n]dbm routines are...
LIBS =  -ldbm -lc

# SunOS users might wish to add '-fpcc-struct-return' to CFLAGS. see INSTALL.
CFLAGS = -g
LDFLAGS =

# Common prefix for installation directories
#prefix = ..\
#exec_prefix = $(prefix)
#binprefix = $(exec_prefix)
#manprefix = $(prefix)

# Directory in which to put libgdbm.a.
libdir = ..\lib
# The include directory for gdbm.h and dbm.h.
includedir = ..\inc
# Info and man directories.
infodir = ..\info
man3dir = ..\man
manext = 3

#### End of system configuration section. ####

.c.o:
	$(CC) -c $(CPPFLAGS) $(DEFS) -I. -I$(srcdir) $(CFLAGS) $<

SHELL = /bin/sh

PROGS = libgdbm.a testgdbm testdbm testndbm tndbm tdbm cnv2gdbm

DBM_CF = dbminit.c delete.c fetch.c store.c seq.c close.c

NDBM_CF = dbmopen.c dbmdelet.c dbmfetch.c dbmstore.c dbmseq.c \
	dbmclose.c dbmdirfn.c dbmpgfno.c dbmrdnly.c

GDBM_CF = gdbmopen.c gdbmdelt.c gdbmftch.c  gdbmstre.c gdbmclos.c \
	gdbmrorg.c gdbmseq.c gdbmsync.c gdbmerrn.c gdbmexst.c gdbmsopt.c \
	bucket.c falloc.c findkey.c global.c hash.c update.c \
	version.c

TEST_CF = testdbm.c testndbm.c testgdbm.c


DBM_OF = dbminit.o delete.o fetch.o store.o seq.o close.o

NDBM_OF = dbmopen.o dbmdelet.o dbmfetch.o dbmstore.o dbmseq.o \
	dbmclose.o dbmdirfn.o dbmpgfno.o dbmrdnly.o

GDBM_OF = gdbmopen.o gdbmdelt.o gdbmftch.o  gdbmstre.o gdbmclos.o \
	gdbmrorg.o gdbmseq.o gdbmsync.o gdbmerrn.o gdbmexst.o gdbmsopt.o \
	bucket.o falloc.o findkey.o global.o hash.o update.o \
	version.o

TEX_F = gdbm.aux gdbm.cp gdbm.dvi gdbm.fn gdbm.ky gdbm.log gdbm.pg \
	gdbm.toc gdbm.tp gdbm.vr

TEXI_F = gdbm.inf
     
SRCS = $(DBM_CF) $(NDBM_CF) $(GDBM_CF) $(TEST_CF)

OBJS = $(DBM_OF) $(NDBM_OF) $(GDBM_OF) 

HDRS = gdbmdefs.h extern.h gdbmerrn.h systems.h dbm.h ndbm.h gdbmcnst.h \
	proto.h

MSCFILES = COPYING ChangeLog makefile.in readme gdbm.3 gdbm.txi \
	gdbm.inf news INSTALL gdbm.pro gdbm.pr2 cnv2gdbm.c \
	config config.in alloca.c getopt.c getopt.h samp1.cc \
	autoconf.hin

DISTFILES = $(SRCS) $(HDRS) $(MSCFILES)

all: libgdbm.a

progs: $(PROGS)

install: libgdbm.a gdbm.h gdbm.inf
	$(INSTALL_DATA) libgdbm.a $(libdir)\libgdbm.a
	$(INSTALL_DATA) gdbm.h $(includedir)\gdbm.h
	$(INSTALL_DATA) $(srcdir)\gdbm.3 $(man3dir)\gdbm.3
	$(INSTALL_DATA) $(srcdir)\gdbm.inf $(infodir)\gdbm.inf

install-compat:
	$(INSTALL_DATA) $(srcdir)/dbm.h $(includedir)/dbm.h
	$(INSTALL_DATA) $(srcdir/ndbm.h $(includedir)/ndbm.h

libgdbm.a: $(OBJS) gdbm.h
	rm -f libgdbm.a
	ar q libgdbm.a $(OBJS)
	$(RANLIB) libgdbm.a

gdbm.h:	gdbm.pro gdbmerrn.h gdbm.pr2
	rm -f gdbm.h
	cp gdbm.pro gdbm.h
	grep _ gdbmerrn.h >> gdbm.h
	cat gdbm.pr2 >> gdbm.h

testgdbm: testgdbm.o libgdbm.a 
	$(CC) $(LDFLAGS) -o testgdbm testgdbm.o libgdbm.a 

testdbm: testdbm.o libgdbm.a
	$(CC) $(LDFLAGS) -o testdbm testdbm.o libgdbm.a

tdbm: testdbm.o libgdbm.a
	$(CC) $(LDFLAGS) -o tdbm testdbm.o $(LIBS)

testndbm.o: testndbm.c
	$(CC) -c -I. -I$(srcdir) $(CFLAGS) $(DEFS) -DGNU $(srcdir)/testndbm.c

testndbm: testndbm.o libgdbm.a
	$(CC) $(LDFLAGS) -o testndbm testndbm.o libgdbm.a

tndbm.o: testndbm.c
	cp $(srcdir)/testndbm.c ./tndbm.c
	$(CC) -c -I. -I$(srcdir) $(CFLAGS) $(DEFS) ./tndbm.c
	rm -f ./tndbm.c

tndbm: tndbm.o libgdbm.a
	$(CC) $(LDFLAGS) -o tndbm tndbm.o $(LIBS)

cnv2gdbm: cnv2gdbm.o libgdbm.a 
	$(CC) $(LDFLAGS) -o cnv2gdbm cnv2gdbm.o $(LIBS) libgdbm.a 

lintgdbm: 
	lint $(DEFS) $(LFLAGS) $(DBM_CF) $(NDBM_CF) $(GDBM_CF) testgdbm.c

TAGS: $(SRCS)
	etags $(SRCS)

info: gdbm.inf

gdbm.inf:
	$(MAKEINFO) $(srcdir)/gdbm.txi

dvi: gdbm.dvi

gdbm.dvi:
	$(TEXI2DVI) $(srcdir)/gdbm.txi

clean:
	rm -f $(PROGS) $(TEX_F) *.o core junk*

mostlyclean: clean

distclean: clean
	rm -f makefile autoconf.h config.sta gdbm.h $(TEXI_F) *~

realclean: distclean
	rm -f TAGS
	-rm -f \
	  `sed -n 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/gdbm-\1/p' \
		version.c`.tar.gz

dist:
	echo \
	  `sed -n 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/gdbm-\1/p' \
		version.c` > .fname
	rm -rf `cat .fname`
	mkdir `cat .fname`
	ln $(DISTFILES) `cat .fname`
	tar chf `cat .fname`.tar `cat .fname`
	gzip `cat .fname`.tar
	rm -rf `cat .fname` .fname

# dbm files
dbminit.o:	autoconf.h gdbmdefs.h proto.h extern.h gdbmerrn.h
delete.o:	autoconf.h gdbmdefs.h proto.h extern.h
fetch.o:	autoconf.h gdbmdefs.h proto.h extern.h
store.o:	autoconf.h gdbmdefs.h proto.h extern.h
seq.o:		autoconf.h gdbmdefs.h proto.h extern.h

# ndbm files
dbmopen.o:	autoconf.h gdbmdefs.h extern.h gdbmerrn.h
dbmdelet.o:	autoconf.h gdbmdefs.h extern.h
dbmfetch.o:	autoconf.h gdbmdefs.h extern.h
dbmstore.o:	autoconf.h gdbmdefs.h extern.h
dbmseq.o:	autoconf.h gdbmdefs.h extern.h
dbmclose.o:	autoconf.h gdbmdefs.h systems.h
dbmpgfno.o:	autoconf.h gdbmdefs.h extern.h
dbmdirfn.o:	autoconf.h gdbmdefs.h extern.h


# gdbm files
gdbmclos.o:	autoconf.h gdbmdefs.h 
gdbmdelt.o:	autoconf.h gdbmdefs.h gdbmerrn.h 
gdbmftch.o:	autoconf.h gdbmdefs.h gdbmerrn.h 
gdbmopen.o:	autoconf.h gdbmdefs.h gdbmerrn.h 
gdbmrorg.o:	autoconf.h gdbmdefs.h gdbmerrn.h extern.h
gdbmseq.o:	autoconf.h gdbmdefs.h 
gdbmstre.o:	autoconf.h gdbmdefs.h gdbmerrn.h 

# gdbm support files
bucket.o:	autoconf.h gdbmdefs.h
falloc.o:	autoconf.h gdbmdefs.h
findkey.o:	autoconf.h gdbmdefs.h
global.o:	autoconf.h gdbmdefs.h gdbmerrn.h 
hash.o:		autoconf.h gdbmdefs.h
update.o:	autoconf.h gdbmdefs.h
version.o:
extern.h:
gdbmdefs.h:	gdbmcnst.h systems.h
	touch gdbmdefs.h

# other programs
testgdbm.o:	autoconf.h gdbmdefs.h extern.h gdbmerrn.h systems.h
testdbm.o:	autoconf.h
testndbm.o:	autoconf.h ndbm.h
tdbm.o:		autoconf.h
cnv2gdbm.o:	autoconf.h gdbm.h
