node/deps/uv/config-unix.mk

165 lines
4.6 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
2013-02-21 04:12:18 +08:00
CPPFLAGS += -I$(SRCDIR)/src
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
2013-02-21 04:12:18 +08:00
RUNNER_CFLAGS=$(CFLAGS) -I$(SRCDIR)/test
RUNNER_LDFLAGS=-L"$(CURDIR)" -luv -Xlinker -rpath -Xlinker "$(CURDIR)"
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
2013-03-21 21:59:16 +08:00
ifeq (sunos,$(PLATFORM))
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
2013-03-21 21:59:16 +08:00
ifeq (aix,$(PLATFORM))
2013-02-21 04:12:18 +08:00
CPPFLAGS += -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
2013-03-21 21:59:16 +08:00
ifeq (darwin,$(PLATFORM))
2012-08-07 07:36:31 +08:00
CPPFLAGS += -D_DARWIN_USE_64_BIT_INODE=1
2013-02-24 11:03:49 +08:00
LDFLAGS += -framework Foundation \
-framework CoreServices \
-framework ApplicationServices \
-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
2013-02-24 11:03:49 +08:00
OBJS += src/unix/proctitle.o
OBJS += src/unix/darwin-proctitle.o
endif
2013-03-21 21:59:16 +08:00
ifeq (linux,$(PLATFORM))
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
2013-02-21 04:12:18 +08:00
OBJS += src/unix/linux-core.o \
src/unix/linux-inotify.o \
2013-02-24 11:03:49 +08:00
src/unix/linux-syscalls.o \
src/unix/proctitle.o
endif
2013-03-21 21:59:16 +08:00
ifeq (freebsd,$(PLATFORM))
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
2013-03-21 21:59:16 +08:00
ifeq (dragonfly,$(PLATFORM))
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
2013-03-21 21:59:16 +08:00
ifeq (netbsd,$(PLATFORM))
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
2013-03-21 21:59:16 +08:00
ifeq (openbsd,$(PLATFORM))
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
2013-03-21 21:59:16 +08:00
ifneq (,$(findstring cygwin,$(PLATFORM)))
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
2013-03-21 21:59:16 +08:00
ifeq (sunos,$(PLATFORM))
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
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
2013-02-21 04:12:18 +08:00
libuv.$(SOEXT): $(OBJS:%.o=%.pic.o)
2012-12-14 03:23:01 +08:00
$(CC) -shared -o $@ $^ $(LDFLAGS)
2012-11-17 00:57:15 +08:00
2013-02-21 04:12:18 +08:00
include/uv-private/uv-unix.h: \
include/uv-private/uv-bsd.h \
include/uv-private/uv-darwin.h \
include/uv-private/uv-linux.h \
include/uv-private/uv-sunos.h
src/unix/internal.h: src/unix/linux-syscalls.h
src/.buildstamp src/unix/.buildstamp test/.buildstamp:
mkdir -p $(dir $@)
touch $@
src/unix/%.o src/unix/%.pic.o: src/unix/%.c include/uv.h include/uv-private/uv-unix.h src/unix/internal.h src/unix/.buildstamp
$(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
src/%.o src/%.pic.o: src/%.c include/uv.h include/uv-private/uv-unix.h src/.buildstamp
$(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
2011-05-13 10:16:40 +08:00
2013-02-21 04:12:18 +08:00
test/%.o: test/%.c include/uv.h test/.buildstamp
$(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
2011-05-13 10:16:40 +08:00
clean-platform:
2013-03-01 09:04:29 +08:00
$(RM) test/run-{tests,benchmarks}.dSYM $(OBJS) $(OBJS:%.o=%.pic.o)
2013-02-24 11:03:49 +08:00
%.pic.o %.o: %.m
$(CC) $(CPPFLAGS) $(CFLAGS) -c $^ -o $@