From 1d4790886a7f7c813e0ee138e1f5da08a1bc99cb Mon Sep 17 00:00:00 2001 From: Stefan `Sec` Zehl Date: Sat, 21 May 2011 19:12:51 +0200 Subject: [PATCH] Improve dependencies in lcd/ - add generated lcd/allfonts.h to avoid including all the fonts one by one --- .gitignore | 1 + lcd/Makefile | 28 +++++++++++++++++++--------- main.c | 2 -- modules/sec.c | 3 +-- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index bcf45d1..11042bb 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ firmware.elf *.swp lpc1xxx/memory.ld modules/wrapper.c +lcd/allfonts.h diff --git a/lcd/Makefile b/lcd/Makefile index d0d8472..d389278 100644 --- a/lcd/Makefile +++ b/lcd/Makefile @@ -3,16 +3,19 @@ ########################################################################## OBJS = -OBJS += smallfonts.o - -OBJS += ubuntu18.o -OBJS += orbitron14.o OBJS += display.o OBJS += render.o OBJS += decoder.o OBJS += backlight.o +FONTS = +FONTS += smallfonts +FONTS += ubuntu18 +FONTS += orbitron14 + +LIBNAME=lcd + ########################################################################## # GNU GCC compiler flags ########################################################################## @@ -21,21 +24,28 @@ INCLUDE_PATHS = -I$(ROOT_PATH) -I../core -I. include $(ROOT_PATH)/Makefile.inc +FOBJS= $(foreach ft,$(FONTS),$(ft).o) +OBJS+= $(FOBJS) +LIBFILE=lib$(LIBNAME).a ########################################################################## # Compiler settings, parameters and flags ########################################################################## -all: libfont.a +all: $(LIBFILE) allfonts.h -libfont.a: $(OBJS) - $(AR) rcs libfont.a $(OBJS) +$(LIBFILE): $(OBJS) + $(AR) rcs $@ $(OBJS) %.o : %.c $(CC) $(CFLAGS) -o $@ $< +$(FOBJS): $(foreach ft,$(FONTS),$(ft).h) fonts.h + clean: - rm -f $(OBJS) libfont.a + rm -f $(OBJS) $(LIBFILE) allfonts.h render.o: render.c render.h display.h fonts.h -smallfonts.o: smallfonts.c smallfonts.h fonts.h +.PHONY: allfonts.h +allfonts.h: + for a in $(FONTS) ; do echo "#include "; done > $@ diff --git a/main.c b/main.c index 904a71b..4a6ab82 100644 --- a/main.c +++ b/main.c @@ -3,8 +3,6 @@ #include "basic/basic.h" #include "lcd/render.h" -#include "lcd/smallfonts.h" -#include "lcd/ubuntu18.h" #include "pmu/pmu.h" #include "eeprom/eeprom.h" diff --git a/modules/sec.c b/modules/sec.c index 46fb6ed..0b9df3f 100644 --- a/modules/sec.c +++ b/modules/sec.c @@ -3,8 +3,7 @@ #include "basic/basic.h" #include "lcd/render.h" -#include "lcd/smallfonts.h" -#include "lcd/ubuntu18.h" +#include "lcd/allfonts.h" void ReinvokeISP(void);