# (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 # 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 # For 64 bit executables use: # EXTRA_CFLAGS=-q64 # EXTRA_SLFLAGS=-X64 # The required compiler flags CFLAGS= $(EXTRA_CFLAGS) -I$(DB2PATH)/include # The linker for shared libraries LINKSL=makeC++SharedLib -p 1024 $(EXTRA_SLFLAGS) # 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 : \ spserver \ udf udfsrv #**************************************************************************** # 2c - make localclient #**************************************************************************** # there are not samples in this category for now localclient : #**************************************************************************** # 2d - make udfspclient #**************************************************************************** udfspclient : \ calludf \ spclient udfcli #**************************************************************************** # 2e - make otherremoteclient #**************************************************************************** otherremoteclient : \ autocfg \ client cursor \ static \ thdsrver \ updat #**************************************************************************** # 2f - make allremoteclient #**************************************************************************** allremoteclient : \ udfspclient \ otherremoteclient #**************************************************************************** # 2g - make clean #**************************************************************************** clean : \ cleangen \ cleanemb cleangen : $(ERASE) *.o *.map cleanemb : $(ERASE) autocfg.C $(ERASE) calludf.C cursor.C $(ERASE) spclient.C spserver.C $(ERASE) static.C $(ERASE) thdsrver.C $(ERASE) updat.C utilemb.C $(ERASE) udfcli.C #**************************************************************************** # 2h - make cleanall #**************************************************************************** cleanall : \ clean $(ERASE) *.bnd $(ERASE) autocfg $(ERASE) calludf client cursor $(ERASE) spclient spserver $(ERASE) static $(ERASE) thdsrver $(ERASE) updat udf udfsrv udfcli $(ERASE) $(DB2PATH)/function/udf $(ERASE) $(DB2PATH)/function/udfsrv $(ERASE) $(DB2PATH)/function/spserver ############################################################################# # 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 #**************************************************************************** utilapi.o : utilapi.C $(CC) -c utilapi.C $(CFLAGS) utilemb.C : utilemb.sqC ./embprep utilemb $(DB) $(UID) $(PWD) utilemb.o : utilemb.C $(CC) -c utilemb.C $(CFLAGS) #**************************************************************************** # 3b - non embedded SQL, non client/server samples #**************************************************************************** client : client.C utilapi.o $(CC) -o client client.C utilapi.o $(CFLAGS) $(LIBS) #**************************************************************************** # 3c - embedded SQL non client/server samples #**************************************************************************** autocfg.C : autocfg.sqC ./embprep autocfg $(DB) $(UID) $(PWD) autocfg : autocfg.C utilemb.o $(CC) -o autocfg autocfg.C utilemb.o $(CFLAGS) $(LIBS) cursor.C : cursor.sqC ./embprep cursor $(DB) $(UID) $(PWD) cursor : cursor.C utilemb.o $(CC) -o cursor cursor.C utilemb.o $(CFLAGS) $(LIBS) static.C : static.sqC ./embprep static $(DB) $(UID) $(PWD) static : static.C utilemb.o $(CC) -o static static.C utilemb.o $(CFLAGS) $(LIBS) updat.C : updat.sqC ./embprep updat $(DB) $(UID) $(PWD) updat : updat.C utilemb.o $(CC) -o updat updat.C utilemb.o $(CFLAGS) $(LIBS) #**************************************************************************** # 3d - client/server samples (mixed) #**************************************************************************** #--------------------calludf/udf--------------------------------------------# calludf.C : calludf.sqC ./embprep calludf $(DB) $(UID) $(PWD) calludf : calludf.C utilemb.o $(CC) -o calludf calludf.C utilemb.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 #-------------------- udfcli/udfsrv----------------------------------------# udfcli.C : udfcli.sqC ./embprep udfcli $(DB) $(UID) $(PWD) udfcli : udfcli.C utilemb.o $(CC) -o udfcli udfcli.C utilemb.o $(CFLAGS) $(LIBS) udfsrv : $(CC) -c udfsrv.c $(CFLAGS) $(LINKSL) -o udfsrv udfsrv.o $(LIBSudfsrv) -E udfsrv.exp $(ERASE) $(DB2PATH)/function/udfsrv $(COPY) udfsrv $(DB2PATH)/function/udfsrv #--------------------spclient/spserver--------------------------------------# spclient.C : spclient.sqC ./embprep spclient $(DB) $(UID) $(PWD) spclient : spclient.C utilemb.o $(CC) -o spclient spclient.C utilemb.o $(CFLAGS) $(LIBS) spserver.C : spserver.sqC ./embprep spserver $(DB) $(UID) $(PWD) spserver : spserver.C spserver.exp spdrop.db2 spcreate.db2 $(CC) -c spserver.C $(CFLAGS) $(LINKSL) -o spserver spserver.o $(LIBS) -E spserver.exp $(ERASE) $(DB2PATH)/function/spserver $(COPY) spserver $(DB2PATH)/function/spserver spserver.exp : $(COPY) $(DB2PATH)/samples/c/spserver.exp . spcreate.db2 : $(COPY) $(DB2PATH)/samples/c/spcreate.db2 . spdrop.db2 : $(COPY) $(DB2PATH)/samples/c/spdrop.db2 . #**************************************************************************** # 3e - multi-threaded samples #**************************************************************************** thdsrver.C : thdsrver.sqC ./embprep thdsrver $(DB) $(UID) $(PWD) thdsrver : thdsrver.C $(CM) -o thdsrver thdsrver.C $(CFLAGS) $(LIBS)