@@ -1076,7 +1076,7 @@ end subroutine prune_build_targets
1076
1076
subroutine resolve_target_linking (targets , model , library , error )
1077
1077
type (build_target_ptr), intent (inout ), target :: targets(:)
1078
1078
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
1080
1080
type (error_t), allocatable , intent (out ) :: error
1081
1081
1082
1082
integer :: i,j
@@ -1085,6 +1085,13 @@ subroutine resolve_target_linking(targets, model, library, error)
1085
1085
character (:), allocatable :: global_link_flags, local_link_flags
1086
1086
character (:), allocatable :: global_include_flags, shared_lib_paths
1087
1087
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
+
1088
1095
if (size (targets) == 0 ) return
1089
1096
1090
1097
global_link_flags = " "
@@ -1116,21 +1123,28 @@ subroutine resolve_target_linking(targets, model, library, error)
1116
1123
1117
1124
associate(target = > targets(i)% ptr)
1118
1125
1126
+ ! DEBUG: Print target information
1127
+ write (stdout,' (A,I0,A,A)' ) ' DEBUG resolve_target_linking: Target ' , i, ' name = ' , target % output_file
1128
+
1119
1129
! If the main program is a C/C++ one, some compilers require additional linking flags, see
1120
1130
! https://stackoverflow.com/questions/36221612/p3dfft-compilation-ifort-compiler-error-multiple-definiton-of-main
1121
1131
! In this case, compile_flags were already allocated
1122
1132
if (.not. allocated (target % compile_flags)) allocate (character (len= 0 ) :: target % compile_flags)
1123
1133
1124
1134
target % compile_flags = target % compile_flags// ' '
1125
-
1135
+
1126
1136
select case (target % target_type)
1127
1137
case (FPM_TARGET_C_OBJECT)
1128
1138
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
1129
1140
case (FPM_TARGET_CPP_OBJECT)
1130
1141
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
1131
1143
case default
1132
1144
target % compile_flags = target % compile_flags// model% fortran_compile_flags &
1133
1145
& // 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)
1134
1148
end select
1135
1149
1136
1150
! > Get macros as flags.
@@ -1141,7 +1155,10 @@ subroutine resolve_target_linking(targets, model, library, error)
1141
1155
if (len (global_include_flags) > 0 ) then
1142
1156
target % compile_flags = target % compile_flags// global_include_flags
1143
1157
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
+
1145
1162
call target % set_output_dir(get_output_dir(model% build_prefix, target % compile_flags))
1146
1163
1147
1164
end associate
0 commit comments