Skip to content

Commit 37b1901

Browse files
committed
260302.123021.CST [skip ci] revise again Makefile.common ando test_flang.yml
1 parent 226f6d1 commit 37b1901

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

.github/workflows/test_flang.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ jobs:
9494
ARCH=$(flang -dumpmachine | cut -d- -f1)
9595
echo "Flang target architecture: ${ARCH}"
9696
echo "Looking for clang_rt.builtins*${ARCH} in /c/Program Files/LLVM/lib"
97-
find "/c/Program Files/LLVM/lib" -name clang_rt.builtins*${ARCH}* 2>/dev/null || echo "clang_rt.builtins*${ARCH} not found!!"
98-
echo "Looking for clang_rt.builtins* in /c/Program Files/LLVM/lib (the first one found will be printed)"
99-
find "/c/Program Files/LLVM/lib" -name "clang_rt.builtins*" -print -quit 2>/dev/null || echo "clang_rt.builtins not found!!"
97+
find "/c/Program Files/LLVM/lib" -name clang_rt.builtins*$(ARCH)* 2>/dev/null | sort -V | tail -n 1 || echo "clang_rt.builtins*${ARCH} not found!!"
98+
echo "Looking for clang_rt.builtins* in /c/Program Files/LLVM/lib (the last one found will be printed)"
99+
find "/c/Program Files/LLVM/lib" -name "clang_rt.builtins*" 2>/dev/null | sort -V | tail -n 1 || echo "clang_rt.builtins not found!!"
100100
echo "Looking for clang_rt.builtins* in /c/Program Files/LLVM/lib (all found will be printed)"
101101
find "/c/Program Files/LLVM/lib" -name "clang_rt.builtins*" 2>/dev/null || echo "clang_rt.builtins not found!!"
102102

fortran/examples/Makefile.common

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ MFORT := "$(shell command -v amdflang)"
1010
mtest: FC := $(MFORT) -std=f$(FSTD)
1111

1212
# AMD AOCC Flang
13-
DFORT := "$(shell find -L /opt/AMD -type f -name flang -exec test -x {} \; -print 2> /dev/null | sort | tail -n 1)"
13+
DFORT := "$(shell find -L /opt/AMD -type f -name flang -exec test -x {} \; -print 2> /dev/null | sort -V | tail -n 1)"
1414
dtest: FC := $(DFORT) -Wall -Wextra -std=f$(FSTD) -Mstandard
1515

1616
# LLVM Flang
1717
# Note that AOMP and AOCC also provide "flang". We define FFORT as follows to make sure the correct
1818
# one is being called. Otherwise, flang may be resolved to the one provided by AOMP or AOCC, which
1919
# did happen in our tests.
20-
FFORT := "$(shell find -L /usr/local/llvm* /usr/lib/llvm* /opt/homebrew /usr/local/opt /usr/local/Cellar -type f -name flang -exec test -x {} \; -print 2>/dev/null | sort | tail -n 1)"
20+
FFORT := "$(shell find -L /usr/local/llvm* /usr/lib/llvm* /opt/homebrew /usr/local/opt /usr/local/Cellar -type f -name flang -exec test -x {} \; -print 2>/dev/null | sort -V | tail -n 1)"
2121
# If the above command fail to find flang (it happens on Windows), we try setting FFORT manually.
2222
ifeq ($(FFORT),"") # The quotation marks are necessary
2323
FFORT := "$(shell command -v flang)"
@@ -27,10 +27,10 @@ ifeq ($(OS),Windows_NT)
2727
# Architecture part of the target triple, e.g., "x86_64" or "aarch64".
2828
ARCH := $(shell $(FFORT) -dumpmachine | cut -d- -f1)
2929
# Note the quotation marks to handle spaces in the path.
30-
CLANGRT := "$(shell find "/c/Program Files/LLVM/lib" -name clang_rt.builtins*$(ARCH)* 2>/dev/null)"
30+
CLANGRT := "$(shell find "/c/Program Files/LLVM/lib" -name clang_rt.builtins*$(ARCH)* 2>/dev/null | sort -V | tail -n 1)"
3131
# In case nothing is found above, we try clang_rt without the architecture part
3232
ifeq ($(CLANGRT),"")
33-
CLANGRT := "$(shell find "/c/Program Files/LLVM/lib" -name "clang_rt.builtins*" -print -quit 2>/dev/null)"
33+
CLANGRT := "$(shell find "/c/Program Files/LLVM/lib" -name "clang_rt.builtins*" 2>/dev/null | sort -V | tail -n 1)"
3434
endif
3535
FFORT := $(FFORT) $(CLANGRT)
3636
endif

0 commit comments

Comments
 (0)