Skip to content

Commit b62a763

Browse files
committed
Merge branch 'framework/fix_pio_lib_checks_v7.0' into hotfix-v7.1 (PR #914)
This merge updates the logic that is used to add the PIO library to the definition of LIBS in the top-level Makefile so that the libpio.settings file found in newer PIO 2 releases (beginning around PIO 2.5.2) is ignored. Without the changes in this merge, builds that reference the latest PIO library will fail with the message Checking for a usable PIO library... ************ ERROR ************ Failed to compile a PIO test program Please ensure the PIO environment variable is set to the PIO installation directory ************ ERROR ************ Note: This merge contains identical changes to PR #707, but this merge is based off of the v7.0 tag and targets the hotfix-v7.1 branch.
2 parents 1b72275 + 5c1c925 commit b62a763

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

Makefile

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
MODEL_FORMULATION =
1+
MODEL_FORMULATION =
22

33

44
dummy:
@@ -421,9 +421,9 @@ llvm:
421421
"OPENMP = $(OPENMP)" \
422422
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )
423423

424-
CPPINCLUDES =
425-
FCINCLUDES =
426-
LIBS =
424+
CPPINCLUDES =
425+
FCINCLUDES =
426+
LIBS =
427427

428428
#
429429
# If user has indicated a PIO2 library, define USE_PIO2 pre-processor macro
@@ -458,9 +458,15 @@ endif
458458
# Depending on PIO version, libraries may be libpio.a, or libpiof.a and libpioc.a
459459
# Keep open the possibility of shared libraries in future with, e.g., .so suffix
460460
#
461+
# Check if libpio.* exists and link -lpio if so, but we make an exception for
462+
# libpio.settings (a file added in PIO2), which is not a library to link
461463
ifneq ($(wildcard $(PIO_LIB)/libpio\.*), )
462-
LIBS += -lpio
464+
# Makefiles don't support "and" operators so we have nested "if" instead
465+
ifneq "$(wildcard $(PIO_LIB)/libpio\.*)" "$(PIO_LIB)/libpio.settings"
466+
LIBS += -lpio
467+
endif
463468
endif
469+
464470
ifneq ($(wildcard $(PIO_LIB)/libpiof\.*), )
465471
LIBS += -lpiof
466472
endif

0 commit comments

Comments
 (0)