# (C) COPYRIGHT International Business Machines Corp. 1995, 2000
# 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
# CLI 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 udfspclient - Builds the examples that call stored
# procedures and UDFs ( they can run remotely )
# make otherclient - Builds the examples that will run successfully
# on a client platform ( others than udfspclient )
# make allclient - Builds programs in udfspclient and otherclient
# 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
# For 64 bit executables use:
# EXTRA_CFLAGS=-q64
# Use the xlc compiler
CC= xlc
# The required compiler flags
CFLAGS= $(EXTRA_CFLAGS) -I$(DB2PATH)/include
# The required libraries
LIBS= -L$(DB2PATH)/lib -ldb2
# 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(= allclient + udfspserver)
# 2b - make udfspserver
# 2c - make udfspclient
# 2d - make otherclient
# 2e - make allclient(= udfspclient + otherclient)
#
# 2f - make clean
# 2g - make cleanall
#############################################################################
#****************************************************************************
# 2a - nmake all
#****************************************************************************
all : \
allclient \
udfspserver
#****************************************************************************
# 2b - nmake udfspserver
#****************************************************************************
udfspserver : \
spserver \
udfsrv
#****************************************************************************
# 2c - nmake udfspclient
#****************************************************************************
udfspclient : \
spclient \
udfcli
#****************************************************************************
# 2d - nmake otherclient
#****************************************************************************
otherclient : \
aphndls apinfo apsqlca \
dbconn dbinfo dbmconn dbmuse dbnative dbuse dbusemx \
dtinfo dtlob dtudt \
ilinfo \
ininfo \
tbconstr tbdefine tbinfo tbmod tbread
#****************************************************************************
# 2e - nmake allclient(= udfspclient + otherclient)
#****************************************************************************
allclient : \
udfspclient \
otherclient
#****************************************************************************
# 2f - make clean
#****************************************************************************
clean :
$(ERASE) *.o *.map *.bmp *.gif *.xwd
$(ERASE) dbusemx.c
#****************************************************************************
# 2g - make cleanall
#****************************************************************************
cleanall : \
clean
$(ERASE) *.bnd
$(ERASE) aphndls apinfo apsqlca
$(ERASE) dbconn dbinfo dbmconn dbmuse dbnative dbuse dbusemx
$(ERASE) dtinfo dtlob dtudt
$(ERASE) ilinfo
$(ERASE) ininfo
$(ERASE) spclient spserver
$(ERASE) tbconstr tbdefine tbinfo tbmod tbread
$(ERASE) udfcli udfsrv
$(ERASE) $(DB2PATH)/function/udfsrv
#############################################################################
# 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
#############################################################################
#****************************************************************************
# 3a - utilities
#****************************************************************************
utilcli.o :
$(CC) -c utilcli.c $(CFLAGS)
utilapi.o :
$(CC) -c utilapi.c $(CFLAGS)
#****************************************************************************
# 3b - non embedded SQL, non client/server samples
#****************************************************************************
aphndls : utilcli.o
$(CC) -o aphndls aphndls.c utilcli.o $(CFLAGS) $(LIBS)
apinfo : utilcli.o
$(CC) -o apinfo apinfo.c utilcli.o $(CFLAGS) $(LIBS)
apsqlca : utilcli.o
$(CC) -o apsqlca apsqlca.c utilcli.o $(CFLAGS) $(LIBS)
dbconn : utilcli.o
$(CC) -o dbconn dbconn.c utilcli.o $(CFLAGS) $(LIBS)
dbinfo : utilcli.o
$(CC) -o dbinfo dbinfo.c utilcli.o $(CFLAGS) $(LIBS)
dbmconn : utilcli.o utilapi.o
$(CC) -o dbmconn dbmconn.c utilcli.o utilapi.o $(CFLAGS) $(LIBS)
dbmuse : utilcli.o
$(CC) -o dbmuse dbmuse.c utilcli.o utilapi.o $(CFLAGS) $(LIBS)
dbnative : utilcli.o
$(CC) -o dbnative dbnative.c utilcli.o $(CFLAGS) $(LIBS)
dbuse : utilcli.o
$(CC) -o dbuse dbuse.c utilcli.o $(CFLAGS) $(LIBS)
dtinfo : utilcli.o
$(CC) -o dtinfo dtinfo.c utilcli.o $(CFLAGS) $(LIBS)
dtlob : utilcli.o
$(CC) -o dtlob dtlob.c utilcli.o $(CFLAGS) $(LIBS)
dtudt : utilcli.o
$(CC) -o dtudt dtudt.c utilcli.o $(CFLAGS) $(LIBS)
ilinfo : utilcli.o
$(CC) -o ilinfo ilinfo.c utilcli.o $(CFLAGS) $(LIBS)
ininfo : utilcli.o
$(CC) -o ininfo ininfo.c utilcli.o $(CFLAGS) $(LIBS)
spcall : utilcli.o
$(CC) -o spcall spcall.c utilcli.o $(CFLAGS) $(LIBS)
tbconstr : utilcli.o
$(CC) -o tbconstr tbconstr.c utilcli.o $(CFLAGS) $(LIBS)
tbdefine : utilcli.o
$(CC) -o tbdefine tbdefine.c utilcli.o $(CFLAGS) $(LIBS)
tbinfo : utilcli.o
$(CC) -o tbinfo tbinfo.c utilcli.o $(CFLAGS) $(LIBS)
tbread : utilcli.o
$(CC) -o tbread tbread.c utilcli.o $(CFLAGS) $(LIBS)
tbmod : utilcli.o
$(CC) -o tbmod tbmod.c utilcli.o $(CFLAGS) $(LIBS)
#****************************************************************************
# 3c - embedded SQL non client/server sample
#****************************************************************************
dbusemx.c : dbusemx.sqc
embprep dbusemx $(DB) $(UID) $(PWD)
dbusemx : dbusemx.c utilcli.o
$(CC) -o dbusemx dbusemx.c utilcli.o $(CFLAGS) $(LIBS)
#****************************************************************************
# 3d - client/server samples (mixed)
#****************************************************************************
#--------------------outcli2/outsrv2----------------------------------------#
spclient : utilcli.o
$(CC) -o spclient spclient.c utilcli.o $(CFLAGS) $(LIBS)
spserver : utilcli.o
$(CC) -o spserver spserver.c utilcli.o $(CFLAGS) $(LIBS) \
-H512 -T512 -bE:spserver.exp -e outlanguage
$(ERASE) $(DB2PATH)/function/spserver
$(COPY) spserver $(DB2PATH)/function/spserver
#-------------------- udfcli / udfsrv --------------------------------------#
udfcli : utilcli.o
$(CC) -o udfcli udfcli.c utilcli.o $(CFLAGS) $(LIBS)
udfsrv :
$(CC) -o udfsrv udfsrv.c $(CFLAGS) $(LIBS) -lm \
-H512 -T512 -bE:udfsrv.exp -e ScalarUDF
$(ERASE) $(DB2PATH)/function/udfsrv
$(COPY) udfsrv $(DB2PATH)/function/udfsrv