aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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