forked from uNetworking/uWebSockets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
37 lines (32 loc) · 1.17 KB
/
Makefile
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
EXAMPLE_FILES := HelloWorld EchoServer BroadcastingEchoServer
THREADED_EXAMPLE_FILES := HelloWorldThreaded EchoServerThreaded
override CXXFLAGS += -lpthread -std=c++17 -Isrc -IuSockets/src
override LDFLAGS += uSockets/*.o -lz
# WITH_OPENSSL=1 enables OpenSSL 1.1+ support
ifeq ($(WITH_OPENSSL),1)
# With problems on macOS, make sure to pass needed LDFLAGS required to find these
override LDFLAGS += -lssl -lcrypto
else
# WITH_WOLFSSL=1 enables WolfSSL 4.2.0 support (mutually exclusive with OpenSSL)
ifeq ($(WITH_WOLFSSL),1)
override LDFLAGS += -L/usr/local/lib -lwolfssl
endif
endif
# WITH_LIBUV=1 builds with libuv as event-loop
ifeq ($(WITH_LIBUV),1)
override LDFLAGS += -luv
endif
# WITH_ASAN builds with sanitizers
ifeq ($(WITH_ASAN),1)
override CXXFLAGS += -fsanitize=address
override LDFLAGS += -lasan
endif
.PHONY: examples
examples:
cd uSockets && make
$(foreach FILE,$(EXAMPLE_FILES),$(CXX) -flto -O3 $(CXXFLAGS) examples/$(FILE).cpp -o $(FILE) $(LDFLAGS);)
$(foreach FILE,$(THREADED_EXAMPLE_FILES),$(CXX) -pthread -flto -O3 $(CXXFLAGS) examples/$(FILE).cpp -o $(FILE) $(LDFLAGS);)
all:
make examples
cd fuzzing && make && rm -f *.o
cd benchmarks && make && rm -f *.o