diff options
author | Ondřej Čertík <ondrej@certik.us> | 2020-07-22 13:33:02 -0600 |
---|---|---|
committer | Ondřej Čertík <ondrej@certik.us> | 2020-07-22 15:29:58 -0600 |
commit | 2fee6474f00c4d589fc1f737519cd9965aa6b1ee (patch) | |
tree | 206187f310e57dd162d7855e3a520c9348c99eb9 | |
parent | 7c552525051b6fa2bb6699595baffd3b429e25b0 (diff) | |
download | fpm-2fee6474f00c4d589fc1f737519cd9965aa6b1ee.tar.gz fpm-2fee6474f00c4d589fc1f737519cd9965aa6b1ee.zip |
Compile all the files in the src/ directory
-rw-r--r-- | fpm/src/fpm.f90 | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/fpm/src/fpm.f90 b/fpm/src/fpm.f90 index bffac56..9603717 100644 --- a/fpm/src/fpm.f90 +++ b/fpm/src/fpm.f90 @@ -144,19 +144,19 @@ end function subroutine cmd_build() logical :: src type(string_t), allocatable :: files(:) -integer :: i +character(:), allocatable :: basename +integer :: i, n print *, "# Building project" call list_files("src", files) -print *, "Files in src/" do i = 1, size(files) - print *, i, files(i)%s + if (str_ends_with(files(i)%s, ".f90")) then + n = len(files(i)%s) + basename = files(i)%s(1:n-4) + call run("gfortran -c src/" // basename // ".f90 -o " // basename // ".o") + end if end do -print * -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") +src = exists("src/fpm.f90") if (src) then call run("gfortran main.o fpm.o -o fpm") else |