# (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 -- SILICON GRAPHICS IRIX 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
#----------------------------------------------------------------------------
# make ord_all - Builds the all the supplied sample programs
# for the ORDER scenario
# make ord_udfspserver - Builds the examples that implement
# stored procedures and UDFs (on the server)
# for the ORDER scenario
# make ord_udfspclient - Builds the examples that call stored
# procedures and UDFs ( they can run remotely )
# for the ORDER scenario
# make ord_otherclient - Builds the examples that will run successfully
# on a client platform ( others than udfspclient )
# for the ORDER scenario
# make ord_allclient - Builds programs in ord_udfspclient and
# ord_otherclient categories
#----------------------------------------------------------------------------
# make v2all - Builds the all DB2 Version 2 supplied
# sample programs
#----------------------------------------------------------------------------
# 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 cc compiler
CC=cc
# Link with db2 o32 object type libraries
DB2_LIBPATH=$(DB2PATH)/lib
# The required compiler flags for n32 object type support
# EXTRA_CFLAGS=-n32
# Link with db2 n32 object type libraries
# DB2_LIBPATH=$(DB2PATH)/lib32
CFLAGS= $(EXTRA_CFLAGS) -I$(DB2PATH)/include
# The required libraries
LIBS= -L$(DB2_LIBPATH) -rpath $(DB2_LIBPATH) -lm -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 - make all
#****************************************************************************
all : \
allclient
# udfspserver
#****************************************************************************
# 2b - make udfspserver
#****************************************************************************
udfspserver : \
spserver \
udfsrv
#****************************************************************************
# 2c - make udfspclient
#****************************************************************************
udfspclient : \
udfcli \
spclient
#****************************************************************************
# 2d - make otherclient
#****************************************************************************
# drop dbmuse dbmconn for client only makefile
otherclient : \
aphndls apinfo apsqlca \
dbconn dbinfo dbnative dbuse dbusemx \
dtinfo dtlob dtudt \
ilinfo \
ininfo \
tbconstr tbdefine tbinfo tbmod tbread
# dbmconn dbmuse
#****************************************************************************
# 2e - make allclient(= udfspclient + otherclient)
#****************************************************************************
allclient : \
udfspclient \
otherclient
#****************************************************************************
# 2f - make clean
#****************************************************************************
clean :
$(ERASE) *.o *.map
$(ERASE) dbusemx.c
#****************************************************************************
# 2g - make cleanall
#****************************************************************************
cleanall : \
clean
$(ERASE) *.bnd
$(ERASE) aphndls apinfo apsqlca
$(ERASE) dbconn dbinfo dbnative dbuse dbusemx
$(ERASE) dtinfo dtlob dtudt
$(ERASE) ilinfo
$(ERASE) ininfo
$(ERASE) spclient
$(ERASE) tbconstr tbdefine tbinfo tbmod tbread
$(ERASE) udfcli
#############################################################################
# 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)
#############################################################################
#****************************************************************************
# 3a - utilities
#****************************************************************************
utilcli.o : utilcli.c
$(CC) -c utilcli.c $(CFLAGS)
utilapi.o : utilapi.c
$(CC) -c utilapi.c $(CFLAGS)
#****************************************************************************
# 3b - non embedded SQL, non client/server samples
#****************************************************************************
aphndls : aphndls.c utilcli.o
$(CC) -o aphndls aphndls.c utilcli.o $(CFLAGS) $(LIBS)
apinfo : apinfo.c utilcli.o
$(CC) -o apinfo apinfo.c utilcli.o $(CFLAGS) $(LIBS)
apsqlca : apsqlca.c utilcli.o
$(CC) -o apsqlca apsqlca.c utilcli.o $(CFLAGS) $(LIBS)
dbconn : dbconn.c utilcli.o
$(CC) -o dbconn dbconn.c utilcli.o $(CFLAGS) $(LIBS)
dbinfo : dbinfo.c utilcli.o
$(CC) -o dbinfo dbinfo.c utilcli.o $(CFLAGS) $(LIBS)
dbmconn : dbmconn.c utilcli.o utilapi.o
$(CC) -o dbmconn dbmconn.c utilcli.o utilapi.o $(CFLAGS) $(LIBS)
dbmuse : dbmuse.c utilcli.o utilapi.o
$(CC) -o dbmuse dbmuse.c utilcli.o utilapi.o $(CFLAGS) $(LIBS)
dbnative : dbnative.c utilcli.o
$(CC) -o dbnative dbnative.c utilcli.o $(CFLAGS) $(LIBS)
dbuse : dbuse.c utilcli.o
$(CC) -o dbuse dbuse.c utilcli.o $(CFLAGS) $(LIBS)
dtinfo : dtinfo.c utilcli.o
$(CC) -o dtinfo dtinfo.c utilcli.o $(CFLAGS) $(LIBS)
dtlob : dtlob.c utilcli.o
$(CC) -o dtlob dtlob.c utilcli.o $(CFLAGS) $(LIBS)
dtudt : dtudt.c utilcli.o
$(CC) -o dtudt dtudt.c utilcli.o $(CFLAGS) $(LIBS)
ilinfo : ilinfo.c utilcli.o
$(CC) -o ilinfo ilinfo.c utilcli.o $(CFLAGS) $(LIBS)
ininfo : ininfo.c utilcli.o
$(CC) -o ininfo ininfo.c utilcli.o $(CFLAGS) $(LIBS)
spcall : spcall.c utilcli.o
$(CC) -o spcall spcall.c utilcli.o $(CFLAGS) $(LIBS)
tbconstr : tbconstr.c utilcli.o
$(CC) -o tbconstr tbconstr.c utilcli.o $(CFLAGS) $(LIBS)
tbdefine : tbdefine.c utilcli.o
$(CC) -o tbdefine tbdefine.c utilcli.o $(CFLAGS) $(LIBS)
tbinfo : tbinfo.c utilcli.o
$(CC) -o tbinfo tbinfo.c utilcli.o $(CFLAGS) $(LIBS)
tbread : tbread.c utilcli.o
$(CC) -o tbread tbread.c utilcli.o $(CFLAGS) $(LIBS)
tbmod : tbmod.c utilcli.o
$(CC) -o tbmod tbmod.c utilcli.o $(CFLAGS) $(LIBS)
#****************************************************************************
# 3c - embedded SQL non client/server samples
#****************************************************************************
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)
#****************************************************************************
#--------------------udfcli/udfsrv-----------------------------------------#
udfcli : udfcli.c utilcli.o
$(CC) -o udfcli udfcli.c utilcli.o $(CFLAGS) $(LIBS)
udfsrv : udfsrv.c
$(CC) -c udfsrv.c $(CFLAGS)
$(CC) -o udfsrv udfsrv.o $(LIBS) -ldb2apie -G
$(ERASE) $(DB2PATH)/function/udfsrv
$(COPY) udfsrv $(DB2PATH)/function/udfsrv
#--------------------spclient/spserver--------------------------------------#
spclient : spclient.c utilcli.o
$(CC) -o spclient spclient.c utilcli.o $(CFLAGS) $(LIBS)
spserver : spserver.c utilcli.o
$(CC) -o spserver spserver.c utilcli.o $(CFLAGS) $(LIBS) -G
$(ERASE) $(DB2PATH)/function/spserver
$(COPY) spserver $(DB2PATH)/function/spserver