Building an example with a custom makefile

For a project I am working on I use the gnrc_border_router example as a gateway router.
However I need to configure it a bit.
To make my project easyer to share I want to make a makefile in my project that can compile the gnrc_border_router with the correct settings. Right now I am doing this like this:


#include wireless network parameters
include ../Node/

#Settings to change on the border router example
BOARD = nrf52840dongle
UPLINK = cdc-ecm

include $(RIOTBASE)/examples/gnrc_border_router/Makefile

However I then get errors including the cdc-edm config as these are not in CURDIR.

No rule to make target '$PROJECT/BorderRouter/Makefile.cdc-ecm.conf'. Stop.

My current fix is to create copy of Makefile.cdc-ecm.conf, but I find this very ugly.

Does anyone know of a better way to do this?

1 Like

Usually for an application’s make file we do not import another applications Makefile, so the “official” way would be to just copy the whole application. But I like your approach, so maybe we could somehow make this nicer without destroying the readability of the example Makefile too much.

That was exactly what I did at first, but I did not want the complete example in my repo.

I think this should work if the gnrc_border_router example did not use the $(CURDIR) variable. Maybe either using $(RIOTBASE) or just using relative paths.

1 Like

I’d rather not make an example’s path absolute within the example itself. Maybe $(LAST_MAKEFILEDIR) could work here.

Mh, doc says no :frowning: