# (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 -- 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 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 CC compiler CC= CC DB2_LIBPATH=$(DB2PATH)/lib # The required compiler flags for n32 object type support # EXTRA_CFLAGS=-n32 # DB2_LIBPATH=$(DB2PATH)/lib32 # The required compiler flags: CFLAGS=$(EXTRA_CFLAGS) -I$(DB2PATH)/include $(IRIX_OBJECT_MODE) # The required libraries: LIBS=-L$(DB2_LIBPATH) -rpath $(DB2_LIBPATH) -lm -ldb2 # The required libraries for multi-threaded applications: LIBSMT= -L$(DB2_LIBPATH) -rpath $(DB2_LIBPATH) -lm -ldb2_th -lpthread # 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 udfspclient # 2d - make otherremoteclient # 2e - make allremoteclient(= udfspclient + otherremoteclient) # 2f - make clean # 2g - make cleanall ############################################################################# #**************************************************************************** # 2a - make all #**************************************************************************** all : \ allremoteclient # udfspserver #**************************************************************************** # 2b - make udfspserver #**************************************************************************** udfspserver : \ spserver \ udf udfsrv #**************************************************************************** # 2c - make udfspclient #**************************************************************************** udfspclient : \ calludf \ spclient udfcli #**************************************************************************** # 2d - make otherremoteclient #**************************************************************************** otherremoteclient : \ client cursor \ static \ thdsrver \ updat #**************************************************************************** # 2e - make allremoteclient #**************************************************************************** allremoteclient : \ udfspclient \ otherremoteclient #**************************************************************************** # 2f - make clean #**************************************************************************** clean : \ cleangen \ cleanemb cleangen : $(ERASE) *.o *.map cleanemb : $(ERASE) calludf.C cursor.C $(ERASE) spclient.C spserver.C $(ERASE) static.C $(ERASE) thdsrver.C $(ERASE) updat.C utilemb.C $(ERASE) udfcli.C #**************************************************************************** # 2g - make cleanall #**************************************************************************** cleanall : \ clean $(ERASE) *.bnd $(ERASE) calludf client cursor $(ERASE) spclient $(ERASE) static $(ERASE) thdsrver $(ERASE) updat 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) # 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 #**************************************************************************** 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) -KPIC $(CFLAGS) -o udf udf.c -G $(LIBS) -ldb2apie $(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 : udfsrv.c $(CC) -KPIC $(CFLAGS) -o udfsrv udfsrv.c -G $(LIBS) -ldb2apie $(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 spcreate.db2 spdrop.db2 $(CC) -KPIC $(CFLAGS) -o spserver spserver.C -G $(LIBS) $(ERASE) $(DB2PATH)/function/spserver $(COPY) spserver $(DB2PATH)/function/spserver 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 $(CC) -c thdsrver.C $(CFLAGS) $(CC) -o thdsrver thdsrver.o $(LIBSMT)