Linking new libraries

Hi altogether,

tl;dr: I want to include an external library for supporting a new board/C++ with that board. That library seems not to get linked when compiling a program for that board. How can I tell the Make system to also link that library?

I am completely new to the RIOT project and for a university project I try to add C++ support for RIOT on Arduino Nano / ATMega328P. There is already a pull request to support this board [1] and I do my work [2] based on that PR. Compiling programs for this board are done using avr-gcc/avr-g++. These compilers do not ship the C++ STL or the libstdc++, so the abilities of using C++ are a bit limited. Therefore I want to include an Arduino compatible implementation of libstdc++ [3]. I included that external library as additional folder within cpu/atmega328p and added a export INCLUDES += … to the corresponding Makefile.include. When I compile an example C++ program for the Nano board, e.g. examples/riot_and_cpp, it seems to work fine until at the very end when all files are linked. I get an undefined reference error. As I found out so far, this is very likely a linking problem: When compiling all other files the path for my custom library is included via the -I option, but the library itself does not get compiled.

So how can I tell the Make system to also link that library?

Thanks and best regards, Sebastian

[1] [2] [3]