1 # Copyright Joyent, Inc. and other Node contributors. All rights reserved.
3 # Permission is hereby granted, free of charge, to any person obtaining a copy
4 # of this software and associated documentation files (the "Software"), to
5 # deal in the Software without restriction, including without limitation the
6 # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7 # sell copies of the Software, and to permit persons to whom the Software is
8 # furnished to do so, subject to the following conditions:
10 # The above copyright notice and this permission notice shall be included in
11 # all copies or substantial portions of the Software.
13 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22 CSTDFLAG
=--std
=c89
-pedantic
-Wall
-Wextra
-Wno-unused-parameter
24 CPPFLAGS
+= -I
$(SRCDIR
)/src
27 CPPFLAGS
+= -D_LARGEFILE_SOURCE
28 CPPFLAGS
+= -D_FILE_OFFSET_BITS
=64
30 RUNNER_SRC
=test/runner-unix.c
31 RUNNER_CFLAGS
=$(CFLAGS
) -I
$(SRCDIR
)/test
32 RUNNER_LDFLAGS
=-L
"$(CURDIR)" -luv
-Xlinker
-rpath
-Xlinker
"$(CURDIR)"
34 OBJS
+= src
/unix
/async.o
35 OBJS
+= src
/unix
/core.o
37 OBJS
+= src
/unix
/error.o
39 OBJS
+= src
/unix
/getaddrinfo.o
40 OBJS
+= src
/unix
/loop.o
41 OBJS
+= src
/unix
/loop-watcher.o
42 OBJS
+= src
/unix
/pipe.o
43 OBJS
+= src
/unix
/poll.o
44 OBJS
+= src
/unix
/process.o
45 OBJS
+= src
/unix
/signal.o
46 OBJS
+= src
/unix
/stream.o
47 OBJS
+= src
/unix
/tcp.o
48 OBJS
+= src
/unix
/thread.o
49 OBJS
+= src
/unix
/threadpool.o
50 OBJS
+= src
/unix
/timer.o
51 OBJS
+= src
/unix
/tty.o
52 OBJS
+= src
/unix
/udp.o
54 OBJS
+= src
/uv-common.o
58 CPPFLAGS
+= -D__EXTENSIONS__
-D_XOPEN_SOURCE
=500
59 LDFLAGS
+=-lkstat
-lnsl
-lsendfile
-lsocket
60 # Library dependencies are not transitive.
61 RUNNER_LDFLAGS
+= $(LDFLAGS
)
62 OBJS
+= src
/unix
/sunos.o
66 CPPFLAGS
+= -D_ALL_SOURCE
-D_XOPEN_SOURCE
=500
68 OBJS
+= src
/unix
/aix.o
72 CPPFLAGS
+= -D_DARWIN_USE_64_BIT_INODE
=1
73 LDFLAGS
+=-framework CoreServices
-dynamiclib
-install_name
"@rpath/libuv.dylib"
75 OBJS
+= src
/unix
/darwin.o
76 OBJS
+= src
/unix
/kqueue.o
77 OBJS
+= src
/unix
/fsevents.o
81 CSTDFLAG
+= -D_GNU_SOURCE
82 ifeq (android
,$(host
))
84 OBJS
+= src
/unix
/android.o
88 RUNNER_CFLAGS
+= -D_GNU_SOURCE
89 OBJS
+= src
/unix
/linux-core.o \
90 src
/unix
/linux-inotify.o \
91 src
/unix
/linux-syscalls.o
96 OBJS
+= src
/unix
/freebsd.o
97 OBJS
+= src
/unix
/kqueue.o
100 ifeq (dragonfly
,$(OS
))
102 OBJS
+= src
/unix
/freebsd.o
103 OBJS
+= src
/unix
/kqueue.o
108 OBJS
+= src
/unix
/netbsd.o
109 OBJS
+= src
/unix
/kqueue.o
114 OBJS
+= src
/unix
/openbsd.o
115 OBJS
+= src
/unix
/kqueue.o
118 ifneq (,$(findstring cygwin
,$(OS
)))
119 # We drop the --std=c89, it hides CLOCK_MONOTONIC on cygwin
120 CSTDFLAG
= -D_GNU_SOURCE
122 OBJS
+= src
/unix
/cygwin.o
125 ifneq (android
,$(host
))
127 RUNNER_LDFLAGS
+= -pthreads
129 RUNNER_LDFLAGS
+= -pthread
136 libuv.
$(SOEXT
): override CFLAGS
+= -fPIC
137 libuv.
$(SOEXT
): $(OBJS
)
138 $(CC
) -shared
-o
$@
$^
$(LDFLAGS
)
140 include/uv-private
/uv-unix.h
: \
141 include/uv-private
/uv-bsd.h \
142 include/uv-private
/uv-darwin.h \
143 include/uv-private
/uv-linux.h \
144 include/uv-private
/uv-sunos.h \
145 include/uv-private
/uv-android.h
147 src
/unix
/internal.h
: src
/unix
/linux-syscalls.h
149 src
/.buildstamp src
/unix
/.buildstamp
test/.buildstamp
:
153 src
/unix
/%.o
: src
/unix
/%.c
include/uv.h
include/uv-private
/uv-unix.h src
/unix
/internal.h src
/unix
/.buildstamp
154 $(CC
) $(CSTDFLAG
) $(CPPFLAGS
) $(CFLAGS
) -c
$< -o
$@
156 src
/%.o
: src
/%.c
include/uv.h
include/uv-private
/uv-unix.h src
/.buildstamp
157 $(CC
) $(CSTDFLAG
) $(CPPFLAGS
) $(CFLAGS
) -c
$< -o
$@
159 test/%.o
: test/%.c
include/uv.h
test/.buildstamp
160 $(CC
) $(CSTDFLAG
) $(CPPFLAGS
) $(CFLAGS
) -c
$< -o
$@
163 -rm -f libuv.a libuv.
$(SOEXT
) test/run-
{tests
,benchmarks
}.dSYM
166 -rm -f libuv.a libuv.
$(SOEXT
) test/run-
{tests
,benchmarks
}.dSYM