# Makefile of GDBM for VC++ and BCC
srcdir = ../..
winsrcdir = ..

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

!ifdef __MAKE__
CC = bcc32 -q
AR = tlib
ARFLAGS = /a
MAKE = make
CFLAGS = -w-
LOCAL_CFLAGS = 
CPPFLAGS = 
!else
CC = cl -nologo
AR = lib
ARFLAGS = -out:
MAKE = nmake
CFLAGS = -MD
LOCAL_CFLAGS =
CPPFLAGS = 
!endif

!if "$(DLL)" == "0"
LOCAL_DEFS =  -DGDBM_STATIC
LIBS = gdbm-static.lib
!else
LOCAL_DEFS =
LIBS = gdbm.lib
!endif

RM = del
CP = copy
MV = mv

!ifndef prefix
prefix = /usr/local
!endif
exec_prefix = $(prefix)

bindir = $(exec_prefix)/bin
libdir = $(exec_prefix)/lib
mandir = $(prefix)/man
includedir = $(prefix)/include

infodir = $(prefix)/info

man3dir = $(mandir)/man3


DEFS =

# For libraries which include headers from other libraries.
INCLUDES = -I$(winsrcdir) -I$(srcdir) -I$(includedir)

CCFLAGS = $(DEFS) $(LOCAL_DEFS) $(CPPFLAGS) $(INCLUDES:/=\) $(LOCAL_CFLAGS) $(CFLAGS)

.c.obj:
	$(CC) -c $(CCFLAGS) $<

{$(winsrcdir)}.c.obj:
	$(CC) -c $(CCFLAGS) $<

{$(srcdir)}.c.obj:
	$(CC) -c $(CCFLAGS) $<

# The name of the main library target.

EXAMPLES = dbmtest.exe ndbmtest.exe gdbmtest.exe

##########

all: $(EXAMPLES)

dbmtest.exe: dbmtest.obj
	$(CC) $(CCFLAGS) dbmtest.obj $(LIBS)

ndbmtest.exe: ndbmtest.obj
	$(CC) $(CCFLAGS) ndbmtest.obj $(LIBS)

gdbmtest.exe: gdbmtest.obj
	$(CC) $(CCFLAGS) gdbmtest.obj $(LIBS)

force: nul

clean:	force
	if exist *.obj $(RM) *.obj
	if exist *.exp $(RM) *.exp
	if exist *.tds $(RM) *.tds
	if exist *~ $(RM) *~
	if exist *.exe $(RM) *.exe
	if exist testdb* $(RM) testdb*
