# @(#)Makefile.win32	10.6 (Sleepycat) 10/24/98

# This path should be changed to point to the top level directory of your
# java JDK tree (just above bin, include, ...).
#
JAVAINSDIR=	d:/java
DBINSDIR=	..
CLASSPATH=	$(DBINSDIR)/java/classes;$(JAVAINSDIR)/lib/classes.zip
LINK=		link
PERL=		perl
LIBS=		$(DBINSDIR)/build_win32/Debug/libdb.lib

DEBUG_CLFLAGS=	/GX /Z7 /MTd /D_DEBUG $(INCDIRS)
RELEASE_CLFLAGS= /GX /MT /DNDEBUG $(INCDIRS)
CLFLAGS=	$(DEBUG_CLFLAGS)

INCDIRS=	-I$(JAVAINSDIR)/include -I$(JAVAINSDIR)/include/win32 \
		-I$(DBINSDIR)/build_win32 -I$(DBINSDIR)/include

JPACKAGE=	com.sleepycat.db.

JCLASSES=	$(JPACKAGE)Db $(JPACKAGE)DbEnv $(JPACKAGE)DbInfo \
		$(JPACKAGE)DbLock $(JPACKAGE)DbLockTab $(JPACKAGE)DbLog \
		$(JPACKAGE)DbLsn $(JPACKAGE)DbMpool $(JPACKAGE)DbTxn \
		$(JPACKAGE)DbTxnMgr $(JPACKAGE)Dbc $(JPACKAGE)Dbt

CPPFILES=	java_Db.cpp java_DbEnv.cpp java_DbInfo.cpp \
		java_DbLock.cpp java_DbLockTab.cpp java_DbLog.cpp \
		java_DbLsn.cpp java_DbMpool.cpp java_DbTxn.cpp \
		java_DbTxnMgr.cpp java_Dbc.cpp java_Dbt.cpp

HFILES=		java_util.h com_sleepycat_db_Db.h com_sleepycat_db_DbEnv.h \
		com_sleepycat_db_DbInfo.h com_sleepycat_db_DbLock.h \
		com_sleepycat_db_DbLockTab.h com_sleepycat_db_DbLog.h \
		com_sleepycat_db_DbLsn.h com_sleepycat_db_DbMpool.h \
		com_sleepycat_db_DbTxn.h com_sleepycat_db_DbTxnMgr.h \
		com_sleepycat_db_Dbc.h com_sleepycat_db_Dbt.h

OBJECTS=	java_util.obj java_Db.obj java_DbEnv.obj java_DbInfo.obj \
		java_DbLock.obj java_DbLockTab.obj java_DbLog.obj \
		java_DbLsn.obj java_DbMpool.obj java_DbTxn.obj \
		java_DbTxnMgr.obj java_Dbc.obj java_Dbt.obj

all:	libdb_java.dll

rebuild: run_javah check_api libdb_java.dll

libdb_java.dll: $(OBJECTS)
	$(LINK) /debug /dll /out:libdb_java.dll $(OBJECTS) $(LIBS)

.cpp.obj:
	cl /c $(CLFLAGS) $*.cpp

clean:
	del /q *.obj *.lib *.exp *.dll *.ilk *.pdb

# This needs to be run whenever the interface of the java classes
# changes.  It recreates the com_sleepycat...*.h files, so they
# must be made writeable.
#
run_javah:
	attrib -r com_sleepycat*.h
	javah -classpath "$(CLASSPATH)" -jni $(JCLASSES)
	attrib +r com_sleepycat*.h

# This is really an optional step and is not run in the standard
# distribution because not everyone has perl.  If you have perl,
# and you are making changes to the .h and .cpp files in this
# directory (as the maintainers do), you may want to run this
# after the run_javah step.
#
check_api:
	$(PERL) checkapi.prl com_sleepycat_*.h java_*.cpp

# These dependencies are overkill, but they work.
#
java_Db.obj:            $(HFILES)
java_DbEnv.obj:         $(HFILES)
java_DbInfo.obj:        $(HFILES)
java_DbLock.obj:        $(HFILES)
java_DbLockTab.obj:     $(HFILES)
java_DbLog.obj:         $(HFILES)
java_DbLsn.obj:         $(HFILES)
java_DbMpool.obj:       $(HFILES)
java_DbTxn.obj:         $(HFILES)
java_DbTxnMgr.obj:      $(HFILES)
java_Dbc.obj:           $(HFILES)
java_Dbt.obj:           $(HFILES)
java_util.obj:          $(HFILES)
