2012-06-21 14:38:29 +02:00
|
|
|
# Executable name
|
|
|
|
EXE=gray
|
|
|
|
|
|
|
|
# Objects list
|
2015-11-18 17:34:33 +01:00
|
|
|
MAINOBJ=main.o
|
|
|
|
OTHOBJ= beamdata.o beams.o conical.o const_and_precisions.o coreprofiles.o \
|
2015-11-23 18:55:27 +01:00
|
|
|
dierckx.o dispersion.o eccd.o eierf.o errcodes.o graycore.o \
|
2019-03-26 15:21:22 +01:00
|
|
|
gray_params.o equilibrium.o limiter.o magsurf_data.o math.o minpack.o multipass.o \
|
|
|
|
numint.o pec.o polarization.o quadpack.o reflections.o simplespline.o units.o utils.o
|
2015-11-18 17:34:33 +01:00
|
|
|
|
2012-06-21 14:38:29 +02:00
|
|
|
# Alternative search paths
|
|
|
|
vpath %.f90 src
|
|
|
|
vpath %.f src
|
|
|
|
|
|
|
|
# Fortran compiler name and flags
|
|
|
|
FC=gfortran
|
2019-12-09 15:49:37 +01:00
|
|
|
LD=gfortran
|
|
|
|
FFLAGS=-O3 -fPIC
|
|
|
|
LDFLAGS= -static-libgfortran -static-libgcc
|
|
|
|
# LDFLAGS= -static-libgfortran -lgfortran -lgcc -lSystem -nodefaultlibs
|
|
|
|
LIBS= /usr/local/lib/libquadmath.a
|
|
|
|
# FFLAGS=-Wall -g -finit-real=nan -ffpe-trap=invalid -fcheck=all -fbounds-check
|
2012-06-21 14:38:29 +02:00
|
|
|
|
2022-02-01 16:22:33 +01:00
|
|
|
##
|
|
|
|
## Git information (used in the version string)
|
|
|
|
##
|
|
|
|
|
|
|
|
# Short hash of the latest commit
|
|
|
|
GIT_REV ?= $(shell git rev-parse --short HEAD)
|
|
|
|
|
|
|
|
# Whether the worktree and the latest commit differs
|
|
|
|
GIT_DIRTY ?= $(shell test -n "$$(git status --porcelain)" && echo "-dirty")
|
|
|
|
|
|
|
|
DIRECTIVES = -DREVISION=\"$(GIT_REV)$(GIT_DIRTY)\" -DPREFIX=\"$(PREFIX)\"
|
2012-06-29 15:53:20 +02:00
|
|
|
|
2012-06-21 14:38:29 +02:00
|
|
|
all: $(EXE)
|
|
|
|
|
|
|
|
# Build executable from object files
|
2015-11-18 17:34:33 +01:00
|
|
|
$(EXE): $(MAINOBJ) $(OTHOBJ)
|
2019-12-09 15:49:37 +01:00
|
|
|
$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
|
2012-06-21 14:38:29 +02:00
|
|
|
|
|
|
|
# Dependencies on modules
|
2015-11-18 17:34:33 +01:00
|
|
|
main.o: const_and_precisions.o beams.o coreprofiles.o equilibrium.o \
|
|
|
|
graycore.o gray_params.o reflections.o
|
|
|
|
graycore.o: const_and_precisions.o beamdata.o beams.o coreprofiles.o \
|
2015-11-23 18:55:27 +01:00
|
|
|
dispersion.o eccd.o equilibrium.o errcodes.o gray_params.o \
|
2019-03-26 15:21:22 +01:00
|
|
|
pec.o polarization.o limiter.o units.o utils.o reflections.o multipass.o
|
2015-11-18 17:34:33 +01:00
|
|
|
beams.o: const_and_precisions.o dierckx.o reflections.o simplespline.o utils.o
|
|
|
|
beamdata.o: const_and_precisions.o gray_params.o
|
|
|
|
conical.o: const_and_precisions.o
|
|
|
|
coreprofiles.o: const_and_precisions.o dierckx.o gray_params.o simplespline.o \
|
|
|
|
utils.o
|
|
|
|
dierckx.o: const_and_precisions.o
|
2015-11-19 19:20:58 +01:00
|
|
|
dispersion.o: const_and_precisions.o eierf.o errcodes.o math.o quadpack.o
|
|
|
|
eccd.o: const_and_precisions.o conical.o dierckx.o errcodes.o magsurf_data.o \
|
|
|
|
numint.o
|
2015-11-18 17:34:33 +01:00
|
|
|
eierf.o: const_and_precisions.o
|
2015-11-19 19:20:58 +01:00
|
|
|
errcodes.o: const_and_precisions.o
|
2015-11-18 17:34:33 +01:00
|
|
|
gray_params.o: const_and_precisions.o utils.o
|
2015-11-23 18:55:27 +01:00
|
|
|
equilibrium.o: const_and_precisions.o dierckx.o limiter.o minpack.o \
|
|
|
|
reflections.o simplespline.o utils.o gray_params.o
|
2015-11-18 17:34:33 +01:00
|
|
|
magsurf_data.o: const_and_precisions.o gray_params.o equilibrium.o dierckx.o \
|
2015-11-23 18:55:27 +01:00
|
|
|
reflections.o simplespline.o units.o utils.o
|
2015-11-18 17:34:33 +01:00
|
|
|
math.o: const_and_precisions.o
|
|
|
|
minpack.o: const_and_precisions.o
|
2019-03-26 15:21:22 +01:00
|
|
|
multipass.o: const_and_precisions.o beamdata.o equilibrium.o gray_params.o \
|
|
|
|
polarization.o reflections.o
|
2015-11-18 17:34:33 +01:00
|
|
|
numint.o: const_and_precisions.o
|
|
|
|
pec.o: const_and_precisions.o beamdata.o equilibrium.o gray_params.o \
|
|
|
|
magsurf_data.o utils.o
|
|
|
|
polarization.o: const_and_precisions.o
|
|
|
|
quadpack.o: const_and_precisions.o
|
2015-11-23 18:55:27 +01:00
|
|
|
reflections.o: const_and_precisions.o limiter.o utils.o
|
2015-11-18 17:34:33 +01:00
|
|
|
simplespline.o: const_and_precisions.o
|
|
|
|
utils.o: const_and_precisions.o
|
2012-06-21 14:38:29 +02:00
|
|
|
|
|
|
|
# General object compilation command
|
|
|
|
%.o: %.f90
|
2015-11-18 17:34:33 +01:00
|
|
|
$(FC) -cpp $(DIRECTIVES) $(FFLAGS) -c $<
|
2012-06-21 14:38:29 +02:00
|
|
|
|
|
|
|
.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
|