[flang-commits] [flang] a1cd5e6 - [flang] Do not create .f18.mod files for each compiled module (#85249)

via flang-commits flang-commits at lists.llvm.org
Thu Apr 11 01:18:38 PDT 2024


Author: Michael Klemm
Date: 2024-04-11T10:18:34+02:00
New Revision: a1cd5e69544ad3e6a865f5e0593ac26195ccb4f7

URL: https://github.com/llvm/llvm-project/commit/a1cd5e69544ad3e6a865f5e0593ac26195ccb4f7
DIFF: https://github.com/llvm/llvm-project/commit/a1cd5e69544ad3e6a865f5e0593ac26195ccb4f7.diff

LOG: [flang] Do not create .f18.mod files for each compiled module (#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`.

---------

Co-authored-by: Kiran Chandramohan <kiranchandramohan at gmail.com>

Added: 
    

Modified: 
    flang/docs/ModFiles.md
    flang/tools/f18/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/flang/docs/ModFiles.md b/flang/docs/ModFiles.md
index e55d72fa3a705b..7463454c8563a2 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
+is needed, Flang's fc1 accepts the option `-module-suffix` to alter the suffix
+used for the module file.
 
 ## Format
 

diff  --git a/flang/tools/f18/CMakeLists.txt b/flang/tools/f18/CMakeLists.txt
index e266055a4bf015..dda3b6887be89a 100644
--- a/flang/tools/f18/CMakeLists.txt
+++ b/flang/tools/f18/CMakeLists.txt
@@ -62,11 +62,8 @@ if (NOT CMAKE_CROSSCOMPILING)
         ${FLANG_SOURCE_DIR}/module/${filename}.f90
       DEPENDS flang-new ${FLANG_SOURCE_DIR}/module/${filename}.f90 ${FLANG_SOURCE_DIR}/module/__fortran_builtins.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()
 
   # Special case for omp_lib.mod, because its source comes from openmp/runtime/src/include.


        


More information about the flang-commits mailing list