diff --git a/Makefile b/Makefile index 258c489..8b79f1f 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,33 @@ -EXAMPLE_FILES := HelloWorld EchoServer BroadcastingEchoServer +EXAMPLE_FILES := HelloWorld EchoServer BroadcastingEchoServer HelloWorldSSL THREADED_EXAMPLE_FILES := HelloWorldThreaded EchoServerThreaded -override CXXFLAGS += -std=c++17 -Isrc -IuSockets/src +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 && WITH_SSL=0 make + 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);) diff --git a/uSockets b/uSockets index 5ff9a6d..f7ce3ce 160000 --- a/uSockets +++ b/uSockets @@ -1 +1 @@ -Subproject commit 5ff9a6db51e480db149fac1db232dbd9d1d6d543 +Subproject commit f7ce3cee02b072a698cad608f4104ca994fa2da0