From 823390d28b98a58a4789443c4ce5c901141d01fd Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Thu, 15 Sep 2022 08:39:10 +0200 Subject: [PATCH] libZRCola: Make parts of the gcc building reusable Signed-off-by: Simon Rozman --- include/props.mak | 11 +++++++++++ include/targets.mak | 5 +++++ lib/libZRCola/build/Makefile | 21 ++++----------------- 3 files changed, 20 insertions(+), 17 deletions(-) create mode 100644 include/props.mak create mode 100644 include/targets.mak diff --git a/include/props.mak b/include/props.mak new file mode 100644 index 0000000..56245fe --- /dev/null +++ b/include/props.mak @@ -0,0 +1,11 @@ +CPPFLAGS := $(CPPFLAGS) -MMD -MP +ifeq ($(CFG),Debug) +CPPFLAGS := $(CPPFLAGS) -D_DEBUG +CXXFLAGS := -Og +else +CPPFLAGS := $(CPPFLAGS) -DNDEBUG +CXXFLAGS := -O3 +endif + +OBJS := $(SRCS:%=%.o) +DEPS := $(OBJS:.o=.d) diff --git a/include/targets.mak b/include/targets.mak new file mode 100644 index 0000000..aeba1bb --- /dev/null +++ b/include/targets.mak @@ -0,0 +1,5 @@ +%.h.gch: %.h + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -x c++-header -o $@ -c $< + +%.cpp.o: %.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ -c $< diff --git a/lib/libZRCola/build/Makefile b/lib/libZRCola/build/Makefile index 9313797..e3f9dc3 100644 --- a/lib/libZRCola/build/Makefile +++ b/lib/libZRCola/build/Makefile @@ -1,12 +1,4 @@ -CPPFLAGS := $(CPPFLAGS) -MMD -MP -I../../stdex/include -ifeq ($(CFG),Debug) -CPPFLAGS := $(CPPFLAGS) -D_DEBUG -CXXFLAGS := -Og -else -CPPFLAGS := $(CPPFLAGS) -DNDEBUG -CXXFLAGS := -O3 -endif - +CPPFLAGS := -I../../stdex/include SRCS := \ ../src/character.cpp \ ../src/common.cpp \ @@ -16,20 +8,15 @@ SRCS := \ ../src/pch.cpp \ ../src/tag.cpp \ ../src/translate.cpp -OBJS := $(SRCS:%=%.o) -DEPS := $(OBJS:.o=.d) + +include ../../../include/props.mak ../lib/libZRCola.a : ../src/pch.h.gch $(OBJS) $(AR) $(ARFLAGS) $@ $(OBJS) -%.h.gch: %.h - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -x c++-header -o $@ -c $< - -%.cpp.o: %.cpp - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ -c $< - .PHONY: clean clean: -rm -r ../src/*.h.gch ../src/*.cpp.o ../lib/libZRCola.a +include ../../../include/targets.mak -include $(DEPS)