59 lines
2.8 KiB
Makefile
59 lines
2.8 KiB
Makefile
# Compiler and flags
|
|
CPPC = g++
|
|
CPPC_FLAGS = -std=c++23 -s -O3 -Wall -Wextra -Wno-write-strings -lssl -lcrypto -Wformat -Wformat=2 -Wconversion -Wimplicit-fallthrough -Werror=format-security -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 -Wl,--as-needed -Wl,--no-copy-dt-needed-entries -fPIE -pie -fcf-protection=full -fstack-protector -fstack-protector-all -fstack-protector-strong
|
|
DEBUG_FLAGS = -ggdb -std=c++23 -Wall -Wextra -Wno-write-strings -lssl -lcrypto -Wformat -Wformat=2 -Wconversion -Wimplicit-fallthrough -Werror=format-security -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 -Wl,--as-needed -Wl,--no-copy-dt-needed-entries -fPIE -pie -fcf-protection=full -fstack-protector -fstack-protector-all -fstack-protector-strong
|
|
DEBUG_ASANITIZE = -fsanitize=address -ggdb -fno-omit-frame-pointer -std=c++23 -Wall -Wextra -Wno-write-strings -lssl -lcrypto -Wformat -Wformat=2 -Wconversion -Wimplicit-fallthrough -Werror=format-security -D_FORTIFY_SOURCE=5 -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 -Wl,--as-needed -Wl,--no-copy-dt-needed-entries -fPIE -pie -fcf-protection=full -fstack-protector -fstack-protector-all -fstack-protector-strong
|
|
|
|
|
|
SRC_PATH_CLIENT := client
|
|
SRC_PATH_RELAY := relay
|
|
OBJ_PATH_CLIENT := build/obj/client
|
|
OBJ_PATH_RELAY := build/obj/relay
|
|
OBJ_PATH := build/obj
|
|
BIN_PATH := build/bin
|
|
|
|
|
|
SRC_FILES_CLIENT := $(shell find $(SRC_PATH_CLIENT) -name '*.cpp')
|
|
OBJ_FILES_CLIENT := $(patsubst $(SRC_PATH_CLIENT)/%.cpp,$(OBJ_PATH_CLIENT)/%.o,$(SRC_FILES_CLIENT))
|
|
|
|
SRC_FILES_RELAY := $(shell find $(SRC_PATH_RELAY) -name '*.cpp')
|
|
OBJ_FILES_RELAY := $(patsubst $(SRC_PATH_RELAY)/%.cpp,$(OBJ_PATH_RELAY)/%.o,$(SRC_FILES_RELAY))
|
|
|
|
all: make-build-dir $(BIN_PATH)/pupes-message $(BIN_PATH)/pupes-message-relay
|
|
|
|
|
|
debug: CPPC_FLAGS = $(DEBUG_FLAGS)
|
|
debug: make-build-dir $(BIN_PATH)/pupes-message $(BIN_PATH)/pupes-message-relay
|
|
|
|
asan: CPPC_FLAGS = $(DEBUG_ASANITIZE)
|
|
asan: make-build-dir $(BIN_PATH)/pupes-message $(BIN_PATH)/pupes-message-relay
|
|
|
|
|
|
make-build-dir:
|
|
mkdir -p $(OBJ_PATH_CLIENT)
|
|
mkdir -p $(OBJ_PATH_RELAY)
|
|
mkdir -p $(BIN_PATH)
|
|
|
|
|
|
$(BIN_PATH)/pupes-message: $(OBJ_FILES_CLIENT)
|
|
$(CPPC) $(CPPC_FLAGS) $^ -o $@
|
|
|
|
$(BIN_PATH)/pupes-message-relay: $(OBJ_FILES_RELAY)
|
|
$(CPPC) $(CPPC_FLAGS) $^ -o $@
|
|
|
|
|
|
$(OBJ_PATH_CLIENT)/%.o: $(SRC_PATH_CLIENT)/%.cpp
|
|
$(CPPC) $(CPPC_FLAGS) -c $< -o $@
|
|
|
|
$(OBJ_PATH_RELAY)/%.o: $(SRC_PATH_RELAY)/%.cpp
|
|
$(CPPC) $(CPPC_FLAGS) -c $< -o $@
|
|
|
|
|
|
install:
|
|
@install -vpm 755 -o root -g root $(BIN_PATH)/pupes-message /usr/bin/
|
|
|
|
clean:
|
|
rm -fr build
|
|
|
|
.PHONY: all clean install debug asan
|