11# template for the GNU fortran compiler
2- #
3- # typical use with mkmf
4- # mkmf -t linux-gnu.mk -c"-Duse_libMPI -Duse_netCDF" path_names /usr/local/include
52
63# ###########
74# commands #
@@ -15,27 +12,23 @@ LD = mpif90 $(MAIN_PROGRAM)
1512# flags #
1613# ########
1714
18- DEBUG = 0
19-
15+ DEBUG =
16+
2017MAKEFLAGS += --jobs=$(shell grep '^processor' /proc/cpuinfo | wc -l)
2118
2219FPPFLAGS :=
20+ FC_AUTO_R8 := -fdefault-real-8 -fdefault-double-8
21+ FFLAGS := $(FC_AUTO_R8 ) -fconvert=big-endian -ffree-line-length-none -ffixed-line-length-none -fallow-argument-mismatch -fallow-invalid-boz -fcray-pointer
22+ FFLAGS_REPRO = -O
23+ FFLAGS_DEBUG = -g -Wall -Og -fbacktrace -ffpe-trap=zero,overflow -fcheck=bounds
2324
24- FFLAGS := -fcray-pointer -fdefault-double-8 -fdefault-real-8 -Waliasing -ffree-line-length-none -fno-range-check -fallow-argument-mismatch
25- FFLAGS += $(shell pkg-config --cflags-only-I mpich2-c)
26- FFLAGS_REPRO = -O2 -fbounds-check
27- FFLAGS_DEBUG = -O0 -g -W -fbounds-check -fbacktrace -ffpe-trap=invalid,zero,overflow
28-
29- CFLAGS := -D__IFC
30-
31- CFLAGS += $(shell pkg-config --cflags-only-I mpich2-c)
32- CFLAGS_REPRO = -O2
33- CFLAGS_DEBUG = -O0 -g
3425
26+ CFLAGS := -std=gnu99
27+ CFLAGS_REPRO = -O
28+ CFLAGS_DEBUG = -g -Wall -Og -fbacktrace -ffpe-trap=invalid,zero,overflow -fcheck=bounds
3529
3630LDFLAGS :=
3731
38- ifneq ($(REPRO ) ,)
3932
4033ifeq ($(DEBUG ) ,1)
4134CFLAGS += $(CFLAGS_DEBUG )
@@ -45,13 +38,16 @@ CFLAGS += $(CFLAGS_REPRO)
4538FFLAGS += $(FFLAGS_REPRO )
4639endif
4740
41+
42+ # NetCDF Flags
4843FFLAGS += -I$(shell nc-config --includedir)
4944CFLAGS += -I$(shell nc-config --includedir)
5045 # add the use_LARGEFILE cppdef
51- ifneq ($(findstring -Duse_netCDF,$(CPPDEFS)),)
46+ ifneq ($(findstring -Duse_netCDF,$(CPPDEFS ) ) ,)
5247 CPPDEFS += -Duse_LARGEFILE
53- endif
48+ endif
5449
50+ # Linking Flags
5551LIBS := $(shell nf-config --flibs) $(shell pkg-config --libs mpich2-f90)
5652LDFLAGS += $(LIBS )
5753
0 commit comments