node/deps/uv/config-unix.mk

192 lines
5.3 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
2013-05-15 08:13:42 +08:00
RUNNER_LDFLAGS=-L"$(CURDIR)" -luv
2012-11-17 00:57:15 +08:00
2013-04-12 23:43:05 +08:00
HAVE_DTRACE=
DTRACE_OBJS=
DTRACE_HEADER=
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
2013-03-28 07:28:45 +08:00
OBJS += src/version.o
2011-09-01 06:38:02 +08:00
2013-03-21 21:59:16 +08:00
ifeq (sunos,$(PLATFORM))
2013-04-12 23:43:05 +08:00
HAVE_DTRACE=1
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.
2011-09-01 06:38:02 +08:00
OBJS += src/unix/sunos.o
2013-04-12 23:43:05 +08:00
OBJS += src/unix/dtrace.o
DTRACE_OBJS += src/unix/core.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))
2013-04-12 23:43:05 +08:00
HAVE_DTRACE=1
2013-05-11 06:30:53 +08:00
# dtrace(1) probes contain dollar signs on OS X. Mute the warnings they
# generate but only when CC=clang, -Wno-dollar-in-identifier-extension
# is a clang extension.
ifeq (__clang__,$(shell sh -c "$(CC) -dM -E - </dev/null | grep -ow __clang__"))
2013-04-12 23:43:05 +08:00
CFLAGS += -Wno-dollar-in-identifier-extension
2013-05-11 06:30:53 +08:00
endif
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 \
2013-05-15 08:13:42 +08:00
-framework ApplicationServices
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))
2013-04-12 23:43:05 +08:00
HAVE_DTRACE=1
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
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
2013-04-12 23:43:05 +08:00
ifeq ($(HAVE_DTRACE), 1)
DTRACE_HEADER = src/unix/uv-dtrace.h
CPPFLAGS += -Isrc/unix
CFLAGS += -DHAVE_DTRACE
endif
2013-05-15 08:13:42 +08:00
ifneq (darwin,$(PLATFORM))
# Must correspond with UV_VERSION_MAJOR and UV_VERSION_MINOR in src/version.c
SO_LDFLAGS = -Wl,-soname,libuv.so.0.11
endif
RUNNER_LDFLAGS += $(LDFLAGS)
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)
2013-05-15 08:13:42 +08:00
$(CC) -shared -o $@ $^ $(LDFLAGS) $(SO_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
2013-03-29 23:10:56 +08:00
src/unix/internal.h: src/unix/linux-syscalls.h src/uv-common.h
src/uv-common.h: src/queue.h
2013-02-21 04:12:18 +08:00
src/.buildstamp src/unix/.buildstamp test/.buildstamp:
2013-03-28 07:28:45 +08:00
mkdir -p $(@D)
2013-02-21 04:12:18 +08:00
touch $@
2013-04-12 23:43:05 +08:00
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 $(DTRACE_HEADER)
2013-02-21 04:12:18 +08:00
$(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-04-12 23:43:05 +08:00
$(RM) test/run-{tests,benchmarks}.dSYM $(OBJS) $(OBJS:%.o=%.pic.o) src/unix/uv-dtrace.h
2013-02-24 11:03:49 +08:00
2013-04-12 23:43:05 +08:00
src/unix/uv-dtrace.h: src/unix/uv-dtrace.d
dtrace -h -xnolibs -s $< -o $@
src/unix/dtrace.o: src/unix/uv-dtrace.d $(DTRACE_OBJS)
dtrace -G -s $^ -o $@
src/unix/dtrace.pic.o: src/unix/uv-dtrace.d $(DTRACE_OBJS:%.o=%.pic.o)
dtrace -G -s $^ -o $@