diff --git a/pkg/u8g2/Makefile b/pkg/u8g2/Makefile index 88f329fa91..eda88604b5 100644 --- a/pkg/u8g2/Makefile +++ b/pkg/u8g2/Makefile @@ -5,11 +5,8 @@ PKG_LICENSE=BSD-2-Clause include $(RIOTBASE)/pkg/pkg.mk -all: - cp src/Makefile $(PKG_BUILDDIR)/Makefile - cp src/csrc/Makefile $(PKG_BUILDDIR)/csrc/Makefile - cp src/csrc/u8x8_riotos.c $(PKG_BUILDDIR)/csrc/u8x8_riotos.c - cp src/csrc/u8x8_riotos.h $(PKG_BUILDDIR)/csrc/u8x8_riotos.h - cp src/sys/sdl/common/Makefile $(PKG_BUILDDIR)/sys/sdl/common/Makefile - cp src/sys/utf8/common/Makefile $(PKG_BUILDDIR)/sys/utf8/common/Makefile - "$(MAKE)" -C $(PKG_BUILDDIR) +all: $(filter u8g2_%,$(filter-out u8g2_csrc%, $(USEMODULE))) + "$(MAKE)" -C $(PKG_BUILDDIR)/csrc -f $(CURDIR)/Makefile.$(PKG_NAME)_csrc + +u8g2_%: + "$(MAKE)" -C $(PKG_BUILDDIR)/sys/$*/common -f $(CURDIR)/Makefile.$(PKG_NAME)_$* diff --git a/pkg/u8g2/Makefile.dep b/pkg/u8g2/Makefile.dep index 3f84da5234..24df6f6fda 100644 --- a/pkg/u8g2/Makefile.dep +++ b/pkg/u8g2/Makefile.dep @@ -1,3 +1,6 @@ USEMODULE += xtimer FEATURES_REQUIRED += periph_gpio + +USEMODULE += u8g2_csrc_riot +USEMODULE += u8g2_csrc diff --git a/pkg/u8g2/Makefile.include b/pkg/u8g2/Makefile.include index f7043da7a7..6bddd0fc8d 100644 --- a/pkg/u8g2/Makefile.include +++ b/pkg/u8g2/Makefile.include @@ -1,9 +1,14 @@ INCLUDES += -I$(PKGDIRBASE)/u8g2/csrc +INCLUDES += -I$(RIOTBASE)/pkg/u8g2/contrib + +DIRS += $(RIOTBASE)/pkg/u8g2/contrib # The RIOT-OS interface needs this to store peripheral information. CFLAGS += -DU8X8_WITH_USER_PTR # Link SDL if enabled. ifneq (,$(filter u8g2_sdl,$(USEMODULE))) - LINKFLAGS += `sdl2-config --libs` + LINKFLAGS += $(shell sdl2-config --libs) endif + +PSEUDOMODULES += u8g2 diff --git a/pkg/u8g2/src/csrc/Makefile b/pkg/u8g2/Makefile.u8g2 similarity index 100% rename from pkg/u8g2/src/csrc/Makefile rename to pkg/u8g2/Makefile.u8g2 diff --git a/pkg/u8g2/Makefile.u8g2_csrc b/pkg/u8g2/Makefile.u8g2_csrc new file mode 100644 index 0000000000..8f7452fcc7 --- /dev/null +++ b/pkg/u8g2/Makefile.u8g2_csrc @@ -0,0 +1,9 @@ +MODULE = u8g2_csrc + +CFLAGS += -Wno-overlength-strings + +ifeq (llvm,$(TOOLCHAIN)) + CFLAGS += -Wno-newline-eof +endif + +include $(RIOTBASE)/Makefile.base diff --git a/pkg/u8g2/Makefile.u8g2_sdl b/pkg/u8g2/Makefile.u8g2_sdl new file mode 100644 index 0000000000..f41a171a65 --- /dev/null +++ b/pkg/u8g2/Makefile.u8g2_sdl @@ -0,0 +1,13 @@ +MODULE = u8g2_sdl + +CFLAGS += $(shell sdl2-config --cflags) + +# Ignore warning generated when compiling this module +CFLAGS += -Wno-empty-translation-unit \ + -Wno-newline-eof \ + -Wno-unused-parameter \ + -Wno-unused \ + -Wno-overlength-strings \ + -Wno-pointer-arith + +include $(RIOTBASE)/Makefile.base diff --git a/pkg/u8g2/src/sys/utf8/common/Makefile b/pkg/u8g2/Makefile.u8g2_utf8 similarity index 100% rename from pkg/u8g2/src/sys/utf8/common/Makefile rename to pkg/u8g2/Makefile.u8g2_utf8 diff --git a/pkg/u8g2/contrib/Makefile b/pkg/u8g2/contrib/Makefile new file mode 100644 index 0000000000..d7535deff7 --- /dev/null +++ b/pkg/u8g2/contrib/Makefile @@ -0,0 +1,3 @@ +MODULE = u8g2_csrc_riot + +include $(RIOTBASE)/Makefile.base diff --git a/pkg/u8g2/src/csrc/u8x8_riotos.c b/pkg/u8g2/contrib/u8x8_riotos.c similarity index 100% rename from pkg/u8g2/src/csrc/u8x8_riotos.c rename to pkg/u8g2/contrib/u8x8_riotos.c diff --git a/pkg/u8g2/src/csrc/u8x8_riotos.h b/pkg/u8g2/contrib/u8x8_riotos.h similarity index 100% rename from pkg/u8g2/src/csrc/u8x8_riotos.h rename to pkg/u8g2/contrib/u8x8_riotos.h diff --git a/pkg/u8g2/src/Makefile b/pkg/u8g2/src/Makefile deleted file mode 100644 index 419ebdb198..0000000000 --- a/pkg/u8g2/src/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -MODULE = pkg-u8g2 - -DIRS += csrc - -# SDL can be used as a virtual display, but is for native target only. -ifneq (,$(filter u8g2_sdl,$(USEMODULE))) - DIRS += sys/sdl/common -endif - -# UTF8 virtual display is not part of core. Therefore it is a separate module. -ifneq (,$(filter u8g2_utf8,$(USEMODULE))) - DIRS += sys/utf8/common -endif - -# Compiling U8g2 will generate a lot of compiler warnings, which are treated -# as errors. For the sake of simplicity, ignore them. -CFLAGS += -Wno-empty-translation-unit \ - -Wno-newline-eof \ - -Wno-unused-parameter \ - -Wno-unused \ - -Wno-overlength-strings \ - -Wno-pointer-arith - -include $(RIOTBASE)/Makefile.base diff --git a/pkg/u8g2/src/sys/sdl/common/Makefile b/pkg/u8g2/src/sys/sdl/common/Makefile deleted file mode 100644 index 5d0aed4015..0000000000 --- a/pkg/u8g2/src/sys/sdl/common/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -MODULE = u8g2_sdl - -CFLAGS += `sdl2-config --cflags` - -include $(RIOTBASE)/Makefile.base