forked from bithavoc/uv.d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
61 lines (51 loc) · 1.41 KB
/
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
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
OS_NAME=$(shell uname -s)
MH_NAME=$(shell uname -m)
#CFLAGS=-arch i386 #only for 32 bits
CFLAGS=
DFLAGS=
UVBUILDTYPE=
OS_TYPE=linux
ifeq (${OS_NAME},Darwin)
DFLAGS+=-L-framework -LCoreServices
OS_TYPE=osx
endif
ifeq (${DEBUG}, 1)
DFLAGS+=-debug -gc -gs -g
CFLAGS+=-g
UVBUILDTYPE=Debug
else
DFLAGS+=-O -release -inline -noboundscheck
UVBUILDTYPE=Release
endif
EXAMPLES_FLAGS=-Isrc/ $(DFLAGS)
lib_uv=../out/uv.a
DC ?=dmd
build: duv.lib
dub: build
mkdir -p dub/bin
cp out/uv.bridged.a dub/bin/uv.bridged-$(OS_TYPE)-$(MH_NAME).a
duv.lib: lib/duv/*.d out/uv.bridged.a
mkdir -p out
cd lib; $(DC) -of../out/duv.lib.o -Hd../out/di -op -c duv/*.d ../out/uv.bridged.a $(DFLAGS)
rm -f out/duv.a
ar -r out/duv.a out/duv.c.o out/duv.lib.o out/uv/*.o
duv.c: src/duv.c uv
cd src; $(CC) -DEV_MULTIPLICITY=1 -I../deps/uv/include -o ../out/duv.c.o -c duv.c $(lib_uv) $(CFLAGS)
out/uv.bridged.a: uv duv.c
ar -r out/uv.bridged.a out/duv.c.o out/uv/*.o
uv: deps/uv/build
CFLAGS="$(CFLAGS)" $(MAKE) BUILDTYPE=$(UVBUILDTYPE) -C deps/uv/out
mkdir -p out
cd deps; cp uv/out/$(UVBUILDTYPE)/libuv.a $(lib_uv)
mkdir -p out/uv
(cd out/uv ; ar -x ../uv.a)
.PHONY: clean duv.native.a
deps/uv/build:
git submodule update --init --recursive
cd deps/uv; mkdir -p build
git clone https://chromium.googlesource.com/external/gyp deps/uv/build/gyp
cd deps/uv ; ./gyp_uv.py -f make
clean:
rm -rf out
rm -rf deps/build
rm -rf deps/out