From 1a20ce54434f09a6602b8b1da7d489e2e790bfd1 Mon Sep 17 00:00:00 2001 From: Geoffrey Merck Date: Sat, 29 Jan 2022 17:29:27 +0100 Subject: [PATCH] #17 Add BaseCommon --- .vscode/tasks.json | 10 +++++----- CCITTChecksum.cpp => BaseCommon/CCITTChecksum.cpp | 0 CCITTChecksum.h => BaseCommon/CCITTChecksum.h | 0 Config.cpp => BaseCommon/Config.cpp | 0 Config.h => BaseCommon/Config.h | 0 Log.cpp => BaseCommon/Log.cpp | 0 Log.h => BaseCommon/Log.h | 0 .../LogConsoleTarget.cpp | 0 .../LogConsoleTarget.h | 0 LogFileTarget.cpp => BaseCommon/LogFileTarget.cpp | 0 LogFileTarget.h => BaseCommon/LogFileTarget.h | 0 LogSeverity.h => BaseCommon/LogSeverity.h | 0 LogTarget.cpp => BaseCommon/LogTarget.cpp | 0 LogTarget.h => BaseCommon/LogTarget.h | 0 BaseCommon/Makefile | 12 ++++++++++++ NetUtils.cpp => BaseCommon/NetUtils.cpp | 0 NetUtils.h => BaseCommon/NetUtils.h | 0 RingBuffer.h => BaseCommon/RingBuffer.h | 0 SHA256.cpp => BaseCommon/SHA256.cpp | 0 SHA256.h => BaseCommon/SHA256.h | 0 StringUtils.cpp => BaseCommon/StringUtils.cpp | 0 StringUtils.h => BaseCommon/StringUtils.h | 0 Thread.cpp => BaseCommon/Thread.cpp | 0 Thread.h => BaseCommon/Thread.h | 0 Timer.cpp => BaseCommon/Timer.cpp | 0 Timer.h => BaseCommon/Timer.h | 0 Utils.cpp => BaseCommon/Utils.cpp | 0 Utils.h => BaseCommon/Utils.h | 0 Makefile | 14 +++++++++----- 29 files changed, 26 insertions(+), 10 deletions(-) rename CCITTChecksum.cpp => BaseCommon/CCITTChecksum.cpp (100%) rename CCITTChecksum.h => BaseCommon/CCITTChecksum.h (100%) rename Config.cpp => BaseCommon/Config.cpp (100%) rename Config.h => BaseCommon/Config.h (100%) rename Log.cpp => BaseCommon/Log.cpp (100%) rename Log.h => BaseCommon/Log.h (100%) rename LogConsoleTarget.cpp => BaseCommon/LogConsoleTarget.cpp (100%) rename LogConsoleTarget.h => BaseCommon/LogConsoleTarget.h (100%) rename LogFileTarget.cpp => BaseCommon/LogFileTarget.cpp (100%) rename LogFileTarget.h => BaseCommon/LogFileTarget.h (100%) rename LogSeverity.h => BaseCommon/LogSeverity.h (100%) rename LogTarget.cpp => BaseCommon/LogTarget.cpp (100%) rename LogTarget.h => BaseCommon/LogTarget.h (100%) create mode 100644 BaseCommon/Makefile rename NetUtils.cpp => BaseCommon/NetUtils.cpp (100%) rename NetUtils.h => BaseCommon/NetUtils.h (100%) rename RingBuffer.h => BaseCommon/RingBuffer.h (100%) rename SHA256.cpp => BaseCommon/SHA256.cpp (100%) rename SHA256.h => BaseCommon/SHA256.h (100%) rename StringUtils.cpp => BaseCommon/StringUtils.cpp (100%) rename StringUtils.h => BaseCommon/StringUtils.h (100%) rename Thread.cpp => BaseCommon/Thread.cpp (100%) rename Thread.h => BaseCommon/Thread.h (100%) rename Timer.cpp => BaseCommon/Timer.cpp (100%) rename Timer.h => BaseCommon/Timer.h (100%) rename Utils.cpp => BaseCommon/Utils.cpp (100%) rename Utils.h => BaseCommon/Utils.h (100%) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index ac3f100..168ca95 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -12,7 +12,10 @@ "ENABLE_DEBUG=1", "USE_GPSD=1" ], - "group": "build", + "group": { + "kind": "build", + "isDefault": true + }, "problemMatcher": [] }, { @@ -25,10 +28,7 @@ "ENABLE_DEBUG=1", "USE_GPSD=1" ], - "group": { - "kind": "build", - "isDefault": true - }, + "group": "build", "problemMatcher": [] } ] diff --git a/CCITTChecksum.cpp b/BaseCommon/CCITTChecksum.cpp similarity index 100% rename from CCITTChecksum.cpp rename to BaseCommon/CCITTChecksum.cpp diff --git a/CCITTChecksum.h b/BaseCommon/CCITTChecksum.h similarity index 100% rename from CCITTChecksum.h rename to BaseCommon/CCITTChecksum.h diff --git a/Config.cpp b/BaseCommon/Config.cpp similarity index 100% rename from Config.cpp rename to BaseCommon/Config.cpp diff --git a/Config.h b/BaseCommon/Config.h similarity index 100% rename from Config.h rename to BaseCommon/Config.h diff --git a/Log.cpp b/BaseCommon/Log.cpp similarity index 100% rename from Log.cpp rename to BaseCommon/Log.cpp diff --git a/Log.h b/BaseCommon/Log.h similarity index 100% rename from Log.h rename to BaseCommon/Log.h diff --git a/LogConsoleTarget.cpp b/BaseCommon/LogConsoleTarget.cpp similarity index 100% rename from LogConsoleTarget.cpp rename to BaseCommon/LogConsoleTarget.cpp diff --git a/LogConsoleTarget.h b/BaseCommon/LogConsoleTarget.h similarity index 100% rename from LogConsoleTarget.h rename to BaseCommon/LogConsoleTarget.h diff --git a/LogFileTarget.cpp b/BaseCommon/LogFileTarget.cpp similarity index 100% rename from LogFileTarget.cpp rename to BaseCommon/LogFileTarget.cpp diff --git a/LogFileTarget.h b/BaseCommon/LogFileTarget.h similarity index 100% rename from LogFileTarget.h rename to BaseCommon/LogFileTarget.h diff --git a/LogSeverity.h b/BaseCommon/LogSeverity.h similarity index 100% rename from LogSeverity.h rename to BaseCommon/LogSeverity.h diff --git a/LogTarget.cpp b/BaseCommon/LogTarget.cpp similarity index 100% rename from LogTarget.cpp rename to BaseCommon/LogTarget.cpp diff --git a/LogTarget.h b/BaseCommon/LogTarget.h similarity index 100% rename from LogTarget.h rename to BaseCommon/LogTarget.h diff --git a/BaseCommon/Makefile b/BaseCommon/Makefile new file mode 100644 index 0000000..dc769f0 --- /dev/null +++ b/BaseCommon/Makefile @@ -0,0 +1,12 @@ +SRCS = $(wildcard *.cpp) +OBJS = $(SRCS:.cpp=.o) +DEPS = $(SRCS:.cpp=.d) + +BaseCommon.a: $(OBJS) + $(AR) rcs BaseCommon.a $(OBJS) + +%.o : %.cpp + $(CC) $(CPPFLAGS) -MMD -MD -c $< -o $@ + +clean: + $(RM) *.o *.d BaseCommon.a \ No newline at end of file diff --git a/NetUtils.cpp b/BaseCommon/NetUtils.cpp similarity index 100% rename from NetUtils.cpp rename to BaseCommon/NetUtils.cpp diff --git a/NetUtils.h b/BaseCommon/NetUtils.h similarity index 100% rename from NetUtils.h rename to BaseCommon/NetUtils.h diff --git a/RingBuffer.h b/BaseCommon/RingBuffer.h similarity index 100% rename from RingBuffer.h rename to BaseCommon/RingBuffer.h diff --git a/SHA256.cpp b/BaseCommon/SHA256.cpp similarity index 100% rename from SHA256.cpp rename to BaseCommon/SHA256.cpp diff --git a/SHA256.h b/BaseCommon/SHA256.h similarity index 100% rename from SHA256.h rename to BaseCommon/SHA256.h diff --git a/StringUtils.cpp b/BaseCommon/StringUtils.cpp similarity index 100% rename from StringUtils.cpp rename to BaseCommon/StringUtils.cpp diff --git a/StringUtils.h b/BaseCommon/StringUtils.h similarity index 100% rename from StringUtils.h rename to BaseCommon/StringUtils.h diff --git a/Thread.cpp b/BaseCommon/Thread.cpp similarity index 100% rename from Thread.cpp rename to BaseCommon/Thread.cpp diff --git a/Thread.h b/BaseCommon/Thread.h similarity index 100% rename from Thread.h rename to BaseCommon/Thread.h diff --git a/Timer.cpp b/BaseCommon/Timer.cpp similarity index 100% rename from Timer.cpp rename to BaseCommon/Timer.cpp diff --git a/Timer.h b/BaseCommon/Timer.h similarity index 100% rename from Timer.h rename to BaseCommon/Timer.h diff --git a/Utils.cpp b/BaseCommon/Utils.cpp similarity index 100% rename from Utils.cpp rename to BaseCommon/Utils.cpp diff --git a/Utils.h b/BaseCommon/Utils.h similarity index 100% rename from Utils.h rename to BaseCommon/Utils.h diff --git a/Makefile b/Makefile index 86bc984..97b259f 100644 --- a/Makefile +++ b/Makefile @@ -45,11 +45,14 @@ DEPS = $(SRCS:.cpp=.d) .PHONY: all all: dstargateway -dstargateway : GitVersion.h $(OBJS) - $(CC) $(CPPFLAGS) -o dstargateway $(OBJS) $(LDFLAGS) +dstargateway : GitVersion.h $(OBJS) BaseCommon/BaseCommon.a + $(CC) $(CPPFLAGS) -o dstargateway $(OBJS) BaseCommon/BaseCommon.a $(LDFLAGS) %.o : %.cpp - $(CC) $(CPPFLAGS) -MMD -MD -c $< -o $@ + $(CC) -IBaseCommon/ $(CPPFLAGS) -MMD -MD -c $< -o $@ + +BaseCommon/BaseCommon.a: FORCE + $(MAKE) -C BaseCommon GitVersion.h : FORCE ifneq ("$(wildcard .git/index)","") @@ -71,8 +74,9 @@ endif .PHONY: clean clean: - @$(RM) GitVersion.h $(OBJS) $(DEPS) dstargateway - @$(MAKE) -C Tests clean + $(RM) GitVersion.h *.o *.d dstargateway + $(MAKE) -C Tests clean + $(MAKE) -C BaseCommon clean -include $(DEPS)