# # SQLJ Demo Makefile # help: @echo "Make targets:" @echo " compile_all - compile all demos" @echo " run_all - compile and run all demos" @echo " clean_all - remove .class and .ser files for all demos" @echo " Foo.class - compile demo Foo" @echo " Foo.run - compile and run demo Foo" @echo " Foo.debug - compile and run demo Foo with debug output" @echo " Foo.clean - remove .class and .ser files for demo Foo" @echo "Invoke with \"SQLJ_FLAGS=-user=scott/tiger\" for online compile" @echo "Invoke with \"Foo_FLAGS=args...\" to pass runtime options to demo Foo" # # Redefine PATHSEP and DIRSEP as appropriate for OS. # For example, on NT, PATHSEP=; and DIRSEP=\ # PATHSEP=: DIRSEP=/ # CLASSPATH for compiling the SQLJ program MAKE_CLASSPATH = ".$(PATHSEP)$(ORACLE_HOME)$(DIRSEP)jdbc$(DIRSEP)lib$(DIRSEP)classes111.zip$(PATHSEP)$(ORACLE_HOME)$(DIRSEP)sqlj$(DIRSEP)lib$(DIRSEP)translator.zip$(PATHSEP)$(CLASSPATH)" # CLASSPATH for running the SQLJ program RUN_CLASSPATH = ".$(PATHSEP)$(ORACLE_HOME)$(DIRSEP)jdbc$(DIRSEP)lib$(DIRSEP)classes111.zip$(PATHSEP)$(ORACLE_HOME)$(DIRSEP)sqlj$(DIRSEP)lib$(DIRSEP)runtime.zip$(PATHSEP)$(CLASSPATH)" DEBUG_RUN_CLASSPATH = $(MAKE_CLASSPATH) # List of demo .sqlj files DEMO_SQLJ = TestInstallSQLJ.sqlj \ TestInstallSQLJChecker.sqlj \ RefCursDemo.sqlj \ QueryDemo.sqlj \ PrefetchDemo.sqlj \ ExprDemo.sqlj \ JDBCInteropDemo.sqlj \ MultiSchemaDemo.sqlj \ MultiThreadDemo.sqlj \ NamedIterDemo.sqlj \ PosIterDemo.sqlj # List of demo .java files DEMO_JAVA = TestInstallCreateTable.java \ TestInstallJDBC.java SHELL = sh SQLJ = "$(ORACLE_HOME)$(DIRSEP)bin$(DIRSEP)sqlj" JAVA = java JAVAC = javac SQLJ_FLAGS = SQLPLUS = "$(ORACLE_HOME)$(DIRSEP)bin$(DIRSEP)sqlplus" USER = scott/tiger # # Runline flags for specific demos follow. # They may also be overridden in the invocation of make. # QueryDemo_FLAGS = SMITH 5000 JDBCInteropDemo_FLAGS = "sal > 2000" # # Macro to run a SQL script for a target file if it exists # loadsql = if [ -f $*.sql ]; then \ echo loading script $*.sql "..."; $(SQLPLUS) "$(USER)" < $*.sql; fi # # explicit rules follow # compile_all: compile_java compile_sqlj compile_java: $(DEMO_JAVA) $(MAKE) -i $(?:.java=.class) compile_sqlj: $(DEMO_SQLJ) $(MAKE) -i $(?:.sqlj=.class) run_all: run_java run_sqlj run_java: $(DEMO_JAVA) $(MAKE) -i $(?:.java=.run) run_sqlj: $(DEMO_SQLJ) $(MAKE) -i $(?:.sqlj=.run) clean_all: rm -f *.class *.ser $(DEMO_SQLJ:.sqlj=.java) # # suffix rules follow # .SUFFIXES: .SUFFIXES: .class .sqlj .run .clean .java .debug .sqlj.class : @$(loadsql) @echo translating $< "..." @(CLASSPATH=$(MAKE_CLASSPATH); export CLASSPATH;\ $(SQLJ) $(SQLJ_FLAGS) $<) .class.run : @echo running $* $($*_FLAGS) "..." @(CLASSPATH=$(RUN_CLASSPATH); export CLASSPATH;\ $(JAVA) $* $($*_FLAGS)) .class.debug : @echo adding debug information to $* "..." @(CLASSPATH=$(MAKE_CLASSPATH); export CLASSPATH;\ $(SQLJ) -P-debug $*_SJProfile*.ser) @echo running $* $($*_FLAGS) with debug information "..." @(CLASSPATH=$(DEBUG_RUN_CLASSPATH); export CLASSPATH;\ $(JAVA) $* $($*_FLAGS)) .sqlj.clean : rm -f $**.java $**.ser $**.class .java.class : @$(loadsql) @echo compiling $< "..." @(CLASSPATH=$(MAKE_CLASSPATH); export CLASSPATH;\ $(JAVAC) $<) .java.clean : rm -f $**.class