
#
include	$(CORALROOT)/make_include
#

MAKE=make

#
#
CORALBIN=$(CORALROOT)/bin/MIPS
#
#CORALBIN=$(CORALROOT)/bin/SUN4
#
#

#############################
#
#  To install the system with the distributed executables
#  choose CORALBIN appropriately above, and then type 
#     make
#  To install and compile the system form src code , type
#     make install
#  To recompile an already set up system type
#    make recompile. 
#
#############################
exec:
	(cd bin; ln -s $(CORALBIN)/coral .; ln -s $(CORALBIN)/magic .; \
		 ln -s $(CORALBIN)/exist .; ln -s $(CORALBIN)/translator .;\
		 ln -s $(CORALBIN)/Explain .;\
		 chmod a+x start-server *.CORAL;)
	(cd EXAMPLES; chmod a+x test_suite; ln -s $(CORALROOT)/doc/manual/examples MORE_EXAMPLES)
	(cd doc/manual/examples; chmod a+x test_suite)

install: compile
	(cd bin; ln -s $(CORALROOT)/src/coral .; ln -s $(CORALROOT)/magic/magic .; \
		 ln -s $(CORALROOT)/magic/exist .; ln -s $(CORALROOT)/interface/translator .;\
		 chmod a+x start-server *.CORAL;)
	(cd EXAMPLES; chmod a+x test_suite; ln -s $(CORALROOT)/doc/manual/examples MORE_EXAMPLES)
	(cd doc/manual/examples; chmod a+x test_suite)

recompile: 
	(cd bignum; $(MAKE))
	(cd magic; $(MAKE))
	(cd src; $(MAKE))
	(cd interface; $(MAKE))

compile: dependency recompile
	echo "done compiling coral"

dependency:
	cd src; chmod u+w Makefile; make depend
	cd magic; chmod u+w Makefile; make depend
	cd persist; chmod u+w Makefile; make depend
	cd interface; chmod u+w Makefile; make depend
	cd bignum; rm -f Makefile; /lib/cpp -P cpp-Makefile > Makefile

clean:  
	cd bignum; make clean;
	cd persist; make clean
	cd includes; rm -f *~
	cd interface; make clean
	cd magic; make clean
	cd src; make clean
	#cd EXAMPLES; rm -f *~ *.M core; rm -rf testdata; rm -rf testdiff
	#cd doc/manual/examples; rm -f *~ *.M core; rm -rf testdata; rm -rf testdiff


