-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.linux
84 lines (66 loc) · 1.78 KB
/
Makefile.linux
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
LIB_DIR = lib
OBJ_DIR = obj
OBJS = obj/defs.o obj/ptr.o obj/event-bus.o obj/event.o obj/net.o \
obj/buffer.o obj/ifilebuffer.o obj/ofilebuffer.o
EXAMPLES = examples/event_bus examples/refs examples/udp_client examples/udp_server
CC = clang++
CCFLAGS = -Qunused-arguments -Wno-format-security -fcolor-diagnostics -fansi-escape-codes -Wno-format -std=c++17 \
-Iinclude -Llib -O1 -Wl,-s -static -pthread -static-libstdc++ -static-libgcc -Wno-switch -g
vpath %.cpp src:examples:utils
obj/%.o: %.cpp
@echo [90m - [96m$<[0m
@$(CC) $(CCFLAGS) -c -o $@ $<
examples/%: %.cpp
@echo [90m - [96m$<[0m
@$(CC) $(CCFLAGS) $< -o $@ -lasr
utils/%: %.cpp
@echo [90m - [96m$<[0m
@$(CC) $(CCFLAGS) $< -o $@ -lasr
build: lib
all: uninstall clean lib
clean:
@echo [97mCleaning ... [0m
@rm -rf $(LIB_DIR)
@rm -rf $(OBJ_DIR)
obj-folder:
@mkdir -p $(OBJ_DIR)
lib-folder:
@mkdir -p $(LIB_DIR)
msg-1:
@echo [97mCompiling sources ... [0m
lib: obj-folder lib-folder msg-1 $(OBJS)
@echo [97mBuilding library ... [0m
@rm -rf $(LIB_DIR)\libasr.a
@ar rcs $(LIB_DIR)/libasr.a $(OBJS)
msg-2:
@echo [97mBulding examples ... [0m
examples: msg-2 $(EXAMPLES)
@echo [97mDone[0m
# Utilities
rssc: utils/rssc
@echo .
rssc_fcgi: rssc
@./utils/rssc utils/fcgi.schema examples/fcgi.h
# Build and run examples
event_bus: examples/event_bus
@$<
refs: examples/refs
@$<
data_schema: examples/data_schema
@$<
udp_server: examples/udp_server
@$<
udp_client: examples/udp_client
@$<
udp_broadcast: examples/udp_broadcast
@$<
tcp_server: examples/tcp_server
@$<
tcp_client: examples/tcp_client
@$<
custom_protocol_client: examples/custom_protocol
@$< client
custom_protocol_server: examples/custom_protocol
@$< server
custom_protocol_bomb: examples/custom_protocol
@seq 50 | xargs -n1 -P50 $< client &