-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·59 lines (46 loc) · 1.21 KB
/
Makefile
File metadata and controls
executable file
·59 lines (46 loc) · 1.21 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Makefile for httpserver
# (C) Ramsey Kant 2011-2025
DEST = httpserver
CLANG_FORMAT = clang-format
LDFLAGS ?=
CXXFLAGS ?=
CXX = clang++
ARCH := $(shell uname -m)
CXXFLAGS += -Wall -Wextra -Wno-sign-compare -Wno-missing-field-initializers \
-Wformat -Wformat=2 -Wimplicit-fallthrough \
-fPIE \
-fexceptions \
-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer \
-fno-delete-null-pointer-checks -fno-strict-aliasing \
-pedantic -std=c++23
ifeq ($(ARCH),amd64)
CXXFLAGS += -march=x86-64-v2
endif
ifeq ($(ARCH),x86_64)
CXXFLAGS += -march=x86-64-v2
endif
ifeq ($(DEBUG),1)
CXXFLAGS += -O1 -g -DDEBUG=1 \
-fasynchronous-unwind-tables \
-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG \
-fstack-protector-all
else
CXXFLAGS += -O2 -DNDEBUG -flto=auto
LDFLAGS += -flto=auto
endif
SOURCES = $(sort $(wildcard src/*.cpp))
OBJECTS = $(SOURCES:.cpp=.o)
CLEANFILES = $(OBJECTS) bin/$(DEST)
all: make-src
make-src: $(DEST)
$(DEST): $(OBJECTS)
$(CXX) $(LDFLAGS) $(CXXFLAGS) $(OBJECTS) -o bin/$@
clean:
rm -f $(CLEANFILES)
debug:
DEBUG=1 $(MAKE) all
asan:
CXXFLAGS=-fsanitize=address DEBUG=1 $(MAKE) all
bench:
wrk -t12 -c400 -d30s http://localhost:8080
.PHONY: all make-src clean debug asan bench