-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
36 lines (33 loc) · 886 Bytes
/
Makefile
File metadata and controls
36 lines (33 loc) · 886 Bytes
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
# Variables
LIB_NAME = libasync
DEPS = taskloop.o promise.o event.o generator.o socket.o reactor.o
PLATFORM_DEPS = socket1.o reactor1.o
CXXFLAGS = -Wall -std=c++11 -fpic -Iinclude
STRIP = strip
PLATFORM=$(shell uname -s)
# macOS extra flags
ifeq ($(PLATFORM), Darwin)
CXXFLAGS := -I/usr/local/include -D_XOPEN_SOURCE -mmacosx-version-min=10.9 $(CXXFLAGS)
endif
# Debug mode
ifdef DEBUG
CXXFLAGS := $(CXXFLAGS) -g
else
CXXFLAGS := $(CXXFLAGS) -O3
endif
# Generate full dependencies list
DEPS := $(addprefix src/,$(DEPS)) $(addprefix src/$(PLATFORM)/,$(PLATFORM_DEPS))
# Library target
static: $(DEPS)
$(AR) rcs $(LIB_NAME).a $(DEPS)
shared: $(DEPS)
ifeq ($(PLATFORM), Darwin)
$(CXX) -dynamiclib -o $(LIB_NAME).dylib $(DEPS)
$(STRIP) $(LIB_NAME).dylib
else
$(CXX) -shared -o $(LIB_NAME).so $(DEPS)
$(STRIP) $(LIB_NAME).so
endif
# Other targets
clean:
rm -f $(DEPS) $(LIB_NAME).*