From 2990fe5a66f960a97fb8dff266b724b5314b220a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Tue, 21 Jul 2020 23:11:56 -0600 Subject: Rename fpm.f90 to fpm.F90 --- fpm/src/fpm.F90 | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ fpm/src/fpm.f90 | 60 --------------------------------------------------------- 2 files changed, 60 insertions(+), 60 deletions(-) create mode 100644 fpm/src/fpm.F90 delete mode 100644 fpm/src/fpm.f90 diff --git a/fpm/src/fpm.F90 b/fpm/src/fpm.F90 new file mode 100644 index 0000000..789df8d --- /dev/null +++ b/fpm/src/fpm.F90 @@ -0,0 +1,60 @@ +module fpm +implicit none +private +public :: print_help, cmd_build + +integer, parameter :: os_linux = 1 +integer, parameter :: os_macos = 2 +integer, parameter :: os_windows = 3 + +contains + +integer function get_os() result(r) +#ifdef _WIN32 + r = os_windows +#elif defined __APPLE__ + r = os_macos +#elif defined __linux__ + r = os_linux +#else + ! Unsupported platform + error stop +#endif +end function + +subroutine print_help() +print *, "Fortran Package Manager (fpm)" +end subroutine + +subroutine run(cmd) +character(len=*), intent(in) :: cmd +integer :: stat +print *, "+ ", cmd +call execute_command_line(cmd, exitstat=stat) +if (stat /= 0) then + print *, "Command failed" + error stop +end if +end subroutine + +logical function exists(filename) result(r) +character(len=*), intent(in) :: filename +inquire(file=filename, exist=r) +end function + +subroutine cmd_build() +logical :: src +print *, "# Building project" +src = exists("src/fpm.F90") +if (src) then + call run("gfortran -c src/fpm.F90 -o fpm.o") +end if +call run("gfortran -c app/main.f90 -o main.o") +if (src) then + call run("gfortran main.o fpm.o -o fpm") +else + call run("gfortran main.o -o hello_world") +end if +end subroutine + +end module fpm diff --git a/fpm/src/fpm.f90 b/fpm/src/fpm.f90 deleted file mode 100644 index d9d1bac..0000000 --- a/fpm/src/fpm.f90 +++ /dev/null @@ -1,60 +0,0 @@ -module fpm -implicit none -private -public :: print_help, cmd_build - -integer, parameter :: os_linux = 1 -integer, parameter :: os_macos = 2 -integer, parameter :: os_windows = 3 - -contains - -integer function get_os() result(r) -#ifdef _WIN32 - r = os_windows -#elif defined __APPLE__ - r = os_macos -#elif defined __linux__ - r = os_linux -#else - ! Unsupported platform - error stop -#endif -end function - -subroutine print_help() -print *, "Fortran Package Manager (fpm)" -end subroutine - -subroutine run(cmd) -character(len=*), intent(in) :: cmd -integer :: stat -print *, "+ ", cmd -call execute_command_line(cmd, exitstat=stat) -if (stat /= 0) then - print *, "Command failed" - error stop -end if -end subroutine - -logical function exists(filename) result(r) -character(len=*), intent(in) :: filename -inquire(file=filename, exist=r) -end function - -subroutine cmd_build() -logical :: src -print *, "# Building project" -src = exists("src/fpm.f90") -if (src) then - call run("gfortran -c src/fpm.f90 -o fpm.o") -end if -call run("gfortran -c app/main.f90 -o main.o") -if (src) then - call run("gfortran main.o fpm.o -o fpm") -else - call run("gfortran main.o -o hello_world") -end if -end subroutine - -end module fpm -- cgit v1.2.3