# Executable name EXE=gray-jintrac LIBFILE=lib$(EXE).a # Objects list OBJ=gray_main.o gray-externals.o grayl.o reflections.o scatterspl.o \ beamdata.o green_func_p.o const_and_precisions.o dispersion.o \ calcei.o dqagmv.o # Alternative search paths vpath %.f90 src vpath %.f src # Fortran compiler name and flags FC=gfortran FFLAGS=-O0 -g -fbounds-check -Wall #FFLAGS=-O3 DIRECTIVES = -DREVISION="'$(shell svnversion)'" all: library # Build executable from object files $(EXE): main.o $(OBJ) $(FC) $(FFLAGS) -o $@ $^ $(LIBFILE): $(OBJ) rm -f $@ ar -rv $@ $^ # Dependencies on modules main.o: const_and_precisions.o gray_main.o: const_and_precisions.o gray-externals.o: green_func_p.o reflections.o beamdata.o dispersion.o green_func_p.o: const_and_precisions.o scatterspl.o: const_and_precisions.o beamdata.o: const_and_precisions.o dispersion.o: calcei.o dqagmv.o # General object compilation command %.o: %.f90 $(FC) $(FFLAGS) -c $< gray-externals.o:gray-externals.f $(FC) -cpp $(DIRECTIVES) $(FFLAGS) -c $< grayl.o:grayl.f $(FC) $(FFLAGS) -c $< .PHONY: library clean install library: $(LIBFILE) # Remove output files clean: rm -rf *.o *.mod $(EXE) install: @if [ -f $(EXE) ]; then \ cp $(EXE) ~/bin/; \ else \ echo File $(EXE) does not exist. Run \'make\' first; \ fi