diff --git a/README.md b/README.md index a19deea..60d6b94 100644 --- a/README.md +++ b/README.md @@ -30,11 +30,28 @@ You can then build and install the static `libopenlibm.a` archive and the header % make USEGCC=1 TOOLPREFIX=sh-elf- libdir="$PREFIX" includedir="$PREFIX/include" install-static install-headers ``` -## Using in a program +## Using in a Makefile-based add-in -Simply link with `-lopenlibm` as you would do with `-lm`. +Link with `-lopenlibm` as you would do with `-lm`. Since OpenLibm headers +reference themselves by file name (`#include `) even though +they are installed in a subfolder, you need a `-I` flag: + +``` +CFLAGS += -I $(shell sh-elf-gcc -print-file-name=include/openlibm) +LDFLAGS += -lopenlibm +``` + +## Using in a CMake-based add-in + +When using CMake with the fxSDK, add the include folder and library like this. + +``` +target_include_directories( PRIVATE "${FXSDK_COMPILER_INSTALL}/include/openlibm") +target_link_libraries( -lopenlibm) +``` ## README and Licensing -See the original README file in README-OpenLibm.md. OpenLibm contains code -covered by various licenses, see LICENSE.md. +See the original README file in [README-OpenLibm.md](README-OpenLibm.md). +OpenLibm contains code covered by various licenses, see +[LICENSE.md](LICENSE.md).