• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2013, Ben Noordhuis <info@bnoordhuis.nl>
2#
3# Permission to use, copy, modify, and/or distribute this software for any
4# purpose with or without fee is hereby granted, provided that the above
5# copyright notice and this permission notice appear in all copies.
6#
7# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14
15ACLOCAL_AMFLAGS = -I m4
16
17AM_CPPFLAGS = -I$(top_srcdir)/include \
18              -I$(top_srcdir)/src
19
20include_HEADERS=include/uv.h
21
22uvincludedir = $(includedir)/uv
23uvinclude_HEADERS = include/uv/errno.h \
24                    include/uv/threadpool.h \
25                    include/uv/version.h
26
27CLEANFILES =
28
29lib_LTLIBRARIES = libuv.la
30libuv_la_CFLAGS = $(AM_CFLAGS)
31libuv_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined -version-info 1:0:0
32libuv_la_SOURCES = src/fs-poll.c \
33                   src/heap-inl.h \
34                   src/idna.c \
35                   src/idna.h \
36                   src/inet.c \
37                   src/queue.h \
38                   src/random.c \
39                   src/strscpy.c \
40                   src/strscpy.h \
41                   src/threadpool.c \
42                   src/timer.c \
43                   src/uv-data-getter-setters.c \
44                   src/uv-common.c \
45                   src/uv-common.h \
46                   src/version.c
47
48if SUNOS
49# Can't be turned into a CC_CHECK_CFLAGS in configure.ac, it makes compilers
50# on other platforms complain that the argument is unused during compilation.
51libuv_la_CFLAGS += -pthreads
52endif
53
54if WINNT
55
56uvinclude_HEADERS += include/uv/win.h include/uv/tree.h
57AM_CPPFLAGS += -I$(top_srcdir)/src/win \
58               -DWIN32_LEAN_AND_MEAN \
59               -D_WIN32_WINNT=0x0602
60libuv_la_SOURCES += src/win/async.c \
61                    src/win/atomicops-inl.h \
62                    src/win/core.c \
63                    src/win/detect-wakeup.c \
64                    src/win/dl.c \
65                    src/win/error.c \
66                    src/win/fs-event.c \
67                    src/win/fs.c \
68                    src/win/getaddrinfo.c \
69                    src/win/getnameinfo.c \
70                    src/win/handle.c \
71                    src/win/handle-inl.h \
72                    src/win/internal.h \
73                    src/win/loop-watcher.c \
74                    src/win/pipe.c \
75                    src/win/poll.c \
76                    src/win/process-stdio.c \
77                    src/win/process.c \
78                    src/win/req-inl.h \
79                    src/win/signal.c \
80                    src/win/stream.c \
81                    src/win/stream-inl.h \
82                    src/win/tcp.c \
83                    src/win/thread.c \
84                    src/win/tty.c \
85                    src/win/udp.c \
86                    src/win/util.c \
87                    src/win/winapi.c \
88                    src/win/winapi.h \
89                    src/win/winsock.c \
90                    src/win/winsock.h
91
92else  # WINNT
93
94uvinclude_HEADERS += include/uv/unix.h
95AM_CPPFLAGS += -I$(top_srcdir)/src/unix
96libuv_la_SOURCES += src/unix/async.c \
97                   src/unix/atomic-ops.h \
98                   src/unix/core.c \
99                   src/unix/dl.c \
100                   src/unix/fs.c \
101                   src/unix/getaddrinfo.c \
102                   src/unix/getnameinfo.c \
103                   src/unix/internal.h \
104                   src/unix/loop-watcher.c \
105                   src/unix/loop.c \
106                   src/unix/pipe.c \
107                   src/unix/poll.c \
108                   src/unix/process.c \
109                   src/unix/random-devurandom.c \
110                   src/unix/signal.c \
111                   src/unix/spinlock.h \
112                   src/unix/stream.c \
113                   src/unix/tcp.c \
114                   src/unix/thread.c \
115                   src/unix/tty.c \
116                   src/unix/udp.c
117
118endif  # WINNT
119
120EXTRA_DIST = test/fixtures/empty_file \
121             test/fixtures/load_error.node \
122             test/fixtures/lorem_ipsum.txt \
123             include \
124             docs \
125             img \
126             CONTRIBUTING.md \
127             LICENSE \
128             README.md
129
130
131
132TESTS = test/run-tests
133check_PROGRAMS = test/run-tests
134test_run_tests_CFLAGS = $(AM_CFLAGS)
135
136if SUNOS
137# Can't be turned into a CC_CHECK_CFLAGS in configure.ac, it makes compilers
138# on other platforms complain that the argument is unused during compilation.
139test_run_tests_CFLAGS += -pthreads
140endif
141
142test_run_tests_LDFLAGS = $(AM_LDFLAGS)
143test_run_tests_SOURCES = test/blackhole-server.c \
144                         test/echo-server.c \
145                         test/run-tests.c \
146                         test/runner.c \
147                         test/runner.h \
148                         test/task.h \
149                         test/test-active.c \
150                         test/test-async.c \
151                         test/test-async-null-cb.c \
152                         test/test-barrier.c \
153                         test/test-callback-order.c \
154                         test/test-callback-stack.c \
155                         test/test-close-fd.c \
156                         test/test-close-order.c \
157                         test/test-condvar.c \
158                         test/test-connect-unspecified.c \
159                         test/test-connection-fail.c \
160                         test/test-cwd-and-chdir.c \
161                         test/test-default-loop-close.c \
162                         test/test-delayed-accept.c \
163                         test/test-dlerror.c \
164                         test/test-eintr-handling.c \
165                         test/test-embed.c \
166                         test/test-emfile.c \
167                         test/test-env-vars.c \
168                         test/test-error.c \
169                         test/test-fail-always.c \
170                         test/test-fs-copyfile.c \
171                         test/test-fs-event.c \
172                         test/test-fs-poll.c \
173                         test/test-fs.c \
174                         test/test-fs-readdir.c \
175                         test/test-fs-fd-hash.c \
176                         test/test-fs-open-flags.c \
177                         test/test-fork.c \
178                         test/test-getters-setters.c \
179                         test/test-get-currentexe.c \
180                         test/test-get-loadavg.c \
181                         test/test-get-memory.c \
182                         test/test-get-passwd.c \
183                         test/test-getaddrinfo.c \
184                         test/test-gethostname.c \
185                         test/test-getnameinfo.c \
186                         test/test-getsockname.c \
187                         test/test-gettimeofday.c \
188                         test/test-handle-fileno.c \
189                         test/test-homedir.c \
190                         test/test-hrtime.c \
191                         test/test-idle.c \
192                         test/test-idna.c \
193                         test/test-ip4-addr.c \
194                         test/test-ip6-addr.c \
195                         test/test-ip-name.c \
196                         test/test-ipc-heavy-traffic-deadlock-bug.c \
197                         test/test-ipc-send-recv.c \
198                         test/test-ipc.c \
199                         test/test-list.h \
200                         test/test-loop-handles.c \
201                         test/test-loop-alive.c \
202                         test/test-loop-close.c \
203                         test/test-loop-stop.c \
204                         test/test-loop-time.c \
205                         test/test-loop-configure.c \
206                         test/test-metrics.c \
207                         test/test-multiple-listen.c \
208                         test/test-mutexes.c \
209                         test/test-not-readable-nor-writable-on-read-error.c \
210                         test/test-not-writable-after-shutdown.c \
211                         test/test-osx-select.c \
212                         test/test-pass-always.c \
213                         test/test-ping-pong.c \
214                         test/test-pipe-bind-error.c \
215                         test/test-pipe-connect-error.c \
216                         test/test-pipe-connect-multiple.c \
217                         test/test-pipe-connect-prepare.c \
218                         test/test-pipe-getsockname.c \
219                         test/test-pipe-pending-instances.c \
220                         test/test-pipe-sendmsg.c \
221                         test/test-pipe-server-close.c \
222                         test/test-pipe-close-stdout-read-stdin.c \
223                         test/test-pipe-set-non-blocking.c \
224                         test/test-pipe-set-fchmod.c \
225                         test/test-platform-output.c \
226                         test/test-poll.c \
227                         test/test-poll-close.c \
228                         test/test-poll-close-doesnt-corrupt-stack.c \
229                         test/test-poll-closesocket.c \
230                         test/test-poll-multiple-handles.c \
231                         test/test-poll-oob.c \
232                         test/test-process-priority.c \
233                         test/test-process-title.c \
234                         test/test-process-title-threadsafe.c \
235                         test/test-queue-foreach-delete.c \
236                         test/test-random.c \
237                         test/test-readable-on-eof.c \
238                         test/test-ref.c \
239                         test/test-run-nowait.c \
240                         test/test-run-once.c \
241                         test/test-semaphore.c \
242                         test/test-shutdown-close.c \
243                         test/test-shutdown-eof.c \
244                         test/test-shutdown-simultaneous.c \
245                         test/test-shutdown-twice.c \
246                         test/test-signal-multiple-loops.c \
247                         test/test-signal-pending-on-close.c \
248                         test/test-signal.c \
249                         test/test-socket-buffer-size.c \
250                         test/test-spawn.c \
251                         test/test-stdio-over-pipes.c \
252                         test/test-strscpy.c \
253                         test/test-tcp-alloc-cb-fail.c \
254                         test/test-tcp-bind-error.c \
255                         test/test-tcp-bind6-error.c \
256                         test/test-tcp-close-accept.c \
257                         test/test-tcp-close-while-connecting.c \
258                         test/test-tcp-close.c \
259                         test/test-tcp-close-reset.c \
260                         test/test-tcp-create-socket-early.c \
261                         test/test-tcp-connect-error-after-write.c \
262                         test/test-tcp-connect-error.c \
263                         test/test-tcp-connect-timeout.c \
264                         test/test-tcp-connect6-error.c \
265                         test/test-tcp-flags.c \
266                         test/test-tcp-open.c \
267                         test/test-tcp-read-stop.c \
268                         test/test-tcp-read-stop-start.c \
269                         test/test-tcp-shutdown-after-write.c \
270                         test/test-tcp-unexpected-read.c \
271                         test/test-tcp-oob.c \
272                         test/test-tcp-write-to-half-open-connection.c \
273                         test/test-tcp-write-after-connect.c \
274                         test/test-tcp-writealot.c \
275                         test/test-tcp-write-fail.c \
276                         test/test-tcp-try-write.c \
277                         test/test-tcp-try-write-error.c \
278                         test/test-tcp-write-queue-order.c \
279                         test/test-test-macros.c \
280                         test/test-thread-equal.c \
281                         test/test-thread.c \
282                         test/test-threadpool-cancel.c \
283                         test/test-threadpool.c \
284                         test/test-timer-again.c \
285                         test/test-timer-from-check.c \
286                         test/test-timer.c \
287                         test/test-tmpdir.c \
288                         test/test-tty-duplicate-key.c \
289                         test/test-tty-escape-sequence-processing.c \
290                         test/test-tty.c \
291                         test/test-udp-alloc-cb-fail.c \
292                         test/test-udp-bind.c \
293                         test/test-udp-connect.c \
294                         test/test-udp-connect6.c \
295                         test/test-udp-create-socket-early.c \
296                         test/test-udp-dgram-too-big.c \
297                         test/test-udp-ipv6.c \
298                         test/test-udp-mmsg.c \
299                         test/test-udp-multicast-interface.c \
300                         test/test-udp-multicast-interface6.c \
301                         test/test-udp-multicast-join.c \
302                         test/test-udp-multicast-join6.c \
303                         test/test-udp-multicast-ttl.c \
304                         test/test-udp-open.c \
305                         test/test-udp-options.c \
306                         test/test-udp-send-and-recv.c \
307                         test/test-udp-send-hang-loop.c \
308                         test/test-udp-send-immediate.c \
309                         test/test-udp-sendmmsg-error.c \
310                         test/test-udp-send-unreachable.c \
311                         test/test-udp-try-send.c \
312                         test/test-uname.c \
313                         test/test-walk-handles.c \
314                         test/test-watcher-cross-stop.c
315test_run_tests_LDADD = libuv.la
316
317if WINNT
318test_run_tests_SOURCES += test/runner-win.c \
319                          test/runner-win.h
320else
321test_run_tests_SOURCES += test/runner-unix.c \
322                          test/runner-unix.h
323endif
324
325if AIX
326test_run_tests_CFLAGS += -D_ALL_SOURCE \
327                         -D_XOPEN_SOURCE=500 \
328                         -D_LINUX_SOURCE_COMPAT
329endif
330
331if OS400
332test_run_tests_CFLAGS += -D_ALL_SOURCE \
333                         -D_XOPEN_SOURCE=500 \
334                         -D_LINUX_SOURCE_COMPAT
335endif
336
337if HAIKU
338test_run_tests_CFLAGS += -D_BSD_SOURCE
339endif
340
341if LINUX
342test_run_tests_CFLAGS += -D_GNU_SOURCE
343endif
344
345if SUNOS
346test_run_tests_CFLAGS += -D__EXTENSIONS__ \
347                         -D_XOPEN_SOURCE=500 \
348                         -D_REENTRANT
349endif
350
351if OS390
352test_run_tests_CFLAGS += -D_ISOC99_SOURCE \
353                         -D_UNIX03_THREADS \
354                         -D_UNIX03_SOURCE \
355                         -D_OPEN_SYS_IF_EXT=1 \
356                         -D_OPEN_SYS_SOCK_IPV6 \
357                         -D_OPEN_MSGQ_EXT \
358                         -D_XOPEN_SOURCE_EXTENDED \
359                         -D_ALL_SOURCE \
360                         -D_LARGE_TIME_API \
361                         -D_OPEN_SYS_FILE_EXT \
362                         -DPATH_MAX=255 \
363                         -qCHARS=signed \
364                         -qXPLINK \
365                         -qFLOAT=IEEE
366endif
367
368if AIX
369libuv_la_CFLAGS += -D_ALL_SOURCE \
370                   -D_XOPEN_SOURCE=500 \
371                   -D_LINUX_SOURCE_COMPAT \
372                   -D_THREAD_SAFE \
373                   -DHAVE_SYS_AHAFS_EVPRODS_H
374uvinclude_HEADERS += include/uv/aix.h
375libuv_la_SOURCES += src/unix/aix.c src/unix/aix-common.c
376endif
377
378if OS400
379libuv_la_CFLAGS += -D_ALL_SOURCE \
380                   -D_XOPEN_SOURCE=500 \
381                   -D_LINUX_SOURCE_COMPAT \
382                   -D_THREAD_SAFE
383uvinclude_HEADERS += include/uv/posix.h
384libuv_la_SOURCES += src/unix/aix-common.c \
385                    src/unix/ibmi.c \
386                    src/unix/posix-poll.c \
387                    src/unix/no-fsevents.c
388endif
389
390if ANDROID
391libuv_la_CFLAGS += -D_GNU_SOURCE
392libuv_la_SOURCES += src/unix/pthread-fixes.c
393endif
394
395if CYGWIN
396uvinclude_HEADERS += include/uv/posix.h
397libuv_la_CFLAGS += -D_GNU_SOURCE
398libuv_la_SOURCES += src/unix/cygwin.c \
399                    src/unix/bsd-ifaddrs.c \
400                    src/unix/no-fsevents.c \
401                    src/unix/no-proctitle.c \
402                    src/unix/posix-hrtime.c \
403                    src/unix/posix-poll.c \
404                    src/unix/procfs-exepath.c \
405                    src/unix/sysinfo-loadavg.c \
406                    src/unix/sysinfo-memory.c
407endif
408
409if DARWIN
410uvinclude_HEADERS += include/uv/darwin.h
411libuv_la_CFLAGS += -D_DARWIN_USE_64_BIT_INODE=1
412libuv_la_CFLAGS += -D_DARWIN_UNLIMITED_SELECT=1
413libuv_la_SOURCES += src/unix/bsd-ifaddrs.c \
414                    src/unix/darwin-proctitle.c \
415                    src/unix/darwin-stub.h \
416                    src/unix/darwin.c \
417                    src/unix/fsevents.c \
418                    src/unix/kqueue.c \
419                    src/unix/proctitle.c \
420                    src/unix/random-getentropy.c
421test_run_tests_LDFLAGS += -lutil
422endif
423
424if DRAGONFLY
425uvinclude_HEADERS += include/uv/bsd.h
426libuv_la_SOURCES += src/unix/bsd-ifaddrs.c \
427                    src/unix/bsd-proctitle.c \
428                    src/unix/freebsd.c \
429                    src/unix/kqueue.c \
430                    src/unix/posix-hrtime.c
431test_run_tests_LDFLAGS += -lutil
432endif
433
434if FREEBSD
435uvinclude_HEADERS += include/uv/bsd.h
436libuv_la_SOURCES += src/unix/bsd-ifaddrs.c \
437                    src/unix/bsd-proctitle.c \
438                    src/unix/freebsd.c \
439                    src/unix/kqueue.c \
440                    src/unix/posix-hrtime.c \
441                    src/unix/random-getrandom.c
442test_run_tests_LDFLAGS += -lutil
443endif
444
445if HAIKU
446uvinclude_HEADERS += include/uv/posix.h
447libuv_la_CFLAGS += -D_BSD_SOURCE
448libuv_la_SOURCES += src/unix/bsd-ifaddrs.c \
449                    src/unix/haiku.c \
450                    src/unix/no-fsevents.c \
451                    src/unix/no-proctitle.c \
452                    src/unix/posix-hrtime.c \
453                    src/unix/posix-poll.c
454endif
455
456if HURD
457uvinclude_HEADERS += include/uv/posix.h
458libuv_la_SOURCES += src/unix/bsd-ifaddrs.c \
459                    src/unix/no-fsevents.c \
460                    src/unix/no-proctitle.c \
461                    src/unix/posix-hrtime.c \
462                    src/unix/posix-poll.c \
463                    src/unix/hurd.c
464endif
465
466if LINUX
467uvinclude_HEADERS += include/uv/linux.h
468libuv_la_CFLAGS += -D_GNU_SOURCE
469libuv_la_SOURCES += src/unix/linux-core.c \
470                    src/unix/linux-inotify.c \
471                    src/unix/linux-syscalls.c \
472                    src/unix/linux-syscalls.h \
473                    src/unix/procfs-exepath.c \
474                    src/unix/proctitle.c \
475                    src/unix/random-getrandom.c \
476                    src/unix/random-sysctl-linux.c \
477                    src/unix/epoll.c
478test_run_tests_LDFLAGS += -lutil
479endif
480
481if MSYS
482libuv_la_CFLAGS += -D_GNU_SOURCE
483libuv_la_SOURCES += src/unix/cygwin.c \
484                    src/unix/bsd-ifaddrs.c \
485                    src/unix/no-fsevents.c \
486                    src/unix/no-proctitle.c \
487                    src/unix/posix-hrtime.c \
488                    src/unix/posix-poll.c \
489                    src/unix/procfs-exepath.c \
490                    src/unix/sysinfo-loadavg.c \
491                    src/unix/sysinfo-memory.c
492endif
493
494if NETBSD
495uvinclude_HEADERS += include/uv/bsd.h
496libuv_la_SOURCES += src/unix/bsd-ifaddrs.c \
497                    src/unix/bsd-proctitle.c \
498                    src/unix/kqueue.c \
499                    src/unix/netbsd.c \
500                    src/unix/posix-hrtime.c
501test_run_tests_LDFLAGS += -lutil
502endif
503
504if OPENBSD
505uvinclude_HEADERS += include/uv/bsd.h
506libuv_la_SOURCES += src/unix/bsd-ifaddrs.c \
507                    src/unix/bsd-proctitle.c \
508                    src/unix/kqueue.c \
509                    src/unix/openbsd.c \
510                    src/unix/posix-hrtime.c \
511                    src/unix/random-getentropy.c
512test_run_tests_LDFLAGS += -lutil
513endif
514
515if SUNOS
516uvinclude_HEADERS += include/uv/sunos.h
517libuv_la_CFLAGS += -D__EXTENSIONS__ \
518                   -D_XOPEN_SOURCE=500 \
519                   -D_REENTRANT
520libuv_la_SOURCES += src/unix/no-proctitle.c \
521                    src/unix/sunos.c
522endif
523
524if OS390
525libuv_la_CFLAGS += -D_UNIX03_THREADS \
526                   -D_UNIX03_SOURCE \
527                   -D_OPEN_SYS_IF_EXT=1 \
528                   -D_OPEN_MSGQ_EXT \
529                   -D_XOPEN_SOURCE_EXTENDED \
530                   -D_ALL_SOURCE \
531                   -D_LARGE_TIME_API \
532                   -D_OPEN_SYS_SOCK_EXT3 \
533                   -D_OPEN_SYS_SOCK_IPV6 \
534                   -D_OPEN_SYS_FILE_EXT \
535                   -DUV_PLATFORM_SEM_T=int \
536                   -DPATH_MAX=255 \
537                   -qCHARS=signed \
538                   -qXPLINK \
539                   -qFLOAT=IEEE
540libuv_la_LDFLAGS += -qXPLINK
541libuv_la_SOURCES += src/unix/pthread-fixes.c \
542                    src/unix/os390.c \
543                    src/unix/os390-syscalls.c \
544                    src/unix/proctitle.c
545endif
546
547pkgconfigdir = $(libdir)/pkgconfig
548pkgconfig_DATA = @PACKAGE_NAME@.pc
549