Skip to content

Commit 672cd36

Browse files
author
Jannis Teunissen
committed
Add brief explanation on how to include stdlib in a Makefile
1 parent e88daa3 commit 672cd36

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ stdlib = { git="https://github.com/fortran-lang/stdlib", branch="stdlib-fpm" }
217217
218218
## Using stdlib in your project
219219

220+
### Using stdlib with CMake
221+
220222
The stdlib project exports CMake package files and pkg-config files to make stdlib usable for other projects.
221223
The package files are located in the library directory in the installation prefix.
222224

@@ -235,6 +237,18 @@ target_link_libraries(
235237
To make the installed stdlib project discoverable add the stdlib directory to the ``CMAKE_PREFIX_PATH``.
236238
The usual install location of the package files is ``$PREFIX/lib/cmake/fortran_stdlib``.
237239

240+
### Using stdlib with a regular Makefile
241+
242+
The library can be included in a regular Makefile, for example with
243+
```make
244+
STDLIB_PATH := path/to/build
245+
LIBDIRS := $(STDLIB_PATH)/src
246+
INCDIRS := $(STDLIB_PATH)/src/mod_files
247+
...
248+
```
249+
Here it is assumed that the compiler will look for libraries in `LIBDIRS` and for module files in `INCDIRS`.
250+
A flag `-lfortran_stdlib` should be included to link against `libfortran_stdlib.a` or `libfortran_stdlib.so`.
251+
238252
## Documentation
239253

240254
Documentation is a work in progress (see issue [#4](https://github.com/fortran-lang/stdlib/issues/4)) but already available at [stdlib.fortran-lang.org](https://stdlib.fortran-lang.org).

0 commit comments

Comments
 (0)