diff options
author | Brad Richardson <brichardson@structint.com> | 2020-06-14 16:52:28 -0700 |
---|---|---|
committer | Brad Richardson <brichardson@structint.com> | 2020-06-14 16:52:28 -0700 |
commit | 16daa62ac79573fc87127df6e1ba080f197c5e31 (patch) | |
tree | 861b7e21e73111f078f6b2d62618ed1dd539a67e /test | |
parent | f97260ef5b5dfe9e2872394a4539090e71e1ceff (diff) | |
download | fpm-16daa62ac79573fc87127df6e1ba080f197c5e31.tar.gz fpm-16daa62ac79573fc87127df6e1ba080f197c5e31.zip |
Add support for Makefiles and generic build scripts
Diffstat (limited to 'test')
-rw-r--r-- | test/Spec.hs | 10 | ||||
-rw-r--r-- | test/example_packages/makefile_complex/.gitignore | 1 | ||||
-rw-r--r-- | test/example_packages/makefile_complex/Makefile | 9 | ||||
-rw-r--r-- | test/example_packages/makefile_complex/app/main.f90 | 7 | ||||
-rw-r--r-- | test/example_packages/makefile_complex/fpm.toml | 8 | ||||
-rw-r--r-- | test/example_packages/makefile_complex/src/wrapper_mod.f90 | 12 | ||||
-rw-r--r-- | test/example_packages/with_makefile/.gitignore | 1 | ||||
-rw-r--r-- | test/example_packages/with_makefile/Makefile | 9 | ||||
-rw-r--r-- | test/example_packages/with_makefile/fpm.toml | 5 | ||||
-rw-r--r-- | test/example_packages/with_makefile/src/hello_makefile.f90 | 10 |
10 files changed, 72 insertions, 0 deletions
diff --git a/test/Spec.hs b/test/Spec.hs index 18da62f..6fb4006 100644 --- a/test/Spec.hs +++ b/test/Spec.hs @@ -13,6 +13,8 @@ main = do testHelloComplex testHelloFpm testCircular + testWithMakefile + testMakefileComplex testHelloWorld :: IO () testHelloWorld = @@ -29,3 +31,11 @@ testHelloFpm = testCircular :: IO () testCircular = withCurrentDirectory (example_path </> "circular_example") $ start $ Arguments (Test "") False "" + +testWithMakefile :: IO () +testWithMakefile = + withCurrentDirectory (example_path </> "with_makefile") $ start $ Arguments (Build) False "" + +testMakefileComplex :: IO () +testMakefileComplex = + withCurrentDirectory (example_path </> "makefile_complex") $ start $ Arguments (Run "") False "" diff --git a/test/example_packages/makefile_complex/.gitignore b/test/example_packages/makefile_complex/.gitignore new file mode 100644 index 0000000..a007fea --- /dev/null +++ b/test/example_packages/makefile_complex/.gitignore @@ -0,0 +1 @@ +build/* diff --git a/test/example_packages/makefile_complex/Makefile b/test/example_packages/makefile_complex/Makefile new file mode 100644 index 0000000..497c6b2 --- /dev/null +++ b/test/example_packages/makefile_complex/Makefile @@ -0,0 +1,9 @@ +INCLUDE_FLAGS = $(addprefix -I,$(INCLUDE_DIRS)) + +$(BUILD_DIR)/libmakefile_complex.a: $(BUILD_DIR)/wrapper_mod.o + ar rs $(@) $(^) + +$(BUILD_DIR)/wrapper_mod.mod: src/wrapper_mod.f90 + +$(BUILD_DIR)/wrapper_mod.o: src/wrapper_mod.f90 + $(FC) -c -J$(BUILD_DIR) $(INCLUDE_FLAGS) $(FFLAGS) -o $(@) $(<) diff --git a/test/example_packages/makefile_complex/app/main.f90 b/test/example_packages/makefile_complex/app/main.f90 new file mode 100644 index 0000000..ac9ed51 --- /dev/null +++ b/test/example_packages/makefile_complex/app/main.f90 @@ -0,0 +1,7 @@ +program makefile_complex + use wrapper_mod, only: do_stuff + + implicit none + + call do_stuff +end program makefile_complex diff --git a/test/example_packages/makefile_complex/fpm.toml b/test/example_packages/makefile_complex/fpm.toml new file mode 100644 index 0000000..3282cbe --- /dev/null +++ b/test/example_packages/makefile_complex/fpm.toml @@ -0,0 +1,8 @@ +name = "makefile_complex" + +[dependencies] +with_makefile = { path = "../with_makefile" } + +[library] +source-dir = "src" +build-script = "Makefile" diff --git a/test/example_packages/makefile_complex/src/wrapper_mod.f90 b/test/example_packages/makefile_complex/src/wrapper_mod.f90 new file mode 100644 index 0000000..e8028b5 --- /dev/null +++ b/test/example_packages/makefile_complex/src/wrapper_mod.f90 @@ -0,0 +1,12 @@ +module wrapper_mod + use hello_makefile, only: say_hello_from_makefile + + implicit none + private + + public :: do_stuff +contains + subroutine do_stuff + call say_hello_from_makefile + end subroutine do_stuff +end module wrapper_mod diff --git a/test/example_packages/with_makefile/.gitignore b/test/example_packages/with_makefile/.gitignore new file mode 100644 index 0000000..a007fea --- /dev/null +++ b/test/example_packages/with_makefile/.gitignore @@ -0,0 +1 @@ +build/* diff --git a/test/example_packages/with_makefile/Makefile b/test/example_packages/with_makefile/Makefile new file mode 100644 index 0000000..51e72d4 --- /dev/null +++ b/test/example_packages/with_makefile/Makefile @@ -0,0 +1,9 @@ +INCLUDE_FLAGS = $(addprefix -I,$(INCLUDE_DIRS)) + +$(BUILD_DIR)/libwith_makefile.a: $(BUILD_DIR)/hello_makefile.o + ar rs $(@) $(^) + +$(BUILD_DIR)/hello_makefile.mod: src/hello_makefile.f90 + +$(BUILD_DIR)/hello_makefile.o: src/hello_makefile.f90 + $(FC) -c -J$(BUILD_DIR) $(INCLUDE_FLAGS) $(FFLAGS) -o $(@) $(<) diff --git a/test/example_packages/with_makefile/fpm.toml b/test/example_packages/with_makefile/fpm.toml new file mode 100644 index 0000000..81dd02a --- /dev/null +++ b/test/example_packages/with_makefile/fpm.toml @@ -0,0 +1,5 @@ +name = "with_makefile" + +[library] +source-dir = "src" +build-script = "Makefile" diff --git a/test/example_packages/with_makefile/src/hello_makefile.f90 b/test/example_packages/with_makefile/src/hello_makefile.f90 new file mode 100644 index 0000000..2d4d1a2 --- /dev/null +++ b/test/example_packages/with_makefile/src/hello_makefile.f90 @@ -0,0 +1,10 @@ +module hello_makefile + implicit none + private + + public :: say_hello_from_makefile +contains + subroutine say_hello_from_makefile() + print *, "Hello from Makefile library!" + end subroutine say_hello_from_makefile +end module hello_makefile |