47 lines
858 B
Makefile
47 lines
858 B
Makefile
|
# Executable name
|
||
|
EXE=gray
|
||
|
|
||
|
# Objects list
|
||
|
OBJ=gray.o grayl.o green_func_p.o const_and_precisions.o itm_constants.o itm_types.o
|
||
|
|
||
|
# Alternative search paths
|
||
|
vpath %.f90 src
|
||
|
vpath %.f src
|
||
|
|
||
|
# Fortran compiler name and flags
|
||
|
FC=gfortran
|
||
|
FFLAGS=-O3
|
||
|
|
||
|
all: $(EXE)
|
||
|
|
||
|
# Build executable from object files
|
||
|
$(EXE): $(OBJ)
|
||
|
$(FC) $(FFLAGS) -o $@ $^
|
||
|
|
||
|
# Dependencies on modules
|
||
|
green_func_p.o: const_and_precisions.o
|
||
|
const_and_precisions.o: itm_types.o itm_constants.o
|
||
|
itm_constants.o: itm_types.o
|
||
|
|
||
|
# General object compilation command
|
||
|
%.o: %.f90
|
||
|
$(FC) $(FFLAGS) -c $<
|
||
|
|
||
|
gray.o:gray.f green_func_p.o
|
||
|
$(FC) $(FFLAGS) -c $<
|
||
|
|
||
|
grayl.o:grayl.f
|
||
|
$(FC) $(FFLAGS) -c $^
|
||
|
|
||
|
.PHONY: clean install
|
||
|
# 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
|