node/deps/uv/config-unix.mk

155 lines
4.2 KiB
Makefile
Raw Normal View History

2011-05-13 10:16:40 +08:00
# Copyright Joyent, Inc. and other Node contributors. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
E=
CSTDFLAG=--std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter
2011-09-23 10:41:43 +08:00
CFLAGS += -g
2012-11-17 00:57:15 +08:00
CPPFLAGS += -Isrc
2012-12-14 03:23:01 +08:00
LDFLAGS=-lm
2011-05-13 10:16:40 +08:00
2011-07-02 00:30:44 +08:00
CPPFLAGS += -D_LARGEFILE_SOURCE
CPPFLAGS += -D_FILE_OFFSET_BITS=64
2012-11-17 00:57:15 +08:00
RUNNER_SRC=test/runner-unix.c
RUNNER_CFLAGS=$(CFLAGS) -Itest
2012-12-14 03:23:01 +08:00
RUNNER_LDFLAGS=-L"$(PWD)" -luv -Xlinker -rpath -Xlinker "$(PWD)"
2012-11-17 00:57:15 +08:00
2012-04-29 06:22:01 +08:00
OBJS += src/unix/async.o
2011-09-01 06:38:02 +08:00
OBJS += src/unix/core.o
2011-10-29 07:33:01 +08:00
OBJS += src/unix/dl.o
OBJS += src/unix/error.o
2012-04-29 06:22:01 +08:00
OBJS += src/unix/fs.o
2012-10-07 05:04:30 +08:00
OBJS += src/unix/getaddrinfo.o
2012-04-29 06:22:01 +08:00
OBJS += src/unix/loop.o
2012-05-25 05:26:32 +08:00
OBJS += src/unix/loop-watcher.o
2012-04-29 06:22:01 +08:00
OBJS += src/unix/pipe.o
OBJS += src/unix/poll.o
2011-09-01 06:38:02 +08:00
OBJS += src/unix/process.o
2012-08-21 00:41:07 +08:00
OBJS += src/unix/signal.o
2012-04-29 06:22:01 +08:00
OBJS += src/unix/stream.o
2011-09-01 06:38:02 +08:00
OBJS += src/unix/tcp.o
2012-04-29 06:22:01 +08:00
OBJS += src/unix/thread.o
2012-10-07 05:04:30 +08:00
OBJS += src/unix/threadpool.o
2012-04-29 06:22:01 +08:00
OBJS += src/unix/timer.o
2011-09-13 05:53:27 +08:00
OBJS += src/unix/tty.o
2012-04-29 06:22:01 +08:00
OBJS += src/unix/udp.o
2012-11-17 00:57:15 +08:00
OBJS += src/fs-poll.o
OBJS += src/uv-common.o
OBJS += src/inet.o
2011-09-01 06:38:02 +08:00
2011-05-13 10:16:40 +08:00
ifeq (SunOS,$(uname_S))
2012-08-07 07:36:31 +08:00
CPPFLAGS += -D__EXTENSIONS__ -D_XOPEN_SOURCE=500
2012-12-14 03:23:01 +08:00
LDFLAGS+=-lkstat -lnsl -lsendfile -lsocket
2012-11-17 00:57:15 +08:00
# Library dependencies are not transitive.
2012-12-14 03:23:01 +08:00
RUNNER_LDFLAGS += $(LDFLAGS)
2011-09-01 06:38:02 +08:00
OBJS += src/unix/sunos.o
endif
2012-09-14 08:56:41 +08:00
ifeq (AIX,$(uname_S))
CPPFLAGS += -Isrc/ares/config_aix -D_ALL_SOURCE -D_XOPEN_SOURCE=500
2012-12-14 03:23:01 +08:00
LDFLAGS+= -lperfstat
2012-09-14 08:56:41 +08:00
OBJS += src/unix/aix.o
endif
ifeq (Darwin,$(uname_S))
2012-08-07 07:36:31 +08:00
CPPFLAGS += -D_DARWIN_USE_64_BIT_INODE=1
2012-12-14 03:23:01 +08:00
LDFLAGS+=-framework CoreServices -dynamiclib -install_name "@rpath/libuv.dylib"
2012-11-17 00:57:15 +08:00
SOEXT = dylib
2011-09-01 06:38:02 +08:00
OBJS += src/unix/darwin.o
2011-10-05 07:53:17 +08:00
OBJS += src/unix/kqueue.o
2012-09-13 22:18:54 +08:00
OBJS += src/unix/fsevents.o
endif
ifeq (Linux,$(uname_S))
2011-09-06 06:24:39 +08:00
CSTDFLAG += -D_GNU_SOURCE
2012-12-14 03:23:01 +08:00
LDFLAGS+=-ldl -lrt
2012-11-17 00:57:15 +08:00
RUNNER_CFLAGS += -D_GNU_SOURCE
2012-07-04 02:54:19 +08:00
OBJS += src/unix/linux/linux-core.o \
src/unix/linux/inotify.o \
src/unix/linux/syscalls.o
endif
ifeq (FreeBSD,$(uname_S))
2012-12-14 03:23:01 +08:00
LDFLAGS+=-lkvm
2011-09-01 06:38:02 +08:00
OBJS += src/unix/freebsd.o
2011-10-05 07:53:17 +08:00
OBJS += src/unix/kqueue.o
2011-05-13 10:16:40 +08:00
endif
2011-11-17 05:05:35 +08:00
ifeq (DragonFly,$(uname_S))
2012-12-14 03:23:01 +08:00
LDFLAGS+=-lkvm
2011-11-17 05:05:35 +08:00
OBJS += src/unix/freebsd.o
OBJS += src/unix/kqueue.o
endif
2011-09-09 05:29:12 +08:00
ifeq (NetBSD,$(uname_S))
2012-12-14 03:23:01 +08:00
LDFLAGS+=-lkvm
2011-09-09 05:29:12 +08:00
OBJS += src/unix/netbsd.o
2011-10-05 07:53:17 +08:00
OBJS += src/unix/kqueue.o
2011-09-09 05:29:12 +08:00
endif
2011-10-15 06:42:10 +08:00
ifeq (OpenBSD,$(uname_S))
2012-12-14 03:23:01 +08:00
LDFLAGS+=-lkvm
2011-10-15 06:42:10 +08:00
OBJS += src/unix/openbsd.o
OBJS += src/unix/kqueue.o
endif
ifneq (,$(findstring CYGWIN,$(uname_S)))
2011-07-21 00:06:16 +08:00
# We drop the --std=c89, it hides CLOCK_MONOTONIC on cygwin
CSTDFLAG = -D_GNU_SOURCE
2012-12-14 03:23:01 +08:00
LDFLAGS+=
2011-09-01 06:38:02 +08:00
OBJS += src/unix/cygwin.o
endif
2011-08-12 16:14:04 +08:00
ifeq (SunOS,$(uname_S))
2012-12-14 03:23:01 +08:00
RUNNER_LDFLAGS += -pthreads
2011-08-12 16:14:04 +08:00
else
2012-12-14 03:23:01 +08:00
RUNNER_LDFLAGS += -pthread
2011-08-12 16:14:04 +08:00
endif
2011-05-13 10:16:40 +08:00
2013-01-11 20:49:45 +08:00
OBJDIR := out
ifeq ($(MAKECMDGOALS), test)
OBJDIR := $(OBJDIR)/test
endif
OBJS := $(addprefix $(OBJDIR)/,$(OBJS))
2012-11-17 00:57:15 +08:00
libuv.a: $(OBJS)
2012-10-11 20:36:23 +08:00
$(AR) rcs $@ $^
2011-08-30 06:23:13 +08:00
2012-12-14 03:23:01 +08:00
libuv.$(SOEXT): override CFLAGS += -fPIC
2012-11-17 00:57:15 +08:00
libuv.$(SOEXT): $(OBJS)
2012-12-14 03:23:01 +08:00
$(CC) -shared -o $@ $^ $(LDFLAGS)
2012-11-17 00:57:15 +08:00
2013-01-11 20:49:45 +08:00
$(OBJDIR)/src/unix/%.o: src/unix/%.c include/uv.h include/uv-private/uv-unix.h src/unix/internal.h
@mkdir -p $(dir $@)
$(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
2011-05-13 10:16:40 +08:00
2013-01-11 20:49:45 +08:00
$(OBJDIR)/src/%.o: src/%.c include/uv.h include/uv-private/uv-unix.h
@mkdir -p $(dir $@)
$(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
2011-05-13 10:16:40 +08:00
clean-platform:
2013-01-11 20:49:45 +08:00
-rm -rf $(OBJDIR)
-rm -f libuv.a libuv.$(SOEXT) test/run-{tests,benchmarks}.dSYM
2011-05-13 10:16:40 +08:00
distclean-platform:
2013-01-11 20:49:45 +08:00
-rm -rf $(OBJDIR)
-rm -f libuv.a libuv.$(SOEXT) test/run-{tests,benchmarks}.dSYM