Skip to content

Commit 2b42cee

Browse files
committed
debug prints
1 parent f445a05 commit 2b42cee

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

src/fpm_targets.f90

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,7 +1076,7 @@ end subroutine prune_build_targets
10761076
subroutine resolve_target_linking(targets, model, library, error)
10771077
type(build_target_ptr), intent(inout), target :: targets(:)
10781078
type(fpm_model_t), intent(in) :: model
1079-
type(library_config_t), intent(in), optional :: library
1079+
type(library_config_t), intent(in), optional :: library
10801080
type(error_t), allocatable, intent(out) :: error
10811081

10821082
integer :: i,j
@@ -1085,6 +1085,13 @@ subroutine resolve_target_linking(targets, model, library, error)
10851085
character(:), allocatable :: global_link_flags, local_link_flags
10861086
character(:), allocatable :: global_include_flags, shared_lib_paths
10871087

1088+
! DEBUG: Print compiler information
1089+
write(stdout,'(A)') 'DEBUG resolve_target_linking: Starting'
1090+
write(stdout,'(A,I0)') 'DEBUG resolve_target_linking: Compiler ID = ', model%compiler%id
1091+
write(stdout,'(A,A)') 'DEBUG resolve_target_linking: Fortran flags = ', model%fortran_compile_flags
1092+
write(stdout,'(A,A)') 'DEBUG resolve_target_linking: C flags = ', model%c_compile_flags
1093+
write(stdout,'(A,A)') 'DEBUG resolve_target_linking: CXX flags = ', model%cxx_compile_flags
1094+
10881095
if (size(targets) == 0) return
10891096

10901097
global_link_flags = ""
@@ -1116,21 +1123,28 @@ subroutine resolve_target_linking(targets, model, library, error)
11161123

11171124
associate(target => targets(i)%ptr)
11181125

1126+
! DEBUG: Print target information
1127+
write(stdout,'(A,I0,A,A)') 'DEBUG resolve_target_linking: Target ', i, ' name = ', target%output_file
1128+
11191129
! If the main program is a C/C++ one, some compilers require additional linking flags, see
11201130
! https://stackoverflow.com/questions/36221612/p3dfft-compilation-ifort-compiler-error-multiple-definiton-of-main
11211131
! In this case, compile_flags were already allocated
11221132
if (.not.allocated(target%compile_flags)) allocate(character(len=0) :: target%compile_flags)
11231133

11241134
target%compile_flags = target%compile_flags//' '
1125-
1135+
11261136
select case (target%target_type)
11271137
case (FPM_TARGET_C_OBJECT)
11281138
target%compile_flags = target%compile_flags//model%c_compile_flags
1139+
write(stdout,'(A,A)') 'DEBUG resolve_target_linking: Using C flags: ', model%c_compile_flags
11291140
case (FPM_TARGET_CPP_OBJECT)
11301141
target%compile_flags = target%compile_flags//model%cxx_compile_flags
1142+
write(stdout,'(A,A)') 'DEBUG resolve_target_linking: Using CXX flags: ', model%cxx_compile_flags
11311143
case default
11321144
target%compile_flags = target%compile_flags//model%fortran_compile_flags &
11331145
& // get_feature_flags(model%compiler, target%features)
1146+
write(stdout,'(A,A)') 'DEBUG resolve_target_linking: Using Fortran flags: ', model%fortran_compile_flags
1147+
write(stdout,'(A,A)') 'DEBUG resolve_target_linking: Feature flags: ', get_feature_flags(model%compiler, target%features)
11341148
end select
11351149

11361150
!> Get macros as flags.
@@ -1141,7 +1155,10 @@ subroutine resolve_target_linking(targets, model, library, error)
11411155
if (len(global_include_flags) > 0) then
11421156
target%compile_flags = target%compile_flags//global_include_flags
11431157
end if
1144-
1158+
1159+
! DEBUG: Print final compile flags
1160+
write(stdout,'(A,A)') 'DEBUG resolve_target_linking: Final compile flags: ', target%compile_flags
1161+
11451162
call target%set_output_dir(get_output_dir(model%build_prefix, target%compile_flags))
11461163

11471164
end associate

0 commit comments

Comments
 (0)