gray/Makefile

110 lines
2.6 KiB
Makefile

# Makefile for JETTO fortran 90 library 'gray'
# Author: Lorenzo Figini (figini@ifp.cnr.it)
#
# Derived from
# Makefile for JETTO fortran 77 library 'frantic'
# Author: Derek Harting (d.harting@fz-juelich.de)
# and
# Makefile for ITCequ Fortran 90 library - definitions
# P. Strand, elfps@chalmers.se
# G. Corrigan, gcor@jet.uk
# D. Harting, d.harting@fz-juelich.de
# Set the environment from the top-level Makefile of JETTO
# --------------------------------------------------------
include ../include.mk
# library name
# ------------
LIBNAME=$(JLIBDIR)/libgray.a
# List source and object files
# ----------------------------
FSRC=$(wildcard *.f *.f90)
FOBJ0=$(FSRC:.f=.o)
FOBJ=$(FOBJ0:.f90=.o)
########################################
# Set up compiler specific environment #
########################################
# set default compiler
# --------------------
FC=$(F90)
# Set compiler debug and optimization flags
# -----------------------------------------
ifeq ("$(DBG)","")
FFLAGS= $(AUTO) -O3
else
FFLAGS= $(AUTO) -O0 -g -Minform=inform -Mbounds -Mchkptr
endif
# Set include directories
# -----------------------
#INC=-I$(JCOMMON_STD)
INC=
#####################################
# Set up RULES specific environment #
#####################################
# suffixes
# --------
.SUFFIXES: .f90 .f .o .mod
# PHONY targets
# -------------
.PHONY: all clean realclean $(MASTER_RULES) gray
# default target
# --------------
all:
@($(MAKE) -C ../ all) || exit $$?
# Set rules passed to top-level Makefile
# --------------------------------------
$(MASTER_RULES):
@($(MAKE) -C ../ $@) || exit $$?
# rule for libgray.a
# --------------------
$(LIBNAME): $(FOBJ)
ar vr $(LIBNAME) $?
# synonym for libgray.a
# -----------------------
gray: $(LIBNAME)
# create rule for compiling f90 files
# -----------------------------------
%.o: %.f90
$(FC) -c $(FFLAGS) $(INC) $<
# create rule for compiling f files
# ---------------------------------
%.o: %.f
$(FC) -c $(FFLAGS) $(INC) $<
# make 'realclean' option
# -----------------------
realclean:
rm -f *.o *.mod $(LIBNAME)
# make 'clean' option
# -------------------
clean:
rm -f *.o
# Dependencies
# ------------
gray_main.o: const_and_precisions.o
gray-externals.o: green_func_p.o reflections.o beamdata.o const_and_precisions.o
green_func_p.o: const_and_precisions.o
scatterspl.o: const_and_precisions.o
beamdata.o: const_and_precisions.o
# Special rule to preprocess source file and include svn revision
# ---------------------------------------------------------------
DIRECTIVES = -DREVISION="'$(shell svnversion)'"
gray-externals.o:gray-externals.f
$(FC) -c -Mpreprocess $(DIRECTIVES) $(FFLAGS) $(INC) $<