libZRCola: Make parts of the gcc building reusable

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2022-09-15 08:39:10 +02:00
parent eedab7da56
commit 823390d28b
3 changed files with 20 additions and 17 deletions

11
include/props.mak Normal file
View File

@ -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)

5
include/targets.mak Normal file
View File

@ -0,0 +1,5 @@
%.h.gch: %.h
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -x c++-header -o $@ -c $<
%.cpp.o: %.cpp
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ -c $<

View File

@ -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)