2727! >
2828module fpm_backend
2929
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
3232use fpm_model, only: fpm_model_t
3333use fpm_targets, only: build_target_t, build_target_ptr, &
3434 FPM_TARGET_OBJECT, FPM_TARGET_ARCHIVE, FPM_TARGET_EXECUTABLE
3535
36- use fpm_strings, only: string_t
36+ use fpm_strings, only: string_cat, string_t
3737
3838implicit none
3939
@@ -247,8 +247,16 @@ subroutine build_target(model,target)
247247 // " " // target % link_flags// " -o " // target % output_file)
248248
249249 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
252260
253261 end select
254262
@@ -270,7 +278,7 @@ subroutine write_response_file(name, argv)
270278 integer :: iarg, io
271279 open (file= name, newunit= io)
272280 do iarg = 1 , size (argv)
273- write (io, ' (a)' ) argv(iarg)% s
281+ write (io, ' (a)' ) unix_path( argv(iarg)% s)
274282 end do
275283 close (io)
276284end subroutine write_response_file
0 commit comments