From 2fee6474f00c4d589fc1f737519cd9965aa6b1ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Wed, 22 Jul 2020 13:33:02 -0600 Subject: Compile all the files in the src/ directory --- fpm/src/fpm.f90 | 16 ++++++++-------- 1 file 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 -- cgit v1.2.3