
# Example makefile for the GemConnect for Oracle shared library.
#
# Platform:  Linux
# Product:  GemStone/64 version 3.7.X
                
#
#    NOTE: the link step of building liboraapi will display unresolved
#          GCI references.  These are resolved at run-time and should
#          not be considered errors.
#
#
# If you have the GEMSTONE and ORACLE_HOME environment variables set and
# exported, then you can invoke this makefile like this:
#
#   cd $GC/make
#   make -f <name of this file>
#
# The following makefile assumes that the following environmental variables
# have been configured:
#
# $GEMSTONE    -- to the GemStone installation
# $GSVERSION   -- to the GemStone version (with dots: for example 3.7.0)
# $ORACLE_HOME -- to the Oracle OCI install that includes include and lib dirs
# 
# If you do not have these environment variables exported for use in 
# this makefile, uncomment the following and set them to the correct 
# paths before running make.
#
# GEMSTONE=
# GSVERSION=
# ORACLE_INC=
# ORACLE_LIB=

ORACLE_INC=$(ORACLE_HOME)/include
ORACLE_LIB=$(ORACLE_HOME)/lib

LIBORAAPI = liboraapi25
                
INCFLAGS = -I. -I$(GEMSTONE)/include -I$(ORACLE_INC) 


ORALIB = $(ORACLE_LIB) 
ORALIBS = -L$(ORALIB) -lclntsh

# To activate the example code used in gsorapublic.c,
# add "-DEXAMPLE to CFLAGS definition below



EXT = so



CC=g++
LD=g++
CFLAGS = -fmessage-length=0 -fcheck-new -O3 -m64 -pipe -D_GNU_SOURCE -DFLG_OOP64 -DFLG_GS643 -pthread -fPIC -fno-strict-aliasing
OSLIBS = -lclntsh -lpthread -lc -lcrypt -ldl -lm -lrt -Wl,--no-undefined -Wl,-zmuldefs
LDFLAGS = -shared -Wl,-Bdynamic -m64 -Wl,--warn-unresolved-symbols




# Rebuild the oracle user-action library.  It must be installed in
# GemStone's ualib directory before it will be used.
#

$(LIBORAAPI).$(EXT): $(LIBORAAPI).a gsorapublic.o
	$(LD) -o $(LIBORAAPI).$(EXT) \
	      $(LDFLAGS) \
	      gsorapublic.o $(LIBORAAPI).a \
	      $(GEMSTONE)/lib/gciualib.o $(ORALIBS) $(OSLIBS)

gsorapublic.o: gsorapublic.c gsoraapi.ht gsrdbapi.ht gsrdbapi.hf
	$(CC) -c -o gsorapublic.o $(CFLAGS) $(INCFLAGS) gsorapublic.c

clean:
	$(RM) -f $(LIBORAAPI).$(EXT) gsorapublic.o
