#==============================================================================
# Makefile
#
# OS/2 Makefile to build the JDBC interface
#
# (c) 1997 by Dirk Ohme - all rights reserved
#==============================================================================
# includes
#==============================================================================
include ..\..\..\Config.mk
include ..\..\..\Version.mk
#==============================================================================
# Site specific configuration (OS/2) -> normally set by autoconf (Config.mk)
#==============================================================================
## [BEGIN]
#
# option switches
# (do not remove the lines starting with "##" !!!)
#
# debug mode: select this to enable debugging of the software
##-DEBUG_MODE=Y
#
# list mode: select this (and DEBUG_MODE) to create a list file of each *.c
##-LIST_MODE=Y
#
## [END]
#==============================================================================

#---| definitions |------------------------------------------------------------
NAME     = J2ODBC
OBJECTS  = catalog.obj connect.obj execute.obj info.obj options.obj\
 prepare.obj results.obj transact.obj
SOURCES  = catalog.c   connect.c   execute.c   info.c   options.c\
 prepare.c results.c   transact.c
J_DIR    = ..\..\class\iODBC\sql\dll
J_PATH   = iODBC.sql.dll
J_OBJ    = $(NAME).class $(NAME)Exception.class $(NAME)Warning.class

#---| compiler |---------------------------------------------------------------
CC       = icc
!ifndef BCPP
!  ifdef VACPP
CFLAGS   = /c /D$(OS) /G5 /Gd- /Ge- /Gf /Gi /Gm /Gs- /I.\
/I..\..\..\include /I$(JDK_PATH)\include /I$(JDK_PATH)\include\$(OS)\
/O /Ol /Q /Se /Ss+ /W1
!  else
CFLAGS   = /c /D$(OS) /G4 /Gd- /Ge- /Gf /Gi /Gm /Gs- /I.\
/I..\..\..\include /I$(JDK_PATH)\include /I$(JDK_PATH)\include\$(OS)\
/Q /Se /Ss+
!  endif
!else
CFLAGS   = /c /D$(OS) /DBCPP /I. /I..\..\..\include /$(JDK_PATH)\include\
/I$(JDK_PATH)\include\$(OS)
!endif

CEXTRA   = /DVERSION="\"$(VERSION)$(EXTVER)\""

#---| linker |-----------------------------------------------------------------
!ifdef VACPP
LN       = ilink
LFLAGS   = /nofree /dll /e /noi /nol /packc /packd /pm:PM /se:1024 /st:32768
LN_END   =
!else
LN       = link386
LFLAGS   = /noi /nol /pm:PM /se:1024 /st:32768
LN_END   = ;
!endif

#---| libraries |--------------------------------------------------------------
LIBS     = ..\..\..\lib\odbc.lib $(JDK_PATH)\lib\javai.lib

#---| JDK |--------------------------------------------------------------------
JAVAC    = javac
JAVAH    = javah
J_OPTS   = -O
!ifdef DEBUG_MODE
J_RUN    = java -v
!else
J_RUN    = java
!endif

#---| debugging |--------------------------------------------------------------
!ifdef DEBUG_MODE
!  ifdef LIST_MODE
DEBUG    = /DDEBUG /Le /Ls /Ti+
LDEBUG   = /deb
!  else
DEBUG    = /DDEBUG /Ti+
LDEBUG   = /deb
!  endif
!else
DEBUG    =
LDEBUG   =
!endif

#---| dependencies |-----------------------------------------------------------
.SUFFIXES: .class .java
.c.obj:
         $(CC) $(DEBUG) $(CFLAGS) $(CEXTRA) $*.c
.java.class:
         $(JAVAC) $(J_OPTS) $*.java
         @copy /b $*.class $(J_DIR)

#---| global dependencies |----------------------------------------------------
all:     $(J_OBJ) iODBC_sql_dll_$(NAME).h $(NAME).dll install
clean:
         @if exist *.def       del *.def
         @if exist *.lst       del *.lst
         @if exist *.obj       del *.obj
delete:  clean
         @if exist *.class     del *.class
         @if exist $(NAME).dll del $(NAME).dll
         @if exist *_$(NAME).c del *_$(NAME).c
         @if exist *_$(NAME).h del *_$(NAME).h
delete_all: delete
install:
         @if exist ..\..\..\lib\$(NAME).dll del ..\..\..\lib\$(NAME).dll
         @copy /b $(NAME).dll ..\..\..\lib\$(NAME).dll
test:    all test.class
         set CLASSPATH=$(CLASSPATH);..\..\class
         $(J_RUN) test

#---| local dependencies |-----------------------------------------------------
iODBC_sql_dll_$(NAME).h: $(NAME).class
         set CLASSPATH=$(CLASSPATH);..\..\class
         $(JAVAH) $(J_PATH).$(NAME)

iODBC_sql_dll_$(NAME).c: $(NAME).class iODBC_sql_dll_$(NAME).h
         set CLASSPATH=$(CLASSPATH);..\..\class
         $(JAVAH) -stubs $(J_PATH).$(NAME)

$(NAME).dll: $(OBJECTS) iODBC_sql_dll_$(NAME).obj $(NAME).def
         $(LN) $(LFLAGS) $(LDEBUG) $(OBJECTS) iODBC_sql_dll_$(NAME).obj,\
 $(NAME).dll, nul, $(LIBS), $(NAME).def $(LN_END)

$(NAME).def: $(SOURCES) iODBC_sql_dll_$(NAME).c
         makedefs $(NAME).def $(SOURCES) iODBC_sql_dll_$(NAME).c

test.class: test.java
         set CLASSPATH=$(CLASSPATH);..\..\class
         $(JAVAC) $(J_OPTS) $*.java

#==============================================================================

