include make.inc


all: library 
justtest: copie gen test
reallyall: copie gen genindepth test

source:
	cd $(SRC_DIR) && $(ROOT_DIR)/script/cwrapper_generator.pl $(LASRCDIR)/*.f $(LASRCDIR)/../INSTALL/*lsame.f $(LASRCDIR)/../INSTALL/*lamch.f $(LASRCDIR)/../INSTALL/*sec*_$(TIMER).f
	cd $(SRC_DIR) && $(ROOT_DIR)/script/make_make_src.pl
	cp $(SRC_DIR)/pregen_src/src/* $(SRC_DIR)
	cd $(SRC_DIR) && make
	cd $(ROOT_DIR)

library:
	cd $(SRC_DIR) && make && cd $(ROOT_DIR)

copie:
	rm -f $(TEST_MAIN)/EIG/*.f $(TEST_MAIN)/LIN/*.f $(TEST_MAIN)/MATGEN/*.f
	@echo "--> Copying Testing in testing/main"
	cp $(LASRCDIR)/../TESTING/EIG/*.f $(TEST_MAIN)/EIG
	cp $(LASRCDIR)/../TESTING/LIN/*.f $(TEST_MAIN)/LIN
	cp $(LASRCDIR)/../TESTING/MATGEN/*.f $(TEST_MAIN)/MATGEN
	cp $(LASRCDIR)/../TESTING/*.in $(TEST_MAIN)
	@echo "..."

gen:
	@echo "--> updates the testing routines from LAPACK"
	cd $(ROOT_DIR)/script && ./update_testing.sh
	@echo "--> Check length ..."
	cd $(ROOT_DIR)/script &&./check_length.pl `find $(ROOT_DIR)/testing/main/ -name "*.f"`

test:	
	cd $(TEST_MAIN)/MATGEN && make && cd $(TEST_MAIN) && make

genindepth:
	@echo "--> HACK routines from LAPACK"
	script/testing_in_depth/update_testing.sh
# (TO BE TESTED)
	$(ROOT_DIR)/script//testing_in_depth/update_testing_char.sh 
# (TO BE TESTED)
	$(ROOT_DIR)/script//testing_in_depth/update_testing_xerbla.sh 
	$(ROOT_DIR)/script//check_length.pl `find $(ROOT_DIR)testing/lapack_cprefix -name "*.f"`

testindepth:
	cd $(TEST_LAPACK_CPREFIX)/lapack/SRC && make
	cd $(TEST_WRAPPER) && $(ROOT_DIR)/script/make_make_src.pl && make

example:
	cd $(EXAMPLE_DIR) && make

clean :
	make -C src clean
