[flang-commits] [flang] [flang] Do not create .f18.mod files for each compiled module (PR #85249)
Michael Klemm via flang-commits
flang-commits at lists.llvm.org
Thu Mar 14 08:36:47 PDT 2024
https://github.com/mjklemm created https://github.com/llvm/llvm-project/pull/85249
The default CMake scripts had a copy operation to copy a compiled `.mod` file to also be available with suffix `.f18.mod`. This seems no longer needed. Also updated ModFiles.md to point to `-module-suffix`.
>From af50425ded3456a2c11541dfc2c4db41d75e565c Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Thu, 14 Mar 2024 16:34:18 +0100
Subject: [PATCH] Do not create .f18.mod files for each compiled module
---
flang/docs/ModFiles.md | 4 +++-
flang/tools/f18/CMakeLists.txt | 9 +++------
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/flang/docs/ModFiles.md b/flang/docs/ModFiles.md
index e55d72fa3a705b..50bb92d1c6d815 100644
--- a/flang/docs/ModFiles.md
+++ b/flang/docs/ModFiles.md
@@ -27,7 +27,9 @@ often use `rm *.mod` to clean up.
The disadvantage of using the same name as other compilers is that it is not
clear which compiler created a `.mod` file and files from multiple compilers
cannot be in the same directory. This could be solved by adding something
-between the module name and extension, e.g. `<modulename>-f18.mod`.
+between the module name and extension, e.g. `<modulename>-f18.mod`. If this
+needed, Flang's fc1 accepts the option `-module-suffix` to alter the suffix
+used for the module file on disk.
## Format
diff --git a/flang/tools/f18/CMakeLists.txt b/flang/tools/f18/CMakeLists.txt
index ba6c6642c0b62e..6720ae7d86a549 100644
--- a/flang/tools/f18/CMakeLists.txt
+++ b/flang/tools/f18/CMakeLists.txt
@@ -47,7 +47,7 @@ if (NOT CMAKE_CROSSCOMPILING)
endif()
endif()
- # The module contains PPC vector types that needs the PPC target.
+ # The module contains PPC vector types that needs th1e PPC target.
set(opts "")
if(${filename} STREQUAL "__ppc_intrinsics" OR
${filename} STREQUAL "mma")
@@ -65,11 +65,8 @@ if (NOT CMAKE_CROSSCOMPILING)
${FLANG_SOURCE_DIR}/module/${filename}.f90
DEPENDS flang-new ${FLANG_SOURCE_DIR}/module/${filename}.f90 ${depends}
)
- add_custom_command(OUTPUT ${base}.f18.mod
- DEPENDS ${base}.mod
- COMMAND ${CMAKE_COMMAND} -E copy ${base}.mod ${base}.f18.mod)
- list(APPEND MODULE_FILES ${base}.mod ${base}.f18.mod)
- install(FILES ${base}.mod ${base}.f18.mod DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/flang")
+ list(APPEND MODULE_FILES ${base}.mod)
+ install(FILES ${base}.mod DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/flang")
endforeach()
endif()
More information about the flang-commits
mailing list