diff --git a/boards/native/Makefile.dep b/boards/native/Makefile.dep index f0e996ae56..dedea2cc63 100644 --- a/boards/native/Makefile.dep +++ b/boards/native/Makefile.dep @@ -9,6 +9,7 @@ ifneq (,$(filter mtd,$(USEMODULE))) endif ifneq (,$(filter periph_can,$(FEATURES_USED))) + USEPKG += libsocketcan ifeq ($(OS),Linux) CFLAGS += -DCAN_DLL_NUMOF=2 endif diff --git a/cpu/native/Makefile.include b/cpu/native/Makefile.include index 279ff4f412..8791a735a4 100644 --- a/cpu/native/Makefile.include +++ b/cpu/native/Makefile.include @@ -6,7 +6,10 @@ ifeq ($(BUILDOSXNATIVE),1) endif ifneq (,$(filter periph_can,$(USEMODULE))) - LINKFLAGS += -lsocketcan + ifeq (,$(filter libsocketcan,$(USEPKG))) + # link system libsocketcan if not using the provided package + LINKFLAGS += -lsocketcan + endif endif TOOLCHAINS_SUPPORTED = gnu llvm afl