mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 13:45:36 -04:00
Added option for compiler in Makefile and made compiler flags dependent on which compiler one is using.
This commit is contained in:
parent
0c57193b38
commit
9400e46786
1 changed files with 44 additions and 6 deletions
50
src/Makefile
50
src/Makefile
|
|
@ -10,6 +10,7 @@ include OBJECTS
|
|||
# User Options
|
||||
#===============================================================================
|
||||
|
||||
COMPILER = intel
|
||||
DEBUG = no
|
||||
PROFILE = no
|
||||
OPTIMIZE = no
|
||||
|
|
@ -21,35 +22,72 @@ USE_COARRAY = no
|
|||
# Compiler Options
|
||||
#===============================================================================
|
||||
|
||||
F90 = ifort
|
||||
F90FLAGS = -cpp -warn
|
||||
LDFLAGS =
|
||||
# Set default compiler options
|
||||
|
||||
F90 = gfortran
|
||||
F90FLAGS = -cpp
|
||||
|
||||
# Intel Fortran compiler options
|
||||
|
||||
ifeq ($(COMPILER),intel)
|
||||
F90 = ifort
|
||||
F90FLAGS = -fpp -warn
|
||||
endif
|
||||
|
||||
# GNU Fortran compiler options
|
||||
|
||||
ifeq ($(COMPILER),gfortran)
|
||||
F90 = gfortran
|
||||
F90FLAGS = -cpp -Wall
|
||||
endif
|
||||
|
||||
# Set compiler flags for debugging
|
||||
|
||||
ifeq ($(DEBUG),yes)
|
||||
F90FLAGS += -g -traceback -ftrapuv -fp-stack-check -check all
|
||||
F90FLAGS += -g
|
||||
LDFLAGS += -g
|
||||
ifeq ($(COMPILER),intel)
|
||||
F90FLAGS += -traceback -ftrapuv -fp-stack-check -check all
|
||||
endif
|
||||
ifeq ($(COMPILER),gfortran)
|
||||
F90FLAGS += -pedantic -std=f2003 -fbacktrace -fbounds-check \
|
||||
-ffpe-trap=invalid,zero,overflow,underflow
|
||||
endif
|
||||
endif
|
||||
|
||||
# Set compiler flags for profiling
|
||||
|
||||
ifeq ($(PROFILE),yes)
|
||||
F90FLAGS += -pg
|
||||
LDFLAGS += -pg
|
||||
endif
|
||||
|
||||
# Set compiler flags for high optimization
|
||||
|
||||
ifeq ($(OPTIMIZE),yes)
|
||||
F90FLAGS += -ipo -O3
|
||||
F90FLAGS += -O3
|
||||
ifeq ($(COMPILER),intel)
|
||||
F90FLAGS += -ipo
|
||||
endif
|
||||
endif
|
||||
|
||||
# Use MPI for parallelism
|
||||
|
||||
ifeq ($(USE_MPI),yes)
|
||||
MPI = /opt/mpich2/1.4-intel
|
||||
F90 = $(MPI)/bin/mpif90
|
||||
F90FLAGS += -DMPI
|
||||
endif
|
||||
|
||||
# Use OpenMP for shared-memory parallelism
|
||||
|
||||
ifeq ($(USE_OPENMP),yes)
|
||||
F90FLAGS += -openmp
|
||||
LDFLAGS += -openmp
|
||||
endif
|
||||
|
||||
# Use Fortran 2008 Coarrays for parallelism
|
||||
|
||||
ifeq ($(USE_COARRAY),yes)
|
||||
F90FLAGS += -coarray
|
||||
endif
|
||||
|
|
@ -74,7 +112,7 @@ neat:
|
|||
.PHONY: all clean neat
|
||||
|
||||
%.o: %.f90
|
||||
$(F90) -c $(F90FLAGS) $<
|
||||
$(F90) $(F90FLAGS) -c $<
|
||||
|
||||
#===============================================================================
|
||||
# Dependencies
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue