# for this to work, you must put # setenv LD_LIBRARY_PATH /usr/IBMdb2/V7.1/lib # in you .cshrc # # # A makefile to compile embeded SQL C programs # # input: sta-select.sqc (a static SQL c program) and # dyn-select.sqc (a dynamic SQL c program) # output: dyn-select (executable codes) # DB2DIR = /usr/IBMdb2/V7.1 Cflags = -I $(DB2DIR)/include \ -L $(DB2DIR)/lib \ -ldb2 all: dyn-select # The first thing is to connect to the database and precompile the programs. # This generates C programs where all SQL commands (except dynamic SQL # queries inside dyn-select.sqc) are replaced by subroutine calls. # dyn-select.c: dyn-select.sqc db2 connect to csc343h db2 prep dyn-select.sqc db2 connect reset # The next step is to compile the C programs and # generate the executable codes. sta-select: sta-select.c gcc -Wall $(Cflags) -o sta-select sta-select.c dyn-select: dyn-select.c gcc -Wall $(Cflags) -o dyn-select dyn-select.c