# Precompile, compile, and link C application APP # with Embedded SQL statements # where the DB2 installation lives DB2PATH=/opt/IBM/db2/V9.5.2 # database to connect to DATABASE=homework # which application to build ... APP=student-with-id #APP=all-student-results #APP=homebrew-all-student-results #APP=email-student-with-id # ... from which object file(s) OBJECTS=$(APP).o # link with the 64-bit version of the IBM DB2 libs # (to use the 32-bit version, use .../lib32 instead) $(APP): $(OBJECTS) $(CC) -o $@ $< -L$(DB2PATH)/lib64 -ldb2 %.c: %.sqc db2 connect to $(DATABASE) db2 precompile $< bindfile db2 bind $*.bnd %.o: %.c $(CC) $(CCFLAGS) -I$(DB2PATH)/include -c $< .PHONY: clean clean: rm -rf $(APP) $(OBJECTS) $(APP).c $(APP).bnd