Skip to content

Commit 845436d

Browse files
committed
Consistency among ncar make templates
General formatting is the same, the only differences are the actual flags and whatnot used by the different compilers
1 parent 28e1f75 commit 845436d

3 files changed

Lines changed: 53 additions & 91 deletions

File tree

standalone/templates/ncar-gnu.mk

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,53 +3,49 @@
33
############
44
# commands #
55
############
6+
67
FC = mpif90
78
CC = gcc
89
CXX = g++
910
LD = mpif90 $(MAIN_PROGRAM)
1011

11-
#########
12-
# flags #
13-
#########
12+
############
13+
# flags #
14+
############
1415

1516
DEBUG =
16-
1717
MAKEFLAGS += --jobs=$(shell grep '^processor' /proc/cpuinfo | wc -l)
18+
LDFLAGS :=
1819

19-
FPPFLAGS :=
2020
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
21+
FPPFLAGS :=
22+
FFLAGS := $(FC_AUTO_R8) -fconvert=big-endian -ffree-line-length-none -ffixed-line-length-none -fallow-argument-mismatch -fallow-invalid-boz -fcray-pointer
2223
FFLAGS_REPRO = -O
2324
FFLAGS_DEBUG = -g -Wall -Og -fbacktrace -ffpe-trap=zero,overflow -fcheck=bounds
2425

25-
2626
CFLAGS := -std=gnu99
2727
CFLAGS_REPRO = -O
2828
CFLAGS_DEBUG = -g -Wall -Og -fbacktrace -ffpe-trap=invalid,zero,overflow -fcheck=bounds
2929

30-
LDFLAGS :=
31-
32-
3330
ifeq ($(DEBUG),1)
34-
CFLAGS += $(CFLAGS_DEBUG)
35-
FFLAGS += $(FFLAGS_DEBUG)
31+
FFLAGS += $(FFLAGS_DEBUG)
32+
CFLAGS += $(CFLAGS_DEBUG)
3633
else
37-
CFLAGS += $(CFLAGS_REPRO)
38-
FFLAGS += $(FFLAGS_REPRO)
34+
FFLAGS += $(FFLAGS_REPRO)
35+
CFLAGS += $(CFLAGS_REPRO)
3936
endif
4037

41-
4238
# NetCDF Flags
4339
FFLAGS += -I$(shell nc-config --includedir)
4440
CFLAGS += -I$(shell nc-config --includedir)
45-
# add the use_LARGEFILE cppdef
41+
4642
ifneq ($(findstring -Duse_netCDF,$(CPPDEFS)),)
47-
CPPDEFS += -Duse_LARGEFILE
43+
# add the use_LARGEFILE cppdef
44+
CPPDEFS += -Duse_LARGEFILE
4845
endif
4946

5047
# Linking Flags
51-
LIBS := $(shell nf-config --flibs) $(shell pkg-config --libs mpich2-f90)
52-
LDFLAGS += $(LIBS)
48+
LDFLAGS += $(shell nf-config --flibs) $(shell pkg-config --libs mpich2-f90)
5349

5450
#---------------------------------------------------------------------------
5551
# you should never need to change any lines below.

standalone/templates/ncar-intel.mk

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
############
44
# commands #
55
############
6+
67
FC = mpif90
78
CC = mpicc
89
CXX = icpc
@@ -12,43 +13,40 @@ LD = mpif90
1213
# flags #
1314
############
1415

15-
DEBUG =
16-
# Default set to REPRODUCIBLE
17-
16+
DEBUG =
1817
MAKEFLAGS += --jobs=8
18+
LDFLAGS :=
1919

2020
FC_AUTO_R8 := -r8
2121
FPPFLAGS := -fpp -Wp,-w
22-
FFLAGS := -qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model source -no-fma -qopt-report -march=core-avx2 $(FC_AUTO_R8)
22+
FFLAGS := $(FC_AUTO_R8) -qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model source -no-fma -qopt-report -march=core-avx2
2323
FFLAGS_DEBUG = -O0 -g -check uninit -check bounds -check nopointer -fpe0 -check noarg_temp_created # CESM uses -check pointers, that throws an error, changed to nopointer
2424
FFLAGS_REPRO = -O2 -debug minimal
2525

2626
CFLAGS := -qno-opt-dynamic-align -fp-model precise -std=gnu99 -no-fma -qopt-report -march=core-avx2
27-
CFLAGS += -I$(NETCDF_PATH)/include
2827
CFLAGS_REPRO= -O2 -debug minimal
2928
CFLAGS_DEBUG = -O0 -g
30-
LDFLAGS :=
3129

3230
ifeq ($(DEBUG),1)
33-
CFLAGS += $(CFLAGS_DEBUG)
3431
FFLAGS += $(FFLAGS_DEBUG)
32+
CFLAGS += $(CFLAGS_DEBUG)
3533
else
3634
FFLAGS += $(FFLAGS_REPRO)
3735
CFLAGS += $(CFLAGS_REPRO)
3836
endif
3937

40-
# Add Net CDF Flags
38+
# NetCDF Flags
4139
FFLAGS += -I$(shell nf-config --includedir)
42-
# add the use_LARGEFILE cppdef
40+
CFLAGS += -I$(NETCDF_PATH)/include
41+
4342
ifneq ($(findstring -Duse_netCDF,$(CPPDEFS)),)
43+
# add the use_LARGEFILE cppdef
4444
CPPDEFS += -Duse_LARGEFILE
4545
endif
46+
CPPDEFS += -D__IFC
4647

47-
CPPDEFS := $(CPPDEFS) -D__IFC
48-
# Add netcdf linking
49-
LIBS := $(shell nc-config --libs) $(shell nf-config --flibs)
50-
51-
LDFLAGS += $(LIBS)
48+
# Linking Flags
49+
LDFLAGS += $(shell nc-config --libs) $(shell nf-config --flibs)
5250

5351
#---------------------------------------------------------------------------
5452
# you should never need to change any lines below.

standalone/templates/ncar-nvhpc.mk

Lines changed: 26 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
############
44
# commands #
55
############
6+
67
FC = ftn
78
CC = cc
89
CXX = cc
@@ -13,73 +14,40 @@ LD = ftn $(MAIN_PROGRAM)
1314
############
1415

1516
DEBUG =
16-
1717
MAKEFLAGS += --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
3320
FC_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
3823
FFLAGS_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
4426
CFLAGS = -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.
5732
ifeq ($(DEBUG),1)
58-
CFLAGS += $(CFLAGS_DEBUG)
59-
FFLAGS += $(FFLAGS_DEBUG)
33+
FFLAGS += $(FFLAGS_DEBUG)
34+
CFLAGS += $(CFLAGS_DEBUG)
6035
else
61-
CFLAGS += $(CFLAGS_REPRO)
62-
FFLAGS += $(FFLAGS_REPRO)
36+
FFLAGS += $(FFLAGS_REPRO)
37+
CFLAGS += $(CFLAGS_REPRO)
6338
endif
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+
7344
ifneq ($(findstring -Duse_netCDF,$(CPPDEFS)),)
74-
CPPDEFS += -Duse_LARGEFILE
45+
# add the use_LARGEFILE cppdef
46+
CPPDEFS += -Duse_LARGEFILE
7547
endif
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

Comments
 (0)