@@ -56,7 +56,8 @@ recursive subroutine build_target(model,target,linking)
56
56
type (build_target_t), intent (inout ) :: target
57
57
character (:), allocatable , intent (in ) :: linking
58
58
59
- integer :: i
59
+ integer :: i, j
60
+ type (build_target_t), pointer :: exe_obj
60
61
character (:), allocatable :: objs
61
62
62
63
if (target % built) then
@@ -80,12 +81,27 @@ recursive subroutine build_target(model,target,linking)
80
81
81
82
if (target % target_type == FPM_TARGET_ARCHIVE ) then
82
83
84
+ ! Construct object list for archive
83
85
objs = objs// " " // target % dependencies(i)% ptr% output_file
84
86
85
87
else if (target % target_type == FPM_TARGET_EXECUTABLE .and. &
86
88
target % dependencies(i)% ptr% target_type == FPM_TARGET_OBJECT) then
87
89
88
- objs = " " // target % dependencies(i)% ptr% output_file
90
+ exe_obj = > target % dependencies(i)% ptr
91
+
92
+ ! Construct object list for executable
93
+ objs = " " // exe_obj% output_file
94
+
95
+ ! Include non-library object dependencies
96
+ do j= 1 ,size (exe_obj% dependencies)
97
+
98
+ if (allocated (exe_obj% dependencies(j)% ptr% source)) then
99
+ if (exe_obj% dependencies(j)% ptr% source% unit_scope == exe_obj% source% unit_scope) then
100
+ objs = objs// " " // exe_obj% dependencies(j)% ptr% output_file
101
+ end if
102
+ end if
103
+
104
+ end do
89
105
90
106
end if
91
107
0 commit comments