COMP = gfortran #name of the compiler installed on your computer

SRCS = ./source_code/TwistDNAmain.f90 ./source_code/TwistDNAh.f90 ./source_code/TwistDNAmin.f90 ./source_code/TwistDNAprop.f90 ./source_code/Hptw.f90
OBJS = ./obj/TwistDNAmain.o ./obj/TwistDNAh.o ./obj/TwistDNAmin.o ./obj/TwistDNAprop.o ./obj/Hptw.o
PRGM = TwistDNA

$(PRGM): $(OBJS)
	@$(COMP) -o $(PRGM) $(OBJS);
	@echo "Twist-DNA is compiled. After the first installation, type 'make test' to check up that Twist-DNA works correctly on your computer."

./obj/%.o: ./source_code/%.f90
	@$(COMP) -c $< -o $@

clean:
	@rm -f $(PRGM) ./obj/*.o;
	@echo "Executable and object files deleted."

test: $(PRGM)
	@./$(PRGM) < test/input_test.fasta 2>&1 > /dev/null ; 
	@diff ./outputs/openproba.bed test/output_test.bed > /dev/null  && echo "Test PASSED. Twist-DNA works correctly." || \
	@echo "Test FAILED. Verify you compiler or contact us at daniel.jost@ens-lyon.fr." ;  
	@rm -f ./outputs/openproba.bed ./outputs/bubblethresh.bed ; 
