#==============================================================================
# Makefile
#
# OS/2 Makefile to build the iODBC driver manager
#
# (c) 1996 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     = iodbc
DLLNAME  = $(NAME).dll
OBJECTS  = catalog.obj connect.obj dlf.obj dlproc.obj execute.obj fetch.obj\
hdbc.obj henv.obj herr.obj hstmt.obj info.obj itrace.obj main.obj misc.obj\
prepare.obj result.obj

#---| environment |------------------------------------------------------------
ENV      = DLDAPI_$(OS)

!if "$(OS)" == "WinNT"
ENV      = DLDAPI_WINDOWS
!endif

#---| compiler |---------------------------------------------------------------
#CC       = icc
!ifdef VACPP
CFLAGS   = /c /D$(OS) /DVACPP /D$(ENV) /DVERSION="\"$(VERSION)$(EXTVER)\""\
/G4 /Gd- /Ge- /Gf /Gi /Gm /Gs- /I. /Ms /O /Ol /Q /Se /Ss+ /W1
!else
!  ifdef IBMC
CFLAGS   = /c /D$(OS) /D$(ENV) /DVERSION="\"$(VERSION)$(EXTVER)\""\
/G4 /Gd- /Ge- /Gf /Gi /Gm /Gs- /I. /Ms /Q /Se /Ss+
!  else
!    ifdef BCPP
CFLAGS   = /c /D$(OS) /DBCPP /D$(ENV) /DVERSION="\"$(VERSION)$(EXTVER)\"" /I.
!    else
CFLAGS   = /c /D$(OS) /DGCC /D$(ENV) /DVERSION="\"$(VERSION)$(EXTVER)\"" /I.
!    endif
!  endif
!endif

#---| linker |-----------------------------------------------------------------
!ifdef VACPP
LN       = ilink
LFLAGS   = /nofree /e /noi /nol /packc /packd /pm:VIO /se:1024 /st:32768
LN_END   =
!else
LN       = link386
LFLAGS   = /noi /nol /pm:VIO /se:1024 /st:32768
LN_END   = ;
!endif
!ifdef STATIC
LIBS     =
!else
LIBS     =
!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

#---| library tool |-----------------------------------------------------------
IMPLIB   = implib
IFLAGS   = /nol

#---| global dependencies |----------------------------------------------------
all:     $(NAME).lib $(DLLNAME) install
clean:
         @if exist *.lst       del *.lst
         @if exist *.obj       del *.obj
         @if exist *.res       del *.res
delete:  clean
         @if exist *.dll       del *.dll
         @if exist *.lib       del *.lib
delete_all: delete
install:
         if exist ..\..\lib\$(DLLNAME)      del ..\..\lib\$(DLLNAME)
         if exist ..\..\lib\$(NAME).lib     del ..\..\lib\$(NAME).lib
         if exist ..\..\lib\odbc.ini        del ..\..\lib\odbc.ini
         if exist ..\..\include\isql.h      del ..\..\include\isql.h
         if exist ..\..\include\isqlext.h   del ..\..\include\isqlext.h
         copy /b $(DLLNAME)      ..\..\lib
         copy /b $(NAME).lib     ..\..\lib
         copy /b odbc.ini        ..\..\lib
         copy /b isql.h          ..\..\include
         copy /b isqlext.h       ..\..\include

#--------| inference rules |---------------------------------------------------
.SUFFIXES: .def .lib
.c.obj:
         $(CC) $(DEBUG) $(CFLAGS) $*.c
.def.lib:
         $(IMPLIB) $(IFLAGS) $*.lib $*.def

#---| local dependencies |-----------------------------------------------------
$(NAME).lib:  $(OBJECTS) $(NAME).def

$(DLLNAME):   $(OBJECTS)
         $(LN) $(LDEBUG) $(LFLAGS) $**, $@, nul, $(LIBS),\
$(NAME).def $(LN_END)

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