@@ -374,7 +374,7 @@ dtest_i2_r16_d1_tst_c dtest_i4_r16_d1_tst_c dtest_i8_r16_d1_tst_c dtest_i2_r16_d
374374 FCF := $(DFORT) -ffp-exception-behavior=strict $(DFF)
375375
376376# AMD AOMP Flang
377- MFORT := amdflang
377+ MFORT := $(shell command -v amdflang)
378378MFORT := $(MFORT) -fimplicit-none -Werror
379379ifeq ($(TESTDIM),small)
380380 MFORT := $(MFORT) -fstack-arrays
@@ -409,13 +409,9 @@ mtest_i2_r16_d1_tst_c mtest_i4_r16_d1_tst_c mtest_i8_r16_d1_tst_c mtest_i2_r16_d
409409 FCF := $(MFORT) $(MFF)
410410
411411# LLVM Flang
412- # We must define FFORT as follows, because AOCC will also provide "flang", except that it is
413- # located under /opt/AMD.
414- #FFORT := $(shell find -L /usr/bin /usr/local/bin ${HOME}/local ${HOME}/.local ${HOME}/tmp /tmp -type f -name flang -exec test -x {} \; -print 2>/dev/null | sort | tail -n 1)
415- #FFINC := $(shell dirname $$(dirname $(FFORT) 2>/dev/null) 2>/dev/null)/include
416- #FFLIB := $(shell dirname $$(dirname $(FFORT) 2>/dev/null) 2>/dev/null)/lib
417- #FFORT := $(FFORT) -I$(FFINC) -L$(FFLIB)
418- FFORT := $(shell command -v flang) -fimplicit-none -Werror
412+ # Note that AOMP and AOCC will also provide "flang". Make sure the correct one is being called.
413+ FFORT := $(shell command -v flang)
414+ FFORT := $(FFORT) -fimplicit-none -Werror
419415
420416ifeq ($(TESTDIM),small)
421417 FFORT := $(FFORT) -fstack-arrays
@@ -464,7 +460,7 @@ ftest_i2_r16_d1_tst_c ftest_i4_r16_d1_tst_c ftest_i8_r16_d1_tst_c ftest_i2_r16_d
464460# with a leading 0 are interpreted as octal (base-8) numbers within double brackets.
465461# see https://stackoverflow.com/questions/24777597/value-too-great-for-base-error-token-is-08
466462#GFORT := gfortran -pg # Compile for profiling with the gprof profiler. Does not work with macOS on GitHub Actions due to missing gcrt1.o
467- GFORT := gfortran
463+ GFORT := $(shell command -v gfortran)
468464GFSTD := $(shell [[ $$(($(GFORT) -dumpversion 2>/dev/null || echo 0) | sed 's|\..*||') -gt 8 ]] && ([ $(FS) -lt 18 ] && echo -std=f2018 || echo -std=f20$(FS)) || echo "")
469465# 1. gfortran 7 raises a false positive warning regarding "maybe-uninitialized" of allocatable arrays.
470466# See https://stackoverflow.com/questions/56261880/fortran-re-allocation-on-assignment-and-gfortran-warnings
@@ -536,7 +532,7 @@ gtest_i2_r16_d1_tst_c gtest_i4_r16_d1_tst_c gtest_i8_r16_d1_tst_c gtest_i2_r16_d
536532# noold_ldout_format, noold_ldout_zero, noold_maxminloc, noold_unit_star, noold_xor,
537533# protect_parens, realloc_lhs1, recursion, std_intent_in, std_minus0_rounding1, std_mod_proc_name,
538534# and std_value1.
539- IFORT := ifort #-stand f$(FS )
535+ IFORT := $(shell command -v ifort )
540536IFORT := $(IFORT) -diag-disable=10448 # Ignore the warning about the deprecation of ifort
541537IFORT := $(IFORT) -warn all -debug extended -warn errors -traceback -debug-parameters all #-diag-error-limit 1
542538# `-auto` causes all local, non-SAVEd variables to be allocated to the run-time stack.
@@ -580,7 +576,7 @@ itest_i2_r16_d1_tst_c itest_i4_r16_d1_tst_c itest_i8_r16_d1_tst_c itest_i2_r16_d
580576# NAG nagfor
581577# In massive tests, we skip the useful -mtrace option (print memory allocation trace), as its output is enormous.
582578# It is necessary to use "-I$(TESTSUITE_DIR)"; otherwise, the INCLUDE lines in the test suite will not work.
583- NFORT := nagfor
579+ NFORT := $(shell command -v nagfor)
584580NFORT := $(NFORT) -fpp # As of nagfor 7.1, -fpp is needed on macOS and Windows, but not on Linux.
585581NFORT := $(NFORT) -I$(TESTSUITE_DIR)
586582NFORT := $(NFORT) -colour=error:red,warn:magenta,info:cyan
@@ -683,7 +679,7 @@ rtest_i2_r16_d1_tst_c rtest_i4_r16_d1_tst_c rtest_i8_r16_d1_tst_c rtest_i2_r16_d
683679
684680
685681# Oracle sunf95
686- SFORT := sunf95
682+ SFORT := $(shell command -v sunf95)
687683ifeq ($(TESTDIM),small)
688684 SFORT := $(SFORT) -stackvar # Force all automatic arrays to be on the stack to test whether stack overflow can occur
689685endif
@@ -714,7 +710,7 @@ stest_i2_r16_d1_tst_c stest_i4_r16_d1_tst_c stest_i8_r16_d1_tst_c stest_i2_r16_d
714710 FCF := $(SFORT) -fnonstd $(SFF16) -ftrap=overflow,division
715711
716712# Intel ifx
717- XFORT := ifx #-stand f$(FS)
713+ XFORT := $(shell command -v ifx) #-stand f$(FS)
718714XFORT := $(XFORT) -warn all -debug full -warn errors -traceback -debug-parameters all #-diag-error-limit 1
719715# `-auto` causes all local, non-SAVEd variables to be allocated to the run-time stack.
720716# `-no-heap-arrays`, which is the default for `ifort`, causes the compiler puts automatic arrays
@@ -760,8 +756,8 @@ xtest_i2_r16_d1_tst_c xtest_i4_r16_d1_tst_c xtest_i8_r16_d1_tst_c xtest_i2_r16_d
760756
761757
762758# G95
759+ 9FORT := $(shell command -v g95)
763760# G95 supports f2003, but not higher.
764- 9FORT := g95
7657619FORT := $(9FORT) -std=f2003 -pedantic -Wall -Wextra \
766762 -Werror=100,113,115,137,146,147,159,163 \
767763 -Wimplicit-none -Wline-truncation -Wprecision-loss -Wunused-module-vars -Wunused-vars -Wunset-vars \
0 commit comments