27
27
! >
28
28
module fpm_backend
29
29
30
- use fpm_environment, only: run
31
- use fpm_filesystem, only: dirname, join_path, exists, mkdir
30
+ use fpm_environment, only: run, get_os_type, OS_WINDOWS
31
+ use fpm_filesystem, only: dirname, join_path, exists, mkdir, unix_path
32
32
use fpm_model, only: fpm_model_t
33
33
use fpm_targets, only: build_target_t, build_target_ptr, &
34
34
FPM_TARGET_OBJECT, FPM_TARGET_ARCHIVE, FPM_TARGET_EXECUTABLE
35
35
36
- use fpm_strings, only: string_t
36
+ use fpm_strings, only: string_cat, string_t
37
37
38
38
implicit none
39
39
@@ -247,8 +247,16 @@ subroutine build_target(model,target)
247
247
// " " // target % link_flags// " -o " // target % output_file)
248
248
249
249
case (FPM_TARGET_ARCHIVE)
250
- call write_response_file(target % output_file// " .resp" ,target % link_objects)
251
- call run(" ar -rs " // target % output_file // " @" // target % output_file// " .resp" )
250
+
251
+ select case (get_os_type())
252
+ case (OS_WINDOWS)
253
+ call write_response_file(target % output_file// " .resp" ,target % link_objects)
254
+ call run(" ar -rs " // target % output_file // " @" // target % output_file// " .resp" )
255
+
256
+ case default
257
+ call run(" ar -rs " // target % output_file // " " // string_cat(target % link_objects," " ))
258
+
259
+ end select
252
260
253
261
end select
254
262
@@ -270,7 +278,7 @@ subroutine write_response_file(name, argv)
270
278
integer :: iarg, io
271
279
open (file= name, newunit= io)
272
280
do iarg = 1 , size (argv)
273
- write (io, ' (a)' ) argv(iarg)% s
281
+ write (io, ' (a)' ) unix_path( argv(iarg)% s)
274
282
end do
275
283
close (io)
276
284
end subroutine write_response_file
0 commit comments