# Makefile for gdbm.

# MS-DOS port (c) 1990 by Thorsten Ohl, ohl@gnu.ai.mit.edu
#
# To this port, the same copying conditions apply as to the
# original release.
#
# IMPORTANT:
# This file is not identical to the original GNU release!
# You should have received this code as patch to the official
# GNU release.
#
# MORE IMPORTANT:
# This port comes with ABSOLUTELY NO WARRANTY.
#
# $Header: e:/gnu/gdbm/RCS/makefile.'v 1.4.0.2 90/08/16 10:40:52 tho Exp $

BINDIR = /usr/local/bin
LIBDIR = /usr/local/lib
INCDIR = /usr/include

INSTALL = cp -v
DISK	= 
ZIPFILE = 

MODEL	= -3
CFLAGS	= -g1 -w4 -DSYSV -fiunix.h
LDFLAGS	= -N 20k -b
AR	= 
ARFLAGS	=

GDBMLIB	= gdbm3r.lib


DBM_CF = dbminit.c delete.c fetch.c store.c seq.c
NDBM_CF = dbmopen.c dbmdelet.c dbmfetch.c dbmstore.c dbmseq.c \
	dbmclose.c dbmdirfn.c dbmpagfn.c
GDBM_CF = gdbmopen.c gdbmdele.c gdbmfetc.c  gdbmstor.c gdbmclos.c \
	gdbmreor.c gdbmseq.c \
	bucket.c falloc.c findkey.c global.c hash.c update.c version.c

HFILES = gdbmdefs.h extern.h gdbmerrno.h systems.h dbm.h ndbm.h

MSCFILES = copying changelo makefile readme gdbm.pro conv2gdb.c

TESTFILES = testdbm.c testndbm.c testgdbm.c


RCSFILES= $(patsubst %, RCS/%'v, $(DBM_CF) $(NBM_CF) $(GBM_CF)) \
	  RCS/makefile.'v
MISC	= RCS/readme'v changelo RCS/changelo.'v makepat mkpatch

DBM_OF = dbminit.o delete.o fetch.o store.o seq.o
NDBM_OF = dbmopen.o dbmdelet.o dbmfetch.o dbmstore.o dbmseq.o \
	dbmclose.o dbmdirfn.o dbmpagfn.o
GDBM_OF = gdbmopen.o gdbmdele.o gdbmfetc.o  gdbmstor.o gdbmclos.o \
	gdbmreor.o gdbmseq.o \
	bucket.o falloc.o findkey.o global.o hash.o update.o


allgdbm: $(GDBMLIB) testgdbm testdbm testndbm

install: $(GDBMLIB) gdbmdefs.h
	cp $(GDBMLIB) $(LIBDIR)
	cp gdbmdefs.h $(INCDIR)
	cp dbm.h $(INCDIR)
	cp ndbm.h $(INCDIR)

$(GDBMLIB): version.c $(GDBM_OF) $(NDBM_OF) $(DBM_OF)
	$(CC) $(CFLAGS) -c version.c
	rm -f *.lib
 	cc -A gdbm3r.lib $(GDBM_OF) $(DBM_OF) $(NDBM_OF)

gdbm.h:	gdbm.pro gdbmerrno.h
	cp gdbm.pro gdbm.h
	grep _ gdbmerrno.h >> gdbm.h


testgdbm: testgdbm.o $(GDBMLIB)
	$(CC) $(LDFLAGS) -o testgdbm testgdbm.o version.o -l gdbm3r.lib

testdbm: testdbm.o $(GDBMLIB)
	$(CC) $(LDFLAGS) -o testdbm testdbm.o version.o -l gdbm3r.lib 

testndbm.o: testndbm.c
	$(CC) -c $(CFLAGS) -DGNU testndbm.c

testndbm: testndbm.o $(GDBMLIB)
	$(CC) $(LDFLAGS) -o testndbm testndbm.o version.o -l gdbm3r.lib 


clean:
	rm -f gdbm.h *.o *.map *.err
	rm -f testgdbm testdbm testndbm

# dbm files
dbminit.o:	gdbmdefs.h extern.h gdbmerrno.h systems.h
delete.o:	gdbmdefs.h extern.h
fetch.o:	gdbmdefs.h extern.h
store.o:	gdbmdefs.h extern.h
seq.o:	gdbmdefs.h extern.h

# ndbm files
dbmopen.o:	gdbmdefs.h extern.h gdbmerrno.h systems.h
dbmdelet.o:	gdbmdefs.h extern.h
dbmfetch.o:	gdbmdefs.h extern.h
dbmstore.o:	gdbmdefs.h extern.h
dbmseq.o:	gdbmdefs.h extern.h
dbmclose.o:	gdbmdefs.h systems.h
dbmpagfn.o:	gdbmdefs.h extern.h
dbmdirfn.o:	gdbmdefs.h extern.h


# gdbm files
gdbmclos.o:	gdbmdefs.h systems.h
gdbmdele.o:	gdbmdefs.h gdbmerrno.h systems.h
gdbmfetc.o:	gdbmdefs.h gdbmerrno.h systems.h
gdbmopen.o:	gdbmdefs.h gdbmerrno.h systems.h 
gdbmreor.o:	gdbmdefs.h gdbmerrno.h systems.h extern.h
gdbmseq.o:	gdbmdefs.h systems.h
gdbmstor.o:	gdbmdefs.h gdbmerrno.h systems.h

# gdbm support files
bucket.o:	gdbmdefs.h systems.h
falloc.o:	gdbmdefs.h systems.h
findkey.o:	gdbmdefs.h systems.h
global.o:	gdbmdefs.h gdbmerrno.h 
hash.o:		gdbmdefs.h
update.o:	gdbmdefs.h systems.h
version.o:
extern.h:	

# other programs
testgdbm.o:	gdbmdefs.h extern.h gdbmerrno.h systems.h
testdbm.o:	dbm.h
testndbm.o:	ndbm.h
conv2gdb.o:	gdbm.h

