libuv/config-unix.mk

146 lines
3.9 KiB
Makefile
Raw Normal View History

# 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-22 06:54:02 +00:00
CFLAGS += -g
CPPFLAGS += -I$(SRCDIR)/src
2012-12-08 07:06:09 +00:00
LDFLAGS=-lm
CPPFLAGS += -D_LARGEFILE_SOURCE
CPPFLAGS += -D_FILE_OFFSET_BITS=64
RUNNER_SRC=test/runner-unix.c
RUNNER_CFLAGS=$(CFLAGS) -I$(SRCDIR)/test
RUNNER_LDFLAGS=-L"$(CURDIR)" -luv -Xlinker -rpath -Xlinker "$(CURDIR)"
OBJS += src/unix/async.o
2011-08-31 19:07:43 +00:00
OBJS += src/unix/core.o
2011-10-28 23:12:15 +00:00
OBJS += src/unix/dl.o
2011-08-31 19:07:43 +00:00
OBJS += src/unix/error.o
2012-04-04 03:12:02 +00:00
OBJS += src/unix/fs.o
OBJS += src/unix/getaddrinfo.o
OBJS += src/unix/loop.o
OBJS += src/unix/loop-watcher.o
2012-04-04 03:12:02 +00:00
OBJS += src/unix/pipe.o
2012-05-02 23:43:56 +00:00
OBJS += src/unix/poll.o
2011-08-31 19:07:43 +00:00
OBJS += src/unix/process.o
OBJS += src/unix/signal.o
2012-04-04 03:12:02 +00:00
OBJS += src/unix/stream.o
2011-08-31 20:11:38 +00:00
OBJS += src/unix/tcp.o
2012-04-04 03:12:02 +00:00
OBJS += src/unix/thread.o
2012-09-30 22:38:39 +00:00
OBJS += src/unix/threadpool.o
OBJS += src/unix/timer.o
OBJS += src/unix/tty.o
2012-04-04 03:12:02 +00:00
OBJS += src/unix/udp.o
OBJS += src/fs-poll.o
OBJS += src/uv-common.o
OBJS += src/inet.o
2011-08-31 19:07:43 +00:00
ifeq (sunos,$(OS))
2012-08-06 22:59:14 +00:00
CPPFLAGS += -D__EXTENSIONS__ -D_XOPEN_SOURCE=500
2012-12-08 07:06:09 +00:00
LDFLAGS+=-lkstat -lnsl -lsendfile -lsocket
# Library dependencies are not transitive.
2012-12-08 07:06:09 +00:00
RUNNER_LDFLAGS += $(LDFLAGS)
2011-08-31 19:07:43 +00:00
OBJS += src/unix/sunos.o
endif
ifeq (aix,$(OS))
CPPFLAGS += -D_ALL_SOURCE -D_XOPEN_SOURCE=500
2012-12-08 07:06:09 +00:00
LDFLAGS+= -lperfstat
OBJS += src/unix/aix.o
endif
ifeq (darwin,$(OS))
2012-08-06 22:59:14 +00:00
CPPFLAGS += -D_DARWIN_USE_64_BIT_INODE=1
2012-12-08 07:06:09 +00:00
LDFLAGS+=-framework CoreServices -dynamiclib -install_name "@rpath/libuv.dylib"
SOEXT = dylib
2011-08-31 19:07:43 +00:00
OBJS += src/unix/darwin.o
OBJS += src/unix/kqueue.o
OBJS += src/unix/fsevents.o
endif
ifeq (linux,$(OS))
CSTDFLAG += -D_GNU_SOURCE
2012-12-08 07:06:09 +00:00
LDFLAGS+=-ldl -lrt
RUNNER_CFLAGS += -D_GNU_SOURCE
OBJS += src/unix/linux/linux-core.o \
src/unix/linux/inotify.o \
src/unix/linux/syscalls.o
endif
ifeq (freebsd,$(OS))
2012-12-08 07:06:09 +00:00
LDFLAGS+=-lkvm
2011-08-31 19:07:43 +00:00
OBJS += src/unix/freebsd.o
OBJS += src/unix/kqueue.o
endif
ifeq (dragonfly,$(OS))
2012-12-08 07:06:09 +00:00
LDFLAGS+=-lkvm
OBJS += src/unix/freebsd.o
OBJS += src/unix/kqueue.o
endif
ifeq (netbsd,$(OS))
2012-12-08 07:06:09 +00:00
LDFLAGS+=-lkvm
2011-09-08 02:09:26 +00:00
OBJS += src/unix/netbsd.o
OBJS += src/unix/kqueue.o
2011-09-08 02:09:26 +00:00
endif
ifeq (openbsd,$(OS))
2012-12-08 07:06:09 +00:00
LDFLAGS+=-lkvm
2011-10-13 03:38:13 +00:00
OBJS += src/unix/openbsd.o
OBJS += src/unix/kqueue.o
endif
ifneq (,$(findstring cygwin,$(OS)))
# We drop the --std=c89, it hides CLOCK_MONOTONIC on cygwin
CSTDFLAG = -D_GNU_SOURCE
2012-12-08 07:06:09 +00:00
LDFLAGS+=
2011-08-31 19:07:43 +00:00
OBJS += src/unix/cygwin.o
endif
ifeq (sunos,$(OS))
2012-12-08 07:06:09 +00:00
RUNNER_LDFLAGS += -pthreads
else
2012-12-08 07:06:09 +00:00
RUNNER_LDFLAGS += -pthread
endif
libuv.a: $(OBJS)
2012-10-11 12:32:06 +00:00
$(AR) rcs $@ $^
libuv.$(SOEXT): override CFLAGS += -fPIC
libuv.$(SOEXT): $(OBJS)
2012-12-08 07:06:09 +00:00
$(CC) -shared -o $@ $^ $(LDFLAGS)
src/unix/%.o: src/unix/%.c include/uv.h include/uv-private/uv-unix.h src/unix/internal.h
@mkdir -p $(dir $@)
2012-05-21 23:41:59 +00:00
$(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
src/%.o: src/%.c include/uv.h include/uv-private/uv-unix.h
@mkdir -p $(dir $@)
2012-05-21 23:41:59 +00:00
$(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
clean-platform:
-rm -f libuv.a libuv.$(SOEXT) test/run-{tests,benchmarks}.dSYM
distclean-platform:
-rm -f libuv.a libuv.$(SOEXT) test/run-{tests,benchmarks}.dSYM