run : 
	@echo "Use the following"
	@echo "make basic                create er, relational, and integrate er models"
	@echo "make university           University database integration demo"
#	@echo "make bank        to run Bank database integration demo"
	@echo "make bank-xml             Bank XML file integration demo"
	@echo "make bank-xml-matching    Schema Matching on the Bank XML files"
	@echo "make ugpg                 UG/PG student integration demo"
	@echo "make demo                 latest demo under test"
	@echo "make optimiser            optimise the er integration"
#	@echo "make editor	         start the command line editor"
	@echo "make gui                  start the graphical editor"
	@echo "make templates            create the template transformations"
	@echo "make templatesgui         GUI to execute template transformations"
	@echo "make coins-notes-cash     build notes, coins and cash example"
	@echo "make reinitialise         wipe everything from the repository"
	@echo "make caise05              caise05 paper demo"
# Added by dmle 11/2006
	@echo "make overlay-viz			start the Overlay Visualizer"
	@echo "make overlay-basic        run a basic AutoMed Chord application"
	@echo "make don-with-schema-1    run the 1st DON application instance"
	@echo "make don-with-schema-2    run the 2nd DON application instance"
	@echo "make con-local            run the stand-alone CON application"
	@echo "make con-basic            run the basic CON P2P application"
	@echo "make dtcdemo1             run the first DTCDemo as per July 2006"
	@echo "make dtcdemo2             run the 2nd DTCDemo as per Jan 2007"

PHONY : all classes models schemas transformations  erdemo clean \
	 universityreadme readuniversity \
	 university UniversityDatabaseIntegration \
	 ReadUniversity ReadUniversity1 ReadUniversity2 ReadUniversity3 

.SUFFIXES : 

.SUFFIXES : .java .class

JFLAGS :=
JCCFLAGS := -O -deprecation

test :
	cd $AUTOMED_SRC; make
	java uk.ac.ic.doc.automed.editor.TransformationTool uni_z1



icde03 : reinitialise ReadICDE03 ICDE03

reinitialise : DefineRepository.class
	java DefineRepository

bank-xml : semistructured/xml/XMLBankIntegration.class semistructured/xml/XMLBankIntegrationQueries.class
	java semistructured.xml.XMLBankIntegration
	java semistructured.xml.XMLBankIntegrationQueries

basic : reinitreps models schemas transformations

nutshell : AutoMedInANutshell.class
	java AutoMedInANutshell

ugpg : UGPGStudentsExample/DefineRepository.class \
	UGPGStudentsExample/DefineSSDFormats.class \
	UGPGStudentsExample/DefinePatterns.class \
	UGPGStudentsExample/DefineSchemas.class \
	UGPGStudentsExample/DefineTransformations.class
	java UGPGStudentsExample.DefineRepository
	java UGPGStudentsExample.DefineSchemas
	java UGPGStudentsExample.DefinePatterns
	java UGPGStudentsExample.DefineSSDFormats
	java UGPGStudentsExample.DefineTransformations

caise05 : caise05/DefineRepository.class \
	caise05/DefineSSDFormats.class \
	caise05/DefinePatterns.class \
	caise05/DefineSchemas.class \
	caise05/DefineTransformations.class
	java caise05.DefineRepository
	java caise05.DefineSchemas
	java caise05.DefinePatterns
	java caise05.DefineSSDFormats
	java caise05.DefineTransformations

demo : basic university templates templatesdemo 

editor :
	java uk.ac.ic.doc.automed.editor.Editor

gui :
	java uk.ac.ic.doc.automed.editor.Gui -d 0.0 -d 1.0 -d 3.2 -d 4.1

gui_anon :
	java uk.ac.ic.doc.automed.editor.Gui -d 0.0 -c ~/.automed/anon_data_source_repository.cfg


gui_bigmen :
	java -Xms512m -Xmx1024m uk.ac.ic.doc.automed.editor.Gui -d 0.0 -d 1.0 -d 3.2 -d 4.1

optimiseer : OptimiseERTransformationPathway.class
	java OptimiseERTransformationPathway

optimisesql92 : OptimiseTransformationPathway.class
	java OptimiseTransformationPathway

coins-notes-cash : CoinsNotesCash.class
	java CoinsNotesCash

university :  UniversityDatabaseWrapping \
	UniversityDatabaseIntegration \
	UniversityDatabaseQuerying 

university_template :  UniversityDatabaseWrapping \
	UniversityTemplateIntegration

university_automatic :  UniversityDatabaseWrapping \
	UniversityAutomaticIntegration

university_wrapping :  UniversityDatabaseWrapping 

automatic_integration: DefineMatchedSchemas.class IntegrateMatchedSchemas.class 
	java $(JFLAGS) DefineMatchedSchemas
	java $(JFLAGS) IntegrateMatchedSchemas


bank :  BankDatabaseIntegration

universityreadme :
	cat README.unidemo

reinitreps : DefineRepository.class
	java $(JFLAGS) DefineRepository

models : DefineModels.class
	java $(JFLAGS) DefineModels

schemas : DefineSchemas.class
	java $(JFLAGS) DefineSchemas

transformations : DefineTransformations.class
	java $(JFLAGS) DefineTransformations

erdemo : ERDemo.class
	java $(JFLAGS) ERDemo

UniversityDatabaseWrapping : UniversityDatabaseWrapping.class
	java UniversityDatabaseWrapping \
		-debug ${DEBUG} \
		-user ${DBUSER} \
		-password ${DBPASSWD} \
		-driver ${DBDRIVER} \
		-url ${DBURL}

UniversityDatabaseIntegration : UniversityDatabaseIntegration.class
	java UniversityDatabaseIntegration \
		-debug ${DEBUG} 

UniversityTemplateIntegration : UniversityTemplateIntegration.class
	java UniversityTemplateIntegration \
		-debug ${DEBUG}

UniversityAutomaticIntegration : UniversityAutomaticIntegration.class
	java UniversityAutomaticIntegration \
		-debug ${DEBUG}

UniversityDatabaseQuerying : UniversityDatabaseQuerying.class
	java UniversityDatabaseQuerying \
		-debug ${DEBUG} 

bank-xml-matching : semistructured/xml/XMLBankIntegration.class XMLSchemaMatching.class
	java semistructured.xml.XMLBankIntegration
	java XMLSchemaMatching

BankDatabaseIntegration : BankDatabaseIntegration.class
	java BankDatabaseIntegration \
		-debug ${DEBUG} \
		-user ${DBUSER} \
		-password ${DBPASSWD} \
		-driver ${DBDRIVER} \
		-url ${DBURL}

StudentCourseIntegration : StudentCourseIntegration.class
	java StudentCourseIntegration \
		-debug ${DEBUG} \
		-user ${DBUSER} \
		-password ${DBPASSWD} \
		-driver ${DBDRIVER} \
		-url ${DBURL}

ICDE03 : ICDE03.class
	java ICDE03

ReadICDE03 : ReadMetaData.class
	java ReadMetaData \
		-setFeatures 0 \
		-recreateSQL92Model \
		-debug ${DEBUG} \
		-user ${DBUSER} \
		-password ${DBPASSWD} \
		-driver ${DBDRIVER} \
		-url ${DBURL}ug \
		-schema ug \
		-url ${DBURL}phd \
		-schema phd


#ReadMetaData.class : ReadMetaData.java
#	javac ReadMetaData.java

p2pinitialise :
	java uk.ac.ic.doc.automed.p2p.directory.P2PDirectoryRepository 

p2pdirectory :
	java uk.ac.ic.doc.automed.p2p.directory.P2PDirectory

p2pregistry :
	java uk.ac.ic.doc.automed.p2p.P2PRegistry

templates:
	@cd templates && ./javaenv.sh $(MAKE) basic

templatesdemo:
	@cd templates && ./javaenv.sh $(MAKE) demo

templatesgui:
	@cd templates && ./javaenv.sh $(MAKE) templatesgui

# Added by dmle 11/2006
overlay-viz:
	@cd src/rodex && sh bin/owviz -s localhost:8888 &

overlay-basic: 
	@cd src/rodex && sh bin/overlay

don-with-schema-1:
	@cd src/rodex && sh bin/makeTestDB && sh bin/donWithSchema1

don-with-schema-2:
	@cd src/rodex && sh bin/donWithSchema2	

con-local:
	@cd src/rodex && sh bin/conBasicStandAlone

con-basic:
	@cd src/rodex && sh bin/conBasic

# define a configuration file variable, pass a value through command line
debug_arg =
cfg_arg =
ifneq ($(strip $(cfgfile)),)
	cfg_arg = -c $(cfgfile)
endif
ifneq ($(strip $(debug)),)
	debug_arg = -d $(debug)
endif

dtcdemo1: 
	@cd src/rodex && sh bin/dtcDemo1 -t $(type) $(debug_arg) $(cfg_arg)

clean :
	rm -f oldgui/*.class *.class drawables/*.class *~ \
	semistructured/*.class	semistructured/xml/*.class utils/*.class \
	UGPGStudentsExample/*.class hs_err_pid*.log error_log errors \
	hdmstore/*.class query_processing/*.class caise05/*.class 
	@cd templates && ./javaenv.sh $(MAKE) clean

classes : $(patsubst %.java,%.class,$(wildcard *.java))

%.class : %.java
	javac $(JCCFLAGS) $< 

