aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndřej Čertík <ondrej@certik.us>2020-07-22 13:49:24 -0600
committerOndřej Čertík <ondrej@certik.us>2020-07-22 15:29:58 -0600
commit46a607ad8d74cd021772e900a93b73f9ac9368e1 (patch)
treef205f2073442528fa97cb4edd01b9f1f8ff80eb9
parent9a12ab0f29cabcdcf509d412d13ddd62c9455e47 (diff)
downloadfpm-46a607ad8d74cd021772e900a93b73f9ac9368e1.tar.gz
fpm-46a607ad8d74cd021772e900a93b73f9ac9368e1.zip
Use more automatic building
-rw-r--r--fpm/src/fpm.f9012
1 files changed, 4 insertions, 8 deletions
diff --git a/fpm/src/fpm.f90 b/fpm/src/fpm.f90
index fb5e824..aabcfd1 100644
--- a/fpm/src/fpm.f90
+++ b/fpm/src/fpm.f90
@@ -152,27 +152,23 @@ end if
end subroutine
subroutine cmd_build()
-logical :: src
type(string_t), allocatable :: files(:)
-character(:), allocatable :: basename, pkg_name
+character(:), allocatable :: basename, pkg_name, linking
integer :: i, n
print *, "# Building project"
call list_files("src", files)
+linking = ""
do i = 1, size(files)
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")
+ linking = linking // " " // basename // ".o"
end if
end do
call run("gfortran -c app/main.f90 -o main.o")
call package_name(pkg_name)
-src = exists("src/fpm.f90")
-if (src) then
- call run("gfortran main.o fpm.o -o " // pkg_name)
-else
- call run("gfortran main.o -o " // pkg_name)
-end if
+call run("gfortran main.o " // linking // " -o " // pkg_name)
end subroutine
end module fpm