forked from uNetworking/uSockets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
36 lines (31 loc) · 874 Bytes
/
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
# WITH_SSL=1 enables SSL support
ifneq ($(WITH_SSL),1)
override CFLAGS += -DLIBUS_NO_SSL
else
# With problems on macOS, make sure to pass needed LDFLAGS required to find these
override LDFLAGS += -lssl -lcrypto
endif
# WITH_LIBUV=1 builds with libuv as event-loop
ifeq ($(WITH_LIBUV),1)
override CFLAGS += -DLIBUS_USE_LIBUV
override LDFLAGS += -luv
else
# macOS requires it anyways
ifeq ($(shell uname -s), Darwin)
override LDFLAGS += -luv
endif
endif
override CFLAGS += -std=c11 -Isrc
override LDFLAGS += uSockets.a
# By default we build the uSockets.a static library
default:
rm -f *.o
$(CC) $(CFLAGS) -flto -O3 -c src/*.c src/eventing/*.c
$(AR) rvs uSockets.a *.o
# Builds all examples
.PHONY: examples
examples: default
for f in examples/*.c; do $(CC) -flto -O3 $(CFLAGS) -o $$(basename "$$f" ".c") "$$f" $(LDFLAGS); done
clean:
rm -f *.o
rm -f *.a