aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <karel.koci@nic.cz>2017-02-02 13:12:31 +0100
committerKarel Kočí <karel.koci@nic.cz>2017-02-02 13:12:31 +0100
commitd4ba520fd32eea9109a4f76e66674b35ec45e8c0 (patch)
treecc8bc204f51bb42046259202698b47105d069498
parent518db760e2dbcfd0bf71ff3123e10f8a5d9140f8 (diff)
downloadturris-lcd-example-d4ba520fd32eea9109a4f76e66674b35ec45e8c0.tar.gz
turris-lcd-example-d4ba520fd32eea9109a4f76e66674b35ec45e8c0.tar.bz2
turris-lcd-example-d4ba520fd32eea9109a4f76e66674b35ec45e8c0.zip
Compile liblcd directly
Makefile in liblcd makes more problems than solves. I am just ignoring it.
-rw-r--r--.gitmodules2
-rw-r--r--Makefile41
m---------src/liblcd (renamed from liblcd)0
3 files changed, 19 insertions, 24 deletions
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/src/liblcd
-Subproject 9d2a982638e8b84fa335e29b8fe7fdf17ea8aed
+Subproject 9d2a982638e8b84fa335e29b8fe7fdf17ea8aed