33# ###########
44# commands #
55# ###########
6+
67FC = ftn
78CC = cc
89CXX = cc
@@ -13,73 +14,40 @@ LD = ftn $(MAIN_PROGRAM)
1314# ###########
1415
1516DEBUG =
16-
1717MAKEFLAGS += --jobs=8
18+ LDFLAGS :=
1819
19- INCLUDES := $(shell pkg-config --cflags yaml-0.1)
20-
21- # Need to use at least GNU Make version 3.81
22- need := 3.81
23- ok := $(filter $(need ) ,$(firstword $(sort $(MAKE_VERSION ) $(need ) ) ) )
24- ifneq ($(need ) ,$(ok ) )
25- $(error Need at least make version $(need). Load module gmake/3.81)
26- endif
27-
28- # Macro for Fortran preprocessor
29- FPPFLAGS := $(INCLUDES )
30-
31-
32- # Base set of Fortran compiler flags
3320FC_AUTO_R8 = -r8
34- FFLAGS = $(FC_AUTO_R8 ) -Mnofma -i4 -gopt -time -Mextend -byteswapio -Mflushz -Kieee
35-
36- # Flags based on perforance target (production (OPT), reproduction (REPRO), or debug (DEBUG)
37- FFLAGS_REPRO = -O2 -tp=zen3
21+ FPPFLAGS := $(shell pkg-config --cflags yaml-0.1)
22+ FFLAGS = $(FC_AUTO_R8 ) -Mnofma -i4 -gopt -time -Mextend -byteswapio -Mflushz -Kieee
3823FFLAGS_DEBUG = -O0 -g # -Mbounds fails compilation and -KTrap=fp fails run! seems like there is a floating point exception in netcdf_io_mod
39- # Macro for C preprocessor
40- CPPFLAGS := $(INCLUDES )
24+ FFLAGS_REPRO = -O2 -tp=zen3
4125
42-
43- # Base set of C compiler flags
4426CFLAGS = -gopt -time -Mnofma
45-
46- # Flags based on perforance target (production (OPT), reproduction (REPRO), or debug (DEBUG)
47- CFLAGS_REPRO = -O2
48- CFLAGS_DEBUG =
49-
50- # Linking flags
51- LDFLAGS :=
52-
53- # List of -L library directories to be added to the compile and linking commands
54- LIBS :=
27+ CFLAGS_REPRO = -O2
28+ CFLAGS_DEBUG =
29+ CPPFLAGS := $(shell pkg-config --cflags yaml-0.1)
5530
5631# Get compile flags based on target macros.
5732ifeq ($(DEBUG ) ,1)
58- CFLAGS += $(CFLAGS_DEBUG )
59- FFLAGS += $(FFLAGS_DEBUG )
33+ FFLAGS += $(FFLAGS_DEBUG )
34+ CFLAGS += $(CFLAGS_DEBUG )
6035else
61- CFLAGS += $(CFLAGS_REPRO )
62- FFLAGS += $(FFLAGS_REPRO )
36+ FFLAGS += $(FFLAGS_REPRO )
37+ CFLAGS += $(CFLAGS_REPRO )
6338endif
6439
65-
6640# NetCDF Flags
67- # Fortran Compiler flags for the NetCDF library
68- FPPFLAGS += $(shell nf-config --fflags)
69- # C Compiler flags for the NetCDF library
70- CPPFLAGS += $(shell nc-config --cflags)
71- # Add Netcdf linking
72- LIBS += $(shell nc-config --libs) $(shell nf-config --flibs)
41+ FFLAGS += $(shell nf-config --fflags)
42+ CFLAGS += $(shell nc-config --cflags)
43+
7344ifneq ($(findstring -Duse_netCDF,$(CPPDEFS ) ) ,)
74- CPPDEFS += -Duse_LARGEFILE
45+ # add the use_LARGEFILE cppdef
46+ CPPDEFS += -Duse_LARGEFILE
7547endif
7648
77-
78- # These Algebra libraries Add solution to more complex vector matrix model equations
79- LIBS += -llapack -lblas
80-
81- # CESM Linking Flags
82- LDFLAGS += $(LIBS ) -time -Wl,--allow-multiple-definition
49+ # Linking Flags
50+ LDFLAGS += $(shell nc-config --libs) $(shell nf-config --flibs) -llapack -lblas -time -Wl,--allow-multiple-definition
8351
8452# ---------------------------------------------------------------------------
8553# you should never need to change any lines below.
@@ -90,13 +58,13 @@ LDFLAGS += $(LIBS) -time -Wl,--allow-multiple-definition
9058# .f, .f90, .F, .F90. Given a sourcefile <file>.<ext>, where <ext> is one of
9159# the above, this provides a number of default actions:
9260
93- # make <file>.opt create an optimization report
94- # make <file>.o create an object file
95- # make <file>.s create an assembly listing
96- # make <file>.x create an executable file, assuming standalone
97- # source
98- # make <file>.i create a preprocessed file (for .F)
99- # make <file>.i90 create a preprocessed file (for .F90)
61+ # make <file>.opt create an optimization report
62+ # make <file>.o create an object file
63+ # make <file>.s create an assembly listing
64+ # make <file>.x create an executable file, assuming standalone
65+ # source
66+ # make <file>.i create a preprocessed file (for .F)
67+ # make <file>.i90 create a preprocessed file (for .F90)
10068
10169# The macro TMPFILES is provided to slate files like the above for removal.
10270
0 commit comments