COMMON_CXXFLAGS = -Wall -Wextra -Wpedantic -std=c++20 \ -Wformat -Wformat=2 -Wconversion -Wimplicit-fallthrough \ -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 \ -D_GLIBCXX_ASSERTIONS \ -fstrict-flex-arrays=3 \ -fstack-clash-protection -fstack-protector-strong \ -Wl,-z,nodlopen -Wl,-z,noexecstack \ -Wl,-z,relro -Wl,-z,now ifdef DEBUG CXXFLAGS = -Og -g ${COMMON_CXXFLAGS} else CXXFLAGS = -O2 ${COMMON_CXXFLAGS} endif OBJDIR = objects SOURCES = src/main.cpp OBJECTS = $(addprefix ${OBJDIR}/,$(patsubst %.cpp,%.cpp.o,${SOURCES})) all: KoreanNumbers KoreanNumbers: ${OBJECTS} $(CXX) $(CXXFLAGS) -fPIE -pie -o KoreanNumbers $^ ${OBJDIR}/%.cpp.o: %.cpp @mkdir -p $(dir $@) $(CXX) $(CXXFLAGS) -c -o $@ $< .PHONY: clean: rm -f KoreanNumbers rm -rf ${OBJDIR}