Skip to content
This repository was archived by the owner on Aug 13, 2025. It is now read-only.

Commit d8f9fdc

Browse files
Correctly handle case when netcdf-c and netcdf-fortran libraries are installed in different places.
1 parent 2cca39d commit d8f9fdc

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Makefile.cesm

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ ifdef NETCDF_C_PATH
152152
ifndef LIB_NETCDF_FORTRAN
153153
LIB_NETCDF_FORTRAN:=$(NETCDF_C_PATH)/lib
154154
endif
155-
else ifdef NETCDF_FORTRAN_PATH
155+
FFLAGS += -I$(INC_NETCDF_FORTRAN)
156+
CFLAGS += -I$(INC_NETCDF_C)
157+
else ifdef NETCDF_FORTRAN_PATH
156158
$(error "NETCDF_FORTRAN_PATH specified without NETCDF_C_PATH")
157159
else ifdef NETCDF_PATH
158160
NETCDF_SEPARATE:=false
@@ -162,6 +164,8 @@ ifdef NETCDF_C_PATH
162164
ifndef LIB_NETCDF
163165
LIB_NETCDF:=$(NETCDF_PATH)/lib
164166
endif
167+
FFLAGS += -I$(INC_NETCDF)
168+
CFLAGS += -I$(INC_NETCDF)
165169
else
166170
# No Netcdf is an error unless target is clean or DEP
167171
ifneq ($(MAKECMDGOALS), db_files)
@@ -172,8 +176,6 @@ else
172176
endif
173177
endif
174178
endif
175-
FFLAGS += -I$(INC_NETCDF)
176-
CFLAGS += -I$(INC_NETCDF)
177179

178180
# Set HAVE_SLASHPROC on LINUX systems which are not bluegene or Darwin (OSx)
179181

0 commit comments

Comments
 (0)