# (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 -- LINUX 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 # Use the cc compiler CC= cc # The required compiler flags CFLAGS= $(EXTRA_CFLAGS) -I$(DB2PATH)/include # The required libraries LIBS= -L$(DB2PATH)/lib -Wl,-rpath,$(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 - make all #**************************************************************************** all : \ allclient \ udfspserver #**************************************************************************** # 2b - make udfspserver #**************************************************************************** udfspserver : \ spserver \ udfsrv #**************************************************************************** # 2c - make udfspclient #**************************************************************************** udfspclient : \ udfcli \ spclient #**************************************************************************** # 2d - make otherclient #**************************************************************************** otherclient : \ aphndls apinfo apsqlca \ dbconn dbinfo dbmconn dbmuse dbnative dbuse dbusemx \ dtinfo dtlob dtudt \ ilinfo \ ininfo \ tbconstr tbdefine tbinfo tbmod tbread #**************************************************************************** # 2e - make allclient(= udfspclient + otherclient) #**************************************************************************** allclient : \ udfspclient \ otherclient #**************************************************************************** # 2l - make clean #**************************************************************************** clean : $(ERASE) *.o *.map $(ERASE) dbusemx.c #**************************************************************************** # 2m - 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 (mixed) ############################################################################# #**************************************************************************** # 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 utilapi.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 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) #**************************************************************************** #--------------------calludf/udf--------------------------------------------# udfcli : 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 -shared $(ERASE) $(DB2PATH)/function/udfsrv $(COPY) udfsrv $(DB2PATH)/function/udfsrv #--------------------spclient/spserver--------------------------------------# spclient : utilcli.o $(CC) -o spclient spclient.c utilcli.o $(CFLAGS) $(LIBS) spserver : utilcli.o $(CC) -o spserver spserver.c utilcli.o $(CFLAGS) $(LIBS) -shared $(ERASE) $(DB2PATH)/function/spserver $(COPY) spserver $(DB2PATH)/function/spserver