@@ -15,6 +15,9 @@ module fpm_sources
15
15
private
16
16
public :: add_sources_from_dir, add_executable_sources
17
17
18
+ character (4 ), parameter :: fortran_suffixes(2 ) = [" .f90" , &
19
+ " .f " ]
20
+
18
21
contains
19
22
20
23
! > Wrapper to source parsing routines.
@@ -24,16 +27,15 @@ function parse_source(source_file_path,error) result(source)
24
27
type (error_t), allocatable , intent (out ) :: error
25
28
type (srcfile_t) :: source
26
29
27
- if (str_ends_with(lower(source_file_path), " .f90 " )) then
30
+ if (str_ends_with(lower(source_file_path), fortran_suffixes )) then
28
31
29
32
source = parse_f_source(source_file_path, error)
30
33
31
34
if (source% unit_type == FPM_UNIT_PROGRAM) then
32
35
source% exe_name = basename(source_file_path,suffix= .false. )
33
36
end if
34
37
35
- else if (str_ends_with(lower(source_file_path), " .c" ) .or. &
36
- str_ends_with(lower(source_file_path), " .h" )) then
38
+ else if (str_ends_with(lower(source_file_path), [" .c" , " .h" ])) then
37
39
38
40
source = parse_c_source(source_file_path,error)
39
41
@@ -80,9 +82,8 @@ subroutine add_sources_from_dir(sources,directory,scope,with_executables,recurse
80
82
end if
81
83
82
84
is_source = [(.not. (canon_path(file_names(i)% s) .in . existing_src_files) .and. &
83
- (str_ends_with(lower(file_names(i)% s), " .f90" ) .or. &
84
- str_ends_with(lower(file_names(i)% s), " .c" ) .or. &
85
- str_ends_with(lower(file_names(i)% s), " .h" ) ),i= 1 ,size (file_names))]
85
+ (str_ends_with(lower(file_names(i)% s), fortran_suffixes) .or. &
86
+ str_ends_with(lower(file_names(i)% s),[" .c" ," .h" ]) ),i= 1 ,size (file_names))]
86
87
src_file_names = pack (file_names,is_source)
87
88
88
89
allocate (dir_sources(size (src_file_names)))
0 commit comments