From 77e3398e24b35b5fcc7e164162974874052cc621 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Boh=C3=A1=C4=8Dek?= Date: Sun, 20 Jun 2021 21:17:05 +0200 Subject: [PATCH] feat: add text viewer base --- text-viewer/.gitignore | 4 +++ text-viewer/Makefile | 69 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 text-viewer/.gitignore create mode 100644 text-viewer/Makefile diff --git a/text-viewer/.gitignore b/text-viewer/.gitignore new file mode 100644 index 0000000..dec0966 --- /dev/null +++ b/text-viewer/.gitignore @@ -0,0 +1,4 @@ +connect.gdb + +obj/ +bin/ diff --git a/text-viewer/Makefile b/text-viewer/Makefile new file mode 100644 index 0000000..ff3540b --- /dev/null +++ b/text-viewer/Makefile @@ -0,0 +1,69 @@ +SRC_DIR=./src +OBJ_DIR=./obj +BIN_DIR?=./bin +INC_DIR=-I./include $(INHERIT_INCLUDES) +LIB_DIR?= + +ifdef COMPUTER + CC = clang +else + CC = arm-linux-gnueabihf-gcc + CXX = arm-linux-gnueabihf-g++ +endif + +CPPFLAGS = -I . +CFLAGS =-g -std=gnu99 -O1 -Wall -D ILI9481 +CXXFLAGS = -g -std=gnu++11 -O1 -Wall + +ifdef COMPUTER +LDFLAGS = -lrt -lmzapo_pheripherals -lpthread -lmagic -ljpeg -lpng $(shell sdl2-config --libs) -lSDL2_image +CFLAGS += -DCOMPUTER $(shell sdl2-config --cflags) +else +LDFLAGS = -lrt -lmzapo_pheripherals -lpthread -l :libmagic.so.1 -l :libjpeg.so.62 -l :libz.so -l :libpng16.so.16 +endif +LDFLAGS += -Wl,-rpath,'$${ORIGIN}' $(LIB_DIR) + +NAME=text-viewer +BINARY=$(BIN_DIR)/$(NAME) + +SRC=$(wildcard $(SRC_DIR)/*.c) +OBJ=$(patsubst $(SRC_DIR)/%.c, $(OBJ_DIR)/%.o, $(SRC)) + +CFLAGS+=$(INC_DIR) -Wall -Werror +CFLAGS+=$(shell sdl2-config --cflags) + +.PHONY: all clean + +all: $(BINARY) + +$(BINARY): $(OBJ) | $(BIN_DIR) + $(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@ + +$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c | $(OBJ_DIR) + $(CC) $(CFLAGS) -c $< -o $@ + +$(BIN_DIR) $(OBJ_DIR): + echo $(BIN_DIR) + mkdir -p $@ + +dep: depend + +depend: $(SRC) $(HEADERS) + echo '# autogenerated dependencies' > depend +ifneq ($(filter %.c,$(SRC)),) + $(CC) $(CFLAGS) $(CPPFLAGS) -w -E -M $(filter %.c,$(SRC)) \ + >> depend +endif +ifneq ($(filter %.cpp,$(SRC)),) + $(CXX) $(CXXFLAGS) $(CPPFLAGS) -w -E -M $(filter %.cpp,$(SRC)) \ + >> depend +endif + +clean: + $(RM) -rv $(BIN_DIR) $(OBJ_DIR) + $(RM) -rv .cache + $(RM) -rv connect.gdb + $(RM) -rv depend + +-include $(OBJ:.o=.d) +-include depend -- 2.48.1