# (C) COPYRIGHT International Business Machines Corp. 1995, 1999
# All Rights Reserved.
#
# US Government Users Restricted Rights - Use, duplication or
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
# makefile for DB2 Universal Database Version 6.1
# C++ sample programs -- AIX operating system
# Enter one of the following commands
#
# make <app_name> - Builds the program designated by <app_name>
#
# make all - Builds the all the supplied sample programs
# make udfspserver - Builds the examples that implement
# stored procedures and UDFs (on the server)
# make localclient - Builds the examples that can only be run
# successfully on a server
# make udfspclient - Builds the examples that call stored
# procedures and UDFs ( they can run remotely )
# make otherremoteclient - Builds the examples that will run successfully
# on a client platform ( others than udfspclient )
# make allremoteclient - Builds programs in udfspclient and otherremoteclient
# categories
#
# make clean - Erases intermediate files
# make cleanall - Erases all files produced in the build process,
# except the original source files
# The makefile contains the following sections:
# 1 -- COMPILERS + VARIABLES
# 2 -- MAKE CATEGORIES
# 3 -- COMMANDS TO MAKE INDIVIDUAL SAMPLES
##################################################################################
# 1 -- COMPILERS + VARIABLES
##################################################################################
# This file assumes the DB2 instance path is defined by the variable HOME.
# It also assumes DB2 is installed under the DB2 instance.
# If these statements are not correct, update the variable DB2PATH.
DB2PATH = $(HOME)/sqllib
# Use the xlC compiler
CC= xlC
# Use xlC_r for multi-threaded programs
CM=xlC_r
# For multi-threaded programs on AIX 4.3 or later, use:
# CM=xlC_r7
# The required compiler flags
CFLAGS= -I$(DB2PATH)/include
# The linker for shared libraries
LINKSL=makeC++SharedLib -p 1024
# The required libraries
LIBS= -L$(DB2PATH)/lib -ldb2
LIBSUDF= -L$(DB2PATH)/lib -ldb2 -ldb2apie
# To connect to a remote SAMPLE database cataloged on the client machine
# with another name, update the DB variable.
DB=sample
# Set UID and PWD if neccesary
UID=
PWD=
COPY=cp
ERASE=rm -f
#############################################################################
# 2 -- MAKE CATEGORIES
# 2a - make all(= allremoteclient + localclient +udfspserver)
# 2b - make udfspserver
# 2c - make localclient
# 2d - make udfspclient
# 2e - make otherremoteclient
# 2f - make allremoteclient(= udfspclient + otherremoteclient)
# 2g - make clean
# 2h - make cleanall
#############################################################################
#****************************************************************************
# 2a - make all
#****************************************************************************
all : \
allremoteclient \
localclient \
udfspserver
#****************************************************************************
# 2b - make udfspserver
#****************************************************************************
udfspserver : \
fillsrv \
inpsrv\
outsrv \
udf
#****************************************************************************
# 2c - make localclient
#****************************************************************************
# there are not samples in this category for now
localclient :
#****************************************************************************
# 2d - make udfspclient
#****************************************************************************
udfspclient : \
calludf \
fillcli \
inpcli \
outcli
#****************************************************************************
# 2e - make otherremoteclient
#****************************************************************************
otherremoteclient : \
client cursor \
static \
thdsrver util \
updat
#****************************************************************************
# 2f - make allremoteclient
#****************************************************************************
allremoteclient : \
udfspclient \
otherremoteclient
#****************************************************************************
# 2g - make clean
#****************************************************************************
clean : \
cleangen \
cleanemb
cleangen :
$(ERASE) *.o *.map
cleanemb :
$(ERASE) calludf.C cursor.C
$(ERASE) fillcli.C fillsrv.C
$(ERASE) inpcli.C inpsrv.C
$(ERASE) outcli.C outsrv.C
$(ERASE) static.C
$(ERASE) thdsrver.C
$(ERASE) updat.C
#****************************************************************************
# 2h - make cleanall
#****************************************************************************
cleanall : \
clean
$(ERASE) *.bnd
$(ERASE) calludf client cursor
$(ERASE) fillcli fillsrv
$(ERASE) inpcli inpsrv
$(ERASE) outcli outsrv
$(ERASE) static
$(ERASE) thdsrver
$(ERASE) updat udf
$(ERASE) $(DB2PATH)/function/udf
$(ERASE) $(DB2PATH)/function/fillsrv
$(ERASE) $(DB2PATH)/function/inpsrv
$(ERASE) $(DB2PATH)/function/outsrv
#############################################################################
# 3 -- COMMANDS TO MAKE INDIVIDUAL SAMPLES
# 3a - utilities
# 3b - non embedded SQL, non client/server samples
# 3c - embedded SQL, non client/server samples
# 3d - client/server samples (mixed)
# 3e - multi-threaded samples
#############################################################################
#****************************************************************************
# 3a - utilities
#****************************************************************************
util : util.C
$(CC) -c util.C $(CFLAGS)
util.o : util.C
$(CC) -c util.C $(CFLAGS)
#****************************************************************************
# 3b - non embedded SQL, non client/server samples
#****************************************************************************
client : client.C util.o
$(CC) -o client client.C util.o $(CFLAGS) $(LIBS)
#****************************************************************************
# 3c - embedded SQL non client/server samples
#****************************************************************************
cursor.C : cursor.sqC
embprepp cursor $(DB) $(UID) $(PWD)
cursor : cursor.C util.o
$(CC) -o cursor cursor.C util.o $(CFLAGS) $(LIBS)
static.C : static.sqC
embprepp static $(DB) $(UID) $(PWD)
static : static.C util.o
$(CC) -o static static.C util.o $(CFLAGS) $(LIBS)
updat.C : updat.sqC
embprepp updat $(DB) $(UID) $(PWD)
updat : updat.C util.o
$(CC) -o updat updat.C util.o $(CFLAGS) $(LIBS)
#****************************************************************************
# 3d - client/server samples (mixed)
#****************************************************************************
#--------------------calludf/udf--------------------------------------------#
calludf.C : calludf.sqC
embprepp calludf $(DB) $(UID) $(PWD)
calludf : calludf.C util.o
$(CC) -o calludf calludf.C util.o $(CFLAGS) $(LIBS)
udf : udf.c
$(CC) -c udf.c $(CFLAGS)
$(LINKSL) -o udf udf.o $(LIBSUDF) -E udf.exp
$(ERASE) $(DB2PATH)/function/udf
$(COPY) udf $(DB2PATH)/function/udf
#--------------------fillcli/fillsrv----------------------------------------#
fillcli.C : fillcli.sqC
embprepp fillcli $(DB) $(UID) $(PWD)
fillcli : fillcli.C util.o
$(CC) -o fillcli fillcli.C util.o $(CFLAGS) $(LIBS)
fillsrv.C : fillsrv.sqC
embprepp fillsrv $(DB) $(UID) $(PWD)
fillsrv : fillsrv.C util.o
$(CC) -c fillsrv.C $(CFLAGS)
$(LINKSL) -o fillsrv fillsrv.o util.o $(LIBS) -E fillsrv.exp
$(ERASE) $(DB2PATH)/function/fillsrv
$(COPY) fillsrv $(DB2PATH)/function/fillsrv
#--------------------inpcli/inpsrv------------------------------------------#
inpcli.C : inpcli.sqC
embprepp inpcli $(DB) $(UID) $(PWD)
inpcli : inpcli.C util.o
$(CC) -o inpcli inpcli.C util.o $(CFLAGS) $(LIBS)
inpsrv.C : inpsrv.sqC
embprepp inpsrv $(DB) $(UID) $(PWD)
inpsrv : inpsrv.C
$(CC) -c inpsrv.C $(CFLAGS)
$(LINKSL) -o inpsrv inpsrv.o $(LIBS) -E inpsrv.exp
$(ERASE) $(DB2PATH)/function/inpsrv
$(COPY) inpsrv $(DB2PATH)/function/inpsrv
#--------------------outcli/outsrv------------------------------------------#
outcli.C : outcli.sqC
embprepp outcli $(DB) $(UID) $(PWD)
outcli : outcli.C util.o
$(CC) -o outcli outcli.C util.o $(CFLAGS) $(LIBS)
outsrv.C : outsrv.sqC
embprepp outsrv $(DB) $(UID) $(PWD)
outsrv : outsrv.C
$(CC) -c outsrv.C $(CFLAGS)
$(LINKSL) -o outsrv outsrv.o $(LIBS) -E outsrv.exp
$(ERASE) $(DB2PATH)/function/outsrv
$(COPY) outsrv $(DB2PATH)/function/outsrv
#****************************************************************************
# 3e - multi-threaded samples
#****************************************************************************
thdsrver.C : thdsrver.sqC
embprepp thdsrver $(DB) $(UID) $(PWD)
thdsrver : thdsrver.C
$(ERASE) util.o
$(CM) -c util.C $(CFLAGS)
$(CM) -c thdsrver.C $(CFLAGS)
$(CM) -o thdsrver thdsrver.o util.o $(LIBS)
$(ERASE) util.o