# Paulo E. Abreu 9 abril 2010
#
# $^ list of all the prerequisites of the rule
# $< just the first prerequisite
# $@ the target
#
#F90=ifort
#FC=${F90}
F90=gfortran
FC=${F90}
F90FLAGS=-O0 -g 
#F90FLAGS=-O2  
FFLAGS=${F90FLAGS}

.PHONY: default clean distclean test

default: enantiomers

enantiomers : enantiomers.o assndx.o calendar.o subroutine-hungarian.o impose-fullassignment.o random.o rotation.o
	${F90} $^  -o $@

#========== Object rules
enantiomers.o: enantiomers.f90	
assndx.o: assndx.f90  		  
calendar.o: calendar.f  		  
hungarian.o: hungarian.f90  		  
subroutine-hungarian.o: subroutine-hungarian.f90  		  
impose-fullassignment.o: impose-fullassignment.f   
random.o: random.f  		  
rotation.o: rotation.f90                  
#========== End Object rules

#========== General rules
%.o: %.f90
	${F90} ${F90FLAGS} -c $<
%.o: %.f
	${FC} ${FFLAGS}  -c $<
#========== End General rules

#========== Test rules
test_dirs=chiralane ClBrbut dibromo helicene simple water
test: enantiomers
	./test.sh
#========== End Test rules

#========== Maintance rules
clean:
	rm -f hungarian *.o *.mod fort.* program-hungarian enantiomers
distclean: clean
	rm -f core.* core *~ teste test_dict pt_dict \#*\#	
	rm -f best.xyz assignment.txt center.xyz
#========== End Maintance rules

#========== Test Executables rules
teste: teste.f90
	${F90} ${F90FLAGS} teste.f90  -o teste

test_dict: test_dict.f90 dictionary.f90 linkedlist.f90
	${F90} $< -o test_dict	

pt_dict:  pt_dict.f90 dictionary.f90 linkedlist.f90
	${F90} $< -o pt_dict	
#========== End Test Executables rules

