From d4ba520fd32eea9109a4f76e66674b35ec45e8c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Thu, 2 Feb 2017 13:12:31 +0100 Subject: Compile liblcd directly Makefile in liblcd makes more problems than solves. I am just ignoring it. --- .gitmodules | 2 +- Makefile | 41 ++++++++++++++++++----------------------- liblcd | 1 - src/liblcd | 1 + 4 files changed, 20 insertions(+), 25 deletions(-) delete mode 160000 liblcd create mode 160000 src/liblcd diff --git a/.gitmodules b/.gitmodules index 8f42eb3..18f6fa6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "liblcd"] - path = liblcd + path = src/liblcd url = https://github.com/Cynerd/liquidcrystal-i2c.git diff --git a/Makefile b/Makefile index 4b2e274..cd1a310 100644 --- a/Makefile +++ b/Makefile @@ -17,20 +17,25 @@ all: $(O)/turris-lcd ifeq ($(DEBUG),yes) CFLAGS += -ggdb -DDEBUG endif -CFLAGS += -Wall -CFLAGS += -Iliblcd +CFLAGS += -Isrc/liblcd # Apply CPREFIX CXX:=$(CPREFIX)$(CXX) ### Source files list ########################### -SRC = turris-lcd.cpp +SRC = turris-lcd.cpp \ + liblcd/I2CIO.cpp \ + liblcd/LCD.cpp \ + liblcd/LiquidCrystal.cpp \ + liblcd/LiquidCrystal_I2C.cpp \ + liblcd/smbus.c ### End of source files list #################### -CSRC = $(patsubst %,src/%,$(filter %.cpp,$(SRC))) +CPPSRC = $(patsubst %,src/%,$(filter %.cpp,$(SRC))) +CSRC = $(patsubst %,src/%,$(filter %.c,$(SRC))) -OBJ = $(patsubst src/%.cpp,$(O)/build/%.o,$(CSRC)) -DEP = $(patsubst src/%.cpp,$(O)/build/%.d,$(CSRC)) +CPPOBJ = $(patsubst src/%.cpp,$(O)/build/%.o,$(CPPSRC)) +COBJ = $(patsubst src/%.c,$(O)/build/%.o,$(CSRC)) .PHONY: help help: @@ -54,35 +59,25 @@ clean:: prune:: clean @echo " CLEAN configuration" $(Q)$(RM) $(O)/.config $(O)/.config.mk - @echo " CLEAN liblcd" - $(Q)$(MAKE) -C liblcd clean - $(Q)$(RM) liblcd/libliquidcrystali2c.a ## Building targets ## ifeq (,$(filter clean prune help \ ,$(MAKECMDGOALS))) # Ignore build targets if goal is not building -ifeq ($(DEBUG),yes) --include $(DEP) # If developing, use dependencies from source files -.PHONY: dependency dep -dependency dep:: $(DEP) -$(DEP): $(O)/build/%.d: src/%.cpp - @mkdir -p "$(@D)" - @echo " DEP $@" - $(Q)$(CXX) -MM -MG -MT '$*.o $@' $(CFLAGS) $< -MF $@ -endif # DEBUG - -$(O)/turris-lcd: $(OBJ) liblcd/libliquidcrystali2c.a +$(O)/turris-lcd: $(COBJ) $(CPPOBJ) @echo " LD $@" $(Q)$(CXX) $(LDFLAGS) $^ -o $@ -$(OBJ): $(O)/build/%.o: src/%.cpp +# We use CXX intensionally even on C files +$(COBJ): $(O)/build/%.o: src/%.c @mkdir -p "$(@D)" @echo " CXX $@" $(Q)$(CXX) -c $(CFLAGS) $< -o $@ -liblcd/libliquidcrystali2c.a: - $(Q)$(MAKE) -C liblcd static +$(CPPOBJ): $(O)/build/%.o: src/%.cpp + @mkdir -p "$(@D)" + @echo " CXX $@" + $(Q)$(CXX) -c $(CFLAGS) $< -o $@ endif ## Configuation files ## diff --git a/liblcd b/liblcd deleted file mode 160000 index 9d2a982..0000000 --- a/liblcd +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9d2a982638e8b84fa335e29b8fe7fdf17ea8aede diff --git a/src/liblcd b/src/liblcd new file mode 160000 index 0000000..9d2a982 --- /dev/null +++ b/src/liblcd @@ -0,0 +1 @@ +Subproject commit 9d2a982638e8b84fa335e29b8fe7fdf17ea8aede -- cgit v1.2.3