# @(#) SQLDBC example, 2003-07-14 SAP DB
#
#
#
#
#
#    ========== licence begin  GPL
#    Copyright (c) 2002-2004 SAP AG
#
#    This program is free software; you can redistribute it and/or
#    modify it under the terms of the GNU General Public License
#    as published by the Free Software Foundation; either version 2
#    of the License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#    ========== licence end
#

#

#

#
&if $OS = WIN32

&if (defined BIT64) 
BIT64 = -DBIT64
&endif

CC = cl
LINK=link

LIBS = $(SAPDBROOT)/sdk/sqldbc/lib/libSQLDBC.lib

CPPFLAGS = -DWIN32 -I$(SAPDBROOT)/sdk/sqldbc/incl $(BIT64)

# Dependencies

all: HelloWorld.exe

HelloWorld.exe: HelloWorld.obj
	$(LINK) $(LIBS) HelloWorld.obj 		

HelloWorld.obj: HelloWorld.cpp
	$(CC) /c $(CPPFLAGS) HelloWorld.cpp		

clean: 
	del /f HelloWorld.obj HelloWorld.exe

&else

&if (defined BIT64) 
BIT64 = -DBIT64
&if ($OSSPEC != OSF1) && ($OSSPEC != LINUX)
&if ($OSSPEC = HPUX) && ($MACH = HP_IA64)
&else
LIB64 = /lib64
&endif
&endif
&endif

&if $MACH in [SUN]
CC = CC
LINK = CC
CPPARGS =  -xarch=v9
LINKARGS =  -xarch=v9
&endif

&if $OSSPEC = AIX
CC = xlC
CPPARGS =  -q64
LINK = xlC_r
LINKARGS = -q64 -brtl
&endif

&if $OSSPEC = HPUX
&if $MACH = HP_IA64
CC = aCC
CPPARGS = +DD64
LINK = aCC
LINKARGS =  +DD64
&else
CC = aCC
CPPARGS = +DA2.0W +DS2.0
LINK = aCC
LINKARGS =  +DA2.0W +DS2.0
&endif
&endif

&if $OSSPEC = OSF1
CC = cxx
CPPARGS = 
LINK = cxx
LINKARGS = 
&endif

&if $OSSPEC = LINUX
CC = c++
CPPARGS = 
LINK = c++
LINKARGS = 
&endif

CPPFLAGS = -I$(SAPDBROOT)/sdk/sqldbc/incl/ $(CPPARGS) $(BIT64)
LIBS     = -L$(SAPDBROOT)/lib$(LIB64) -lSQLDBC 

all: HelloWorld

HelloWorld: HelloWorld.o
	$(LINK) -o $@ $(LINKARGS) HelloWorld.o $(LIBS) 

HelloWorld.o: HelloWorld.cpp
	$(CC) -c $(CPPFLAGS) HelloWorld.cpp		

clean:
	-rm -f HelloWorld HelloWorld.o

&endif
