Skip to content

Commit f4cb305

Browse files
committed
260207.230319.CET [skip ci] update Makefile.common to use command -v to show the full path of the compilers
1 parent 3f4e5b6 commit f4cb305

File tree

2 files changed

+19
-24
lines changed

2 files changed

+19
-24
lines changed

fortran/tests/makefiles/Makefile.common

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -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)
378378
MFORT := $(MFORT) -fimplicit-none -Werror
379379
ifeq ($(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

420416
ifeq ($(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)
468464
GFSTD := $(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)
540536
IFORT := $(IFORT) -diag-disable=10448 # Ignore the warning about the deprecation of ifort
541537
IFORT := $(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)
584580
NFORT := $(NFORT) -fpp # As of nagfor 7.1, -fpp is needed on macOS and Windows, but not on Linux.
585581
NFORT := $(NFORT) -I$(TESTSUITE_DIR)
586582
NFORT := $(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)
687683
ifeq ($(TESTDIM),small)
688684
SFORT := $(SFORT) -stackvar # Force all automatic arrays to be on the stack to test whether stack overflow can occur
689685
endif
@@ -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)
718714
XFORT := $(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
765761
9FORT := $(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 \

matlab/mex_gateways/tests/makefiles/Makefile.common

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,8 @@ dtest_i2_r16_d1_tst dtest_i4_r16_d1_tst dtest_i8_r16_d1_tst dtest_i2_r16_d0_tst
225225
FC2 := $(DFORT) $(FFLAGS2) -ffp-exception-behavior=strict
226226

227227
# AMD AOMP Flang
228-
MFORT := amdflang -fimplicit-none -Werror
228+
MFORT := $(shell command -v amdflang)
229+
MFORT := $(MFORT) -fimplicit-none -Werror
229230

230231
mtest_i2_r4_d1_tst mtest_i4_r4_d1_tst mtest_i8_r4_d1_tst mtest_i2_r4_d0_tst mtest_i4_r4_d0_tst mtest_i8_r4_d0_tst: \
231232
FC1 := $(MFORT) $(FFLAGS1)
@@ -243,9 +244,7 @@ mtest_i2_r16_d1_tst mtest_i4_r16_d1_tst mtest_i8_r16_d1_tst mtest_i2_r16_d0_tst
243244
FC2 := $(MFORT) $(FFLAGS2)
244245

245246
# LLVM Flang
246-
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)
247-
FFINC := $(shell dirname $$(dirname $(FFORT) 2>/dev/null) 2>/dev/null)/include
248-
FFLIB := $(shell dirname $$(dirname $(FFORT) 2>/dev/null) 2>/dev/null)/lib
247+
FFORT := $(shell command -v flang)
249248
FFORT := $(FFORT) -fimplicit-none -Werror
250249
# -std or -pedantic does not work due to the non-standard code in the MEX API provided by MathWorks
251250
#FFORT := $(FFORT) -std=f2018 -pedantic
@@ -269,7 +268,7 @@ ftest_i2_r16_d1_tst ftest_i4_r16_d1_tst ftest_i8_r16_d1_tst ftest_i2_r16_d0_tst
269268
# In the debug mode, our code includes the BACKTRACE function if the compiler is gfortran. This
270269
# makes the code not standard-conforming. So -std=f$(FSTD) is excluded for the following options.
271270
# As of 2022, -Wextra implies -Wcompare-reals, -Wunused-parameter, and -Wdo-subscript.
272-
GFORT := gfortran
271+
GFORT := $(shell command -v gfortran)
273272
GFORT := $(GFORT) -Wall -Wextra -pedantic -fmax-errors=1 -Wampersand -Wconversion -Wuninitialized \
274273
-Wmaybe-uninitialized -Wsurprising -Waliasing -Wimplicit-interface -Wimplicit-procedure \
275274
-Wintrinsics-std -Wunderflow -Wuse-without-only -Wunused-parameter \
@@ -305,7 +304,7 @@ gtest_i2_r16_d1_tst gtest_i4_r16_d1_tst gtest_i8_r16_d1_tst gtest_i2_r16_d0_tst
305304
# We impose -assume norecursion, because -standard-semantics will enable -assume recursion, which
306305
# will cause a warning; due to -warn errors, the compilation will abort. See
307306
# https://www.intel.com/content/www/us/en/develop/documentation/fortran-compiler-oneapi-dev-guide-and-reference/top/language-reference/a-to-z-reference/q-to-r/recursive-and-non-recursive.html
308-
IFORT := ifort
307+
IFORT := $(shell command -v ifort)
309308
#IFORT := $(IFORT) -diag-error-limit 1
310309
IFORT := $(IFORT) -diag-disable=10448 # Ignore the warning about the deprecation of ifort
311310
IFORT := $(IFORT) -stand f95 -standard-semantics -assume norecursion -warn all -debug extended \
@@ -329,7 +328,7 @@ itest_i2_r16_d1_tst itest_i4_r16_d1_tst itest_i8_r16_d1_tst itest_i2_r16_d0_tst
329328
# NAG nagfor
330329
# In massive tests, we skip the useful -mtrace option (print memory allocation trace), as its output is enormous.
331330
# It is necessary to use "-I $(TESTSUITE_DIR)"; otherwise, the INCLUDE lines in the test suite will not work.
332-
NFORT := nagfor
331+
NFORT := $(shell command -v nagfor)
333332
NFORT := $(NFORT) -colour=error:red,warn:magenta,info:cyan
334333
NFORT := $(NFORT) -f$(FSTD) -info -gline -u -C -C=alias -C=dangling -C=intovf -kind=unique \
335334
-Warn=constant_coindexing -Warn=subnormal #-Warn=allocation
@@ -373,7 +372,7 @@ vtest_i2_r16_d1_tst vtest_i4_r16_d1_tst vtest_i8_r16_d1_tst vtest_i2_r16_d0_tst
373372
FC2 := $(VFORT) $(FFLAGS2) -Kieee -Ktrap=divz,ovf,inv#,unf,denorm
374373

375374
# Oracle sunf95
376-
SFORT := sunf95
375+
SFORT := $(shell command -v sunf95)
377376
SFORT := $(SFORT) -w3 -u -U -ansi -xcheck=%all -C
378377

379378
stest_i2_r4_d1_tst stest_i4_r4_d1_tst stest_i8_r4_d1_tst stest_i2_r4_d0_tst stest_i4_r4_d0_tst stest_i8_r4_d0_tst: \
@@ -392,7 +391,7 @@ stest_i2_r16_d1_tst stest_i4_r16_d1_tst stest_i8_r16_d1_tst stest_i2_r16_d0_tst
392391
FC2 := $(SFORT) $(FFLAGS2) -fnonstd -ftrap=overflow,division,invalid#,underflow
393392

394393
# Intel ifx
395-
XFORT := ifx
394+
XFORT := $(shell command -v ifx)
396395
#XFORT := $(XFORT) -diag-error-limit 1
397396
XFORT := $(XFORT) -stand f$(FS) -warn all -debug full -traceback -debug-parameters all
398397

@@ -413,7 +412,7 @@ xtest_i2_r16_d1_tst xtest_i4_r16_d1_tst xtest_i8_r16_d1_tst xtest_i2_r16_d0_tst
413412

414413
# G95
415414
# The compilation of MEX gateways will fail if -std is imposed.
416-
9FORT := g95
415+
9FORT := $(shell command -v g95)
417416
9FORT := $(9FORT) -pedantic -Wall -Wextra \
418417
-Werror=100,113,115,137,146,147,159,163 \
419418
-Wimplicit-none -Wline-truncation -Wprecision-loss -Wunused-module-vars -Wunused-vars -Wunset-vars \

0 commit comments

Comments
 (0)