# (C) COPYRIGHT International Business Machines Corp. 1998, 2000
# All Rights Reserved.
#
# US Government Users Restricted Rights - Use, duplication or
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
# DB2 Universal Database
# makefile for Java sample programs
# on UNIX operating systems
# 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 alljdbc - Builds the all JDBC supplied sample programs
# make allsqlj - Builds the all SQLJ supplied sample programs
#
# make srv - Builds the examples that implement
# stored procedures and UDFs (on the server)
# make srvjdbcj - Builds the JDBC examples that implement
# stored procedures and UDFs (on the server)
# make srvsqlj - Builds the SQLJ examples that implement
# stored procedures and UDFs (on the server)
#
# make srvcli - Builds the examples that call stored
# procedures and UDFs ( they can run remotely )
# make srvclijdbc - Builds the JDBC examples that call stored
# procedures and UDFs ( they can run remotely )
# make srvclisqlj - Builds the SQLJ examples that call stored
# procedures and UDFs ( they can run remotely )
#
# make othercli - Builds the examples that will run successfully
# on a client platform ( others than srvcli )
# make otherclijdbc - Builds the JDBC examples that will run successfully
# on a client platform ( others than srvclijdbc )
# make otherclisqlj - Builds the SQLJ examples that will run successfully
# on a client platform ( others than srvclisqlj )
#
# make allcli - Builds programs in srvcli and othercli
# categories
# make allclijdbc - Builds programs in srvclijdbc and otherclijdbc
# categories
# make allclisqlj - Builds programs in srvclisqlj and otherclisqlj
# 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 -- VARIABLES
# 2 -- MAKE CATEGORIES
# 3 -- COMMANDS TO MAKE INDIVIDUAL SAMPLES
##################################################################################
# 1 -- 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
# 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(= allcli + srv)
# 2b - make alljdbc(= allclijdbc + srvjdbcj)
# 2c - make allsqlj(= allclisqlj + srvsqlj)
#
# 2d - make srv(= srvjdbcj + srvsqlj)
# 2e - make srvjdbcj
# 2f - make srvsqlj
#
# 2g - make srvcli(= srvclijdbc + srvclisqlj)
# 2h - make srvclijdbc
# 2i - make srvclisqlj
#
# 2j - make othercli(= oth_clijdbc + oth_clisqlj)
# 2k - make oth_clijdbc
# 2l - make oth_clisqlj
#
# 2m - make allcli(= allclijdbc + allclisqlj)
# 2n - make allclijdbc(= srvclijdbc + oth_clijdbc)
# 2o - make allclisqlj(= srvclisqlj + oth_clisqlj)
#
# 2p - make clean
# 2q - make cleanall
#############################################################################
#****************************************************************************
# 2a - make all(= allcli + srv)
#****************************************************************************
all : \
srv \
allcli
#****************************************************************************
# 2b - make alljdbc(= allclijdbc + srvjdbcj)
#****************************************************************************
alljdbc : \
allclijdbc \
srvjdbcj
#****************************************************************************
# 2c - make allsqlj(= allclisqlj + srvsqlj)
#****************************************************************************
allsqlj : \
allclisqlj \
srvsqlj
#****************************************************************************
# 2d - make srv(= srvjdbcj + srvsqlj)
#****************************************************************************
srv : \
srvjdbcj \
srvsqlj
#****************************************************************************
# 2e - make srvjdbcj
#****************************************************************************
srvjdbcj : \
V5Stp DB2Udf \
MRSPsrv \
Spserver \
UDFsrv
#****************************************************************************
# 2f - make srvsqlj
#****************************************************************************
srvsqlj : \
Outsrv \
Stserver
#****************************************************************************
# 2g - make srvcli(= srvclijdbc + srvclisqlj)
#****************************************************************************
srvcli : \
srvclijdbc \
srvclisqlj
#****************************************************************************
# 2h - make srvclijdbc
#****************************************************************************
srvclijdbc : \
V5SpCli DB2UdCli \
MRSPcli \
Outcli \
Spclient \
UDFcli
#****************************************************************************
# 2i - make srvclisqlj
#****************************************************************************
srvclisqlj : \
RunUDFcli \
Stclient \
UDFclie
#****************************************************************************
# 2j - make othercli(= oth_clijdbc + oth_clisqlj)
#****************************************************************************
othercli : \
oth_clijdbc \
oth_clisqlj
#****************************************************************************
# 2k - make oth_clijdbc
#****************************************************************************
oth_clijdbc : \
DB2Appl DB2Applt Dynamic \
UseThrds \
Varinp
#****************************************************************************
# 2l - make oth_clisqlj
#****************************************************************************
oth_clisqlj : \
App Applt \
Cursor \
Openftch \
Static \
Updat
#****************************************************************************
# 2m - make allcli(= allclijdbc + allclisqlj)
#****************************************************************************
allcli : \
allclijdbc \
allclisqlj
#****************************************************************************
# 2n - make allclijdbc(= srvclijdbc + oth_clijdbc)
#****************************************************************************
allclijdbc : \
srvclijdbc \
oth_clijdbc
#****************************************************************************
# 2o - make allclisqlj(= srvclisqlj + oth_clisqlj)
#****************************************************************************
allclisqlj : \
srvclisqlj \
oth_clisqlj
#****************************************************************************
# 2p - make clean
#****************************************************************************
clean :
$(ERASE) App.java Applt.java
$(ERASE) Cursor.java
$(ERASE) Openftch.java OpF_Curs.java Outsrv.java
$(ERASE) Static.java Stclient.java Stserver.java StserverIterator.java
$(ERASE) Udf.java UDFclie.java Updat.java
#****************************************************************************
# 2q - make cleanall
#****************************************************************************
cleanall : \
clean
$(ERASE) *.class *.ser
$(ERASE) $(DB2PATH)/function/DB2Udf.class
$(ERASE) $(DB2PATH)/function/MRSPsrv.class
$(ERASE) $(DB2PATH)/function/Outsrv.class
$(ERASE) $(DB2PATH)/function/Outsrv_Cursor1.class
$(ERASE) $(DB2PATH)/function/Outsrv_SJProfileKeys.class
$(ERASE) $(DB2PATH)/function/Outsrv_SJProfile0.ser
$(ERASE) $(DB2PATH)/function/Person.class
$(ERASE) $(DB2PATH)/function/Spserver.class
$(ERASE) $(DB2PATH)/function/Stserver.class
$(ERASE) $(DB2PATH)/function/StserverEmployees.class
$(ERASE) $(DB2PATH)/function/StserverIterator.class
$(ERASE) $(DB2PATH)/function/StserverSalary.class
$(ERASE) $(DB2PATH)/function/Stserver_SJProfile0.ser
$(ERASE) $(DB2PATH)/function/Stserver_SJProfileKeys.class
$(ERASE) $(DB2PATH)/function/UDFsrv.class
$(ERASE) $(DB2PATH)/function/V5Stp.class
#############################################################################
# 3 -- COMMANDS TO MAKE INDIVIDUAL SAMPLES
# 3a - JDBC, non client/server samples
# 3c - SQLJ, non client/server samples
# 3d - client/server samples (mixed)
# 3e - applets (mixed)
#############################################################################
#****************************************************************************
# 3a - JDBC, non client/server samples
#****************************************************************************
DB2Appl : DB2Appl.java
javac DB2Appl.java
Dynamic : Dynamic.java
javac Dynamic.java
UseThrds : UseThrds.java
javac UseThrds.java
Varinp : Varinp.java
javac Varinp.java
#****************************************************************************
# 3c - SQLJ, non client/server samples
#****************************************************************************
App.class : App.sqlj
sqlj App.sqlj
App : App.class
./embprep App $(DB) $(UID) $(PWD)
Cursor.class : Cursor.sqlj
sqlj Cursor.sqlj
Cursor : Cursor.class
./embprep Cursor $(DB) $(UID) $(PWD)
OpF_Curs.class : OpF_Curs.sqlj
sqlj OpF_Curs.sqlj
Openftch.class : Openftch.sqlj
sqlj Openftch.sqlj
Openftch : OpF_Curs.class Openftch.class
./embprep Openftch $(DB) $(UID) $(PWD)
Static.class : Static.sqlj
sqlj Static.sqlj
Static : Static.class
./embprep Static $(DB) $(UID) $(PWD)
Updat.class : Updat.sqlj
sqlj Updat.sqlj
Updat : Updat.class
./embprep Updat $(DB) $(UID) $(PWD)
#****************************************************************************
# 3d - client/server samples (mixed)
#****************************************************************************
#--------------------DB2UdCli / DB2Udf--------------------------------------#
DB2UdCli : DB2UdCli.java
javac DB2UdCli.java
DB2Udf : DB2Udf.java
javac DB2Udf.java
$(ERASE) $(DB2PATH)/function/DB2Udf.class
$(COPY) DB2Udf.class $(DB2PATH)/function
#--------------------MRSPcli / MRSPsrv--------------------------------------#
MRSPcli : MRSPcli.java
javac MRSPcli.java
MRSPsrv : MRSPsrv.java
javac MRSPsrv.java
$(ERASE) $(DB2PATH)/function/MRSPsrv.class
$(COPY) MRSPsrv.class $(DB2PATH)/function
#--------------------Outcli / Outsrv----------------------------------------#
Outcli : Outcli.java
javac Outcli.java
Outsrv.class : Outsrv.sqlj
sqlj Outsrv.sqlj
Outsrv : Outsrv.class
./embprep Outsrv $(DB) $(UID) $(PWD)
$(ERASE) $(DB2PATH)/function/Outsrv.class
$(ERASE) $(DB2PATH)/function/Outsrv_Cursor1.class
$(ERASE) $(DB2PATH)/function/Outsrv_SJProfileKeys.class
$(ERASE) $(DB2PATH)/function/Outsrv_SJProfile0.ser
$(COPY) Outsrv.class $(DB2PATH)/function
$(COPY) Outsrv_Cursor1.class $(DB2PATH)/function
$(COPY) Outsrv_SJProfileKeys.class $(DB2PATH)/function
$(COPY) Outsrv_SJProfile0.ser $(DB2PATH)/function
#--------------------Spclient / Spserver------------------------------------#
# Note: before you execute Spclient for the first time, you must call the
# Spcreate.db2 CLP script to catalog the methods in Spserver as stored
# procedures
Spclient : Spclient.java
javac Spclient.java
Spserver : Spserver.java
javac Spserver.java
$(ERASE) $(DB2PATH)/function/Spserver.class
$(COPY) Spserver.class $(DB2PATH)/function
#--------------------Stclient / Stserver------------------------------------#
# Note: before you execute Stclient for the first time, you must call the
# Stcreate.db2 CLP script to catalog the methods in Spserver as stored
# procedures
Stclient.class : Stclient.sqlj
sqlj Stclient.sqlj
Stclient : Stclient.class
./embprep Stclient $(DB) $(UID) $(PWD)
StserverIterator.class : StserverIterator.sqlj
sqlj StserverIterator.sqlj
Stserver.class : Stserver.sqlj StserverIterator.class
sqlj Stserver.sqlj
Stserver : StserverIterator.class Stserver.class
./embprep Stserver $(DB) $(UID) $(PWD)
$(ERASE) $(DB2PATH)/function/Stserver.class
$(ERASE) $(DB2PATH)/function/StserverEmployees.class
$(ERASE) $(DB2PATH)/function/StserverIterator.class
$(ERASE) $(DB2PATH)/function/StserverSalary.class
$(ERASE) $(DB2PATH)/function/Stserver_SJProfileKeys.class
$(ERASE) $(DB2PATH)/function/Stserver_SJProfile0.ser
$(COPY) Stserver.class $(DB2PATH)/function
$(COPY) StserverEmployees.class $(DB2PATH)/function
$(COPY) StserverIterator.class $(DB2PATH)/function
$(COPY) StserverSalary.class $(DB2PATH)/function
$(COPY) Stserver_SJProfileKeys.class $(DB2PATH)/function
$(COPY) Stserver_SJProfile0.ser $(DB2PATH)/function
#--------------------UDFcli + UDFclie / UDFsrv------------------------------#
# Before you can make UDFclie, you must run UDFcli once
# 'make all' includes RunUDFcli, which runs UDFcli before making UDFclie
UDFcli : UDFcli.java
javac UDFcli.java
RunUDFcli : UDFcli
java UDFcli $(UID) $(PWD)
UDFclie.class : UDFclie.sqlj
sqlj UDFclie.sqlj
UDFclie : UDFclie.class
./embprep UDFclie $(DB) $(UID) $(PWD)
UDFsrv : UDFsrv.java
javac UDFsrv.java
$(ERASE) $(DB2PATH)/function/UDFsrv.class
$(ERASE) $(DB2PATH)/function/Person.class
$(COPY) UDFsrv.class $(DB2PATH)/function
$(COPY) Person.class $(DB2PATH)/function
#--------------------V5SpCli / V5Stp--------------------------------------#
V5SpCli : V5SpCli.java
javac V5SpCli.java
V5Stp : V5Stp.java
javac V5Stp.java
$(ERASE) $(DB2PATH)/function/V5Stp.class
$(COPY) V5Stp.class $(DB2PATH)/function
#****************************************************************************
# 3e - applets (mixed)
#****************************************************************************
DB2Applt : DB2Applt.java
javac DB2Applt.java
Applt.class : Applt.sqlj
sqlj Applt.sqlj
Applt : Applt.class
./embprep Applt $(DB) $(UID) $(PWD)