# Makefile
#
# pour activer certaines options :
#
#  'LINK=dynamic'  [default] : shared libraries used (MUESLI, LAPACK, BLAS, HDF5_FORTRAN)
#  'LINK=static'             : archived libraries used
#
#-----------------------------------------------------------------------

PROGS = test_muesli_config_fml

FGL=$(shell muesli-config --graphic-part)
ifeq '$(FGL)' 'yes'
  PROGS += test_muesli_config_fgl
endif

F90C=`muesli-config --f90compiler`

F90FLAGS=`muesli-config --f90flags`

ifeq '$(LINK)' 'static'
  LIBS=`muesli-config --libs-static`
else # 'dynamic'
  LIBS=`muesli-config --libs`
endif

#-----------------------------------------------------------------------

all : $(PROGS)

test_muesli_config_fml : test_muesli_config_fml.o
	$(F90C) -o $@ $< $(LIBS)

test_muesli_config_fgl : test_muesli_config_fgl.o
	$(F90C) -o $@ $< $(LIBS)

#------------------------------- rules ---------------------------------

.SUFFIXES :
.SUFFIXES : .f90 .o

%.o : %.f90
	$(F90C) $(F90FLAGS) -c $<

clean :
	rm -f *.o

distclean : clean
	rm -f $(PROGS) *.out *.prof
	rm -f .mf_win_pos_db .*.mf_win_pos_db
