forked from trevnorris/libuv-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
34 lines (27 loc) · 741 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
CC ?= $(which clang)
BUILDTYPE ?= Release
BUILDFILE ?= main.c
OUTFILE ?= run
UV_DIR ?= deps/uv
UV_BUILD = $(UV_DIR)/out/$(BUILDTYPE)
UV_FLAGS = -fno-omit-frame-pointer
IDIR = $(UV_DIR)/include
CFLAGS = -pthread -fno-omit-frame-pointer -Wall -g
all:
$(CC) $(CFLAGS) -o $(OUTFILE) $(BUILDFILE) $(UV_BUILD)/libuv.a -I$(IDIR)
.PHONY: libuv.a clean
libuv.a:
@git submodule update
@if [ ! -d $(UV_DIR)/build/gyp ]; then \
git clone https://git.chromium.org/external/gyp.git $(UV_DIR)/build/gyp; \
fi
@cd $(UV_DIR); \
./gyp_uv.py -f make > /dev/null; \
BUILDTYPE=$(BUILDTYPE) CFLAGS=$(UV_FLAGS) make -C out -j4
clean:
@for i in `ls`; do \
if [ -x $$i ] && [ ! -d $$i ]; then \
rm $$i; \
fi; \
done
@rm -rf $(UV_DIR)/out