-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tuprules.tup
41 lines (33 loc) · 1.62 KB
/
Tuprules.tup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
ROOT = $(TUP_CWD)
DEFINES_CONFIG_FILE = $(ROOT)/defines.cfg
SRC_PATH = $(ROOT)/src
THIRD_PARTY_PATH = $(ROOT)/third_party
BIN_TARGET = $(ROOT)/ts-server
CFLAGS += -std=c++17
# CFLAGS += -flto
CFLAGS += -Wall -Werror -Wno-deprecated-declarations -Wno-missing-braces -Wno-unused -Wno-expansion-to-defined -Wno-error=address
CFLAGS += -I$(SRC_PATH) -I$(THIRD_PARTY_PATH) -I$(THIRD_PARTY_PATH)/spdlog/include -I$(THIRD_PARTY_PATH)/rapidjson/include -I$(THIRD_PARTY_PATH)/websocketpp -I$(THIRD_PARTY_PATH)/uWebSockets/uSockets/src
ifeq (@(BUILD_TYPE),debug)
# CFLAGS += -fsanitize=undefined,address
# LDFLAGS += -fsanitize=undefined,address
CFLAGS += -O0 -g -fdebug-prefix-map=`pwd`=`pwd | sed 's/\/\.tup\/.*//'`
endif
ifeq (@(BUILD_TYPE),release)
CFLAGS += -O3 -ffast-math -fno-finite-math-only -fvisibility=hidden -DNDEBUG
endif
ifeq (@(TUP_PLATFORM),macosx)
CC = clang
CXX = clang++
CFLAGS += -stdlib=libc++ `pkg-config --cflags-only-I libzstd`
LDFLAGS += third_party/uWebSockets/uSockets/*.o -lz `pkg-config --static --libs libzstd`
else
CC = gcc
CXX = g++
CFLAGS += -Wno-psabi
# CFLAGS += -mcpu=native -march=native # Causes problems for RPI
LDFLAGS += third_party/uWebSockets/uSockets/*.o -ljemalloc -lm -lstdc++ -pthread -lz -lzstd -pthread -lstdc++fs
endif
!cpp = |> $(CXX) $(CFLAGS) $(CFLAGS_%f) -DMAX_LOADED_CHUNKS=@(MAX_LOADED_CHUNKS) -c %f -o %o |> %f.o $(ROOT)/<src_objects>
# !archive = |> ar rs %o |>
!link = |> $(CXX) $(CFLAGS) -o %o %<src_objects> $(LDFLAGS) |> $(BIN_TARGET)
!write_linker_cmd = |> echo "$(CXX) $(CFLAGS) -o $(BIN_TARGET) %<src_objects> $(LDFLAGS)" > %o |> link.sh