make_archive Subroutine

public subroutine make_archive(self, output, args, log_file, stat)

Create an archive

Todo

For Windows OS, use the local delete_file_win32 in stead of delete_file. This may be related to a bug in Mingw64-openmp and is expected to be resolved in the future, see issue #707, #708 and #808.

Type Bound

archiver_t

Arguments

Type IntentOptional Attributes Name
class(archiver_t), intent(in) :: self

Instance of the archiver object

character(len=*), intent(in) :: output

Name of the archive to generate

type(string_t), intent(in) :: args(:)

Object files to include into the archive

character(len=*), intent(in) :: log_file

Compiler output log file

integer, intent(out) :: stat

Status flag


Subroutines

subroutine delete_file_win32(file)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: file

Source Code

subroutine make_archive(self, output, args, log_file, stat)
    !> Instance of the archiver object
    class(archiver_t), intent(in) :: self
    !> Name of the archive to generate
    character(len=*), intent(in) :: output
    !> Object files to include into the archive
    type(string_t), intent(in) :: args(:)
    !> Compiler output log file
    character(len=*), intent(in) :: log_file
    !> Status flag
    integer, intent(out) :: stat

    if (self%use_response_file) then
        call write_response_file(output//".resp" , args)
        call run(self%ar // output // " @" // output//".resp", echo=self%echo, &
            &  verbose=self%verbose, redirect=log_file, exitstat=stat)
        call delete_file_win32(output//".resp")

    else
        call run(self%ar // output // " " // string_cat(args, " "), &
            & echo=self%echo, verbose=self%verbose, redirect=log_file, exitstat=stat)
    end if

    contains
        subroutine delete_file_win32(file)
            character(len=*), intent(in) :: file
            logical :: exist
            integer :: unit, iostat
            inquire(file=file, exist=exist)
            if (exist) then
                open(file=file, newunit=unit)
                close(unit, status='delete', iostat=iostat)
            end if
        end subroutine delete_file_win32
end subroutine make_archive