mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-19 11:12:43 +00:00
Munge libuv makefiles sufficiently to build out of tree.
This commit is contained in:
parent
b2c3fc739c
commit
7da64ae461
@ -4,6 +4,8 @@
|
||||
|
||||
include config.mk
|
||||
MKFILES := Makefile config.mk $(wildcard $(CFG_SRC_DIR)/mk/*.mk)
|
||||
MKFILES += $(CFG_SRC_DIR)/src/rt/libuv/Makefile
|
||||
MKFILES += $(wildcard $(CFG_SRC_DIR)/src/rt/libuv/*.mk)
|
||||
|
||||
ifneq ($(MAKE_RESTARTS),)
|
||||
CFG_INFO := $(info cfg: make restarts: $(MAKE_RESTARTS))
|
||||
|
5
configure
vendored
5
configure
vendored
@ -179,6 +179,7 @@ step_msg "making directories"
|
||||
for i in \
|
||||
doc \
|
||||
rt rt/isaac rt/bigint rt/sync rt/test rt/arch/i386 \
|
||||
rt/libuv rt/libuv/src/ares rt/libuv/src/eio rt/libuv/src/ev \
|
||||
rustllvm \
|
||||
dl stage0 stage1 stage2 stage3 \
|
||||
stage0/lib stage1/lib stage2/lib stage3/lib \
|
||||
@ -315,4 +316,8 @@ rm -f config.mk.bak
|
||||
|
||||
copy ${CFG_SRC_DIR}Makefile.in ./Makefile
|
||||
|
||||
copy ${CFG_SRC_DIR}src/rt/libuv/Makefile rt/libuv/Makefile
|
||||
copy ${CFG_SRC_DIR}src/rt/libuv/config-unix.mk rt/libuv/config-unix.mk
|
||||
copy ${CFG_SRC_DIR}src/rt/libuv/config-mingw.mk rt/libuv/config-mingw.mk
|
||||
|
||||
step_msg "complete"
|
||||
|
12
mk/rt.mk
12
mk/rt.mk
@ -68,7 +68,7 @@ RUNTIME_DEF := rt/rustrt$(CFG_DEF_SUFFIX)
|
||||
RUNTIME_INCS := -I $(S)src/rt/isaac -I $(S)src/rt/uthash \
|
||||
-I $(S)src/rt/arch/i386 -I $(S)src/rt/libuv/include
|
||||
RUNTIME_OBJS := $(RUNTIME_CS:.cpp=.o) $(RUNTIME_LL:.ll=.o) $(RUNTIME_S:.s=.o)
|
||||
RUNTIME_LIBS := $(S)src/rt/libuv/uv.a
|
||||
RUNTIME_LIBS := rt/libuv/uv.a
|
||||
|
||||
rt/%.o: rt/%.cpp $(MKFILES)
|
||||
@$(call E, compile: $@)
|
||||
@ -101,10 +101,12 @@ rt/$(CFG_RUNTIME): $(RUNTIME_OBJS) $(MKFILES) $(RUNTIME_HDR) $(RUNTIME_DEF) $(RU
|
||||
# FIXME: For some reason libuv's makefiles can't figure out the correct definition
|
||||
# of CC on the mingw I'm using, so we are explicitly using gcc. Also, we
|
||||
# have to list environment variables first on windows... mysterious
|
||||
$(S)src/rt/libuv/uv.a: $(S)src/rt/libuv/LIBUV_REVISION
|
||||
$(Q)CFLAGS=\"-m32\" LDFLAGS=\"-m32\" CC=gcc $(MAKE) -C $(S)src/rt/libuv
|
||||
$(Q)mkdir -p rt/libuv
|
||||
$(Q)cp $(S)src/rt/libuv/uv.a rt/libuv/uv.a
|
||||
rt/libuv/uv.a: $(wildcard \
|
||||
$(S)src/rt/libuv/* \
|
||||
$(S)src/rt/libuv/*/* \
|
||||
$(S)src/rt/libuv/*/*/* \
|
||||
$(S)src/rt/libuv/*/*/*/*)
|
||||
$(Q)CFLAGS=\"-m32\" LDFLAGS=\"-m32\" CC=gcc $(MAKE) -C rt/libuv
|
||||
|
||||
# These could go in rt.mk or rustllvm.mk, they're needed for both.
|
||||
|
||||
|
@ -18,13 +18,30 @@
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
# IN THE SOFTWARE.
|
||||
|
||||
include ../../config.mk
|
||||
CFLAGS=-m32
|
||||
LDFLAGS=-m32
|
||||
CC=gcc
|
||||
|
||||
S:=$(shell cd ../../; cd $(CFG_SRC_DIR)src/rt/libuv; pwd)
|
||||
|
||||
ifdef VERBOSE
|
||||
Q :=
|
||||
EE =
|
||||
else
|
||||
Q := @
|
||||
EE = echo $(1)
|
||||
endif
|
||||
|
||||
VPATH:=$(S)
|
||||
|
||||
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
|
||||
|
||||
ifdef MSVC
|
||||
uname_S := MINGW
|
||||
endif
|
||||
|
||||
CPPFLAGS += -Iinclude
|
||||
CPPFLAGS += -I$(S)/include
|
||||
|
||||
CARES_OBJS =
|
||||
CARES_OBJS += src/ares/ares__close_sockets.o
|
||||
@ -77,37 +94,8 @@ else
|
||||
include config-unix.mk
|
||||
endif
|
||||
|
||||
TESTS=test/echo-server.c test/test-*.c
|
||||
BENCHMARKS=test/echo-server.c test/dns-server.c test/benchmark-*.c
|
||||
|
||||
all: uv.a test/run-tests test/run-benchmarks
|
||||
all: uv.a
|
||||
|
||||
$(CARES_OBJS): %.o: %.c
|
||||
$(CC) -o $*.o -c $(CFLAGS) $(CPPFLAGS) $< -DHAVE_CONFIG_H
|
||||
|
||||
test/run-tests$(E): test/*.h test/run-tests.c $(RUNNER_SRC) test/runner-unix.c $(TESTS) uv.a
|
||||
$(CC) $(CPPFLAGS) $(RUNNER_CFLAGS) $(RUNNER_LINKFLAGS) -o test/run-tests test/run-tests.c \
|
||||
test/runner.c $(RUNNER_SRC) $(TESTS) uv.a $(RUNNER_LIBS)
|
||||
|
||||
test/run-benchmarks$(E): test/*.h test/run-benchmarks.c test/runner.c $(RUNNER_SRC) $(BENCHMARKS) uv.a
|
||||
$(CC) $(CPPFLAGS) $(RUNNER_CFLAGS) $(RUNNER_LINKFLAGS) -o test/run-benchmarks test/run-benchmarks.c \
|
||||
test/runner.c $(RUNNER_SRC) $(BENCHMARKS) uv.a $(RUNNER_LIBS)
|
||||
|
||||
test/echo.o: test/echo.c test/echo.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) -c test/echo.c -o test/echo.o
|
||||
|
||||
|
||||
.PHONY: clean clean-platform distclean distclean-platform test benchmark
|
||||
|
||||
|
||||
test: test/run-tests$(E)
|
||||
test/run-tests
|
||||
|
||||
bench: test/run-benchmarks$(E)
|
||||
test/run-benchmarks
|
||||
|
||||
clean: clean-platform
|
||||
$(RM) -f src/*.o *.a test/run-tests$(E) test/run-benchmarks$(E)
|
||||
|
||||
distclean: distclean-platform
|
||||
$(RM) -f src/*.o *.a test/run-tests$(E) test/run-benchmarks$(E)
|
||||
@$(call EE, compile: $@)
|
||||
$(Q)$(CC) -o $*.o -c $(CFLAGS) $(CPPFLAGS) $< -DHAVE_CONFIG_H
|
||||
|
@ -24,24 +24,22 @@ CC ?= $(PREFIX)gcc
|
||||
AR ?= $(PREFIX)ar
|
||||
E=.exe
|
||||
|
||||
CFLAGS+=$(CPPFLAGS) -g --std=gnu89 -D_WIN32_WINNT=0x0501 -Isrc/ares/config_win32
|
||||
CFLAGS+=$(CPPFLAGS) -g --std=gnu89 -D_WIN32_WINNT=0x0501 -I$(S)src/ares/config_win32
|
||||
LINKFLAGS=-lm
|
||||
|
||||
CARES_OBJS += src/ares/windows_port.o
|
||||
|
||||
RUNNER_CFLAGS=$(CFLAGS) -D_GNU_SOURCE # Need _GNU_SOURCE for strdup?
|
||||
RUNNER_LINKFLAGS=$(LINKFLAGS)
|
||||
RUNNER_LIBS=-lws2_32
|
||||
RUNNER_SRC=test/runner-win.c
|
||||
|
||||
uv.a: src/uv-win.o src/uv-common.o src/uv-eio.o src/eio/eio.o $(CARES_OBJS)
|
||||
$(AR) rcs uv.a src/uv-win.o src/uv-common.o src/uv-eio.o src/eio/eio.o $(CARES_OBJS)
|
||||
@$(call EE, ar: $@)
|
||||
$(Q)$(AR) rcs uv.a $^
|
||||
|
||||
src/uv-win.o: src/uv-win.c include/uv.h include/uv-win.h
|
||||
$(CC) $(CFLAGS) -c src/uv-win.c -o src/uv-win.o
|
||||
@$(call EE, compile: $@)
|
||||
$(Q)$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
src/uv-common.o: src/uv-common.c include/uv.h include/uv-win.h
|
||||
$(CC) $(CFLAGS) -c src/uv-common.c -o src/uv-common.o
|
||||
@$(call EE, compile: $@)
|
||||
$(Q)$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
EIO_CPPFLAGS += $(CPPFLAGS)
|
||||
EIO_CPPFLAGS += -DEIO_CONFIG_H=\"$(EIO_CONFIG)\"
|
||||
@ -49,15 +47,10 @@ EIO_CPPFLAGS += -DEIO_STACKSIZE=65536
|
||||
EIO_CPPFLAGS += -D_GNU_SOURCE
|
||||
|
||||
src/eio/eio.o: src/eio/eio.c
|
||||
$(CC) $(EIO_CPPFLAGS) $(CFLAGS) -c src/eio/eio.c -o src/eio/eio.o
|
||||
@$(call EE, compile: $@)
|
||||
$(Q)$(CC) $(EIO_CPPFLAGS) $(CFLAGS) -c $< -o $@
|
||||
|
||||
src/uv-eio.o: src/uv-eio.c
|
||||
$(CC) $(CPPFLAGS) -Isrc/eio/ $(CFLAGS) -c src/uv-eio.c -o src/uv-eio.o
|
||||
@$(call EE, compile: $@)
|
||||
$(Q)$(CC) $(CPPFLAGS) -I$(S)src/eio/ $(CFLAGS) -c $< -o $@
|
||||
|
||||
clean-platform:
|
||||
-rm -f src/ares/*.o
|
||||
-rm -f src/eio/*.o
|
||||
|
||||
distclean-platform:
|
||||
-rm -f src/ares/*.o
|
||||
-rm -f src/eio/*.o
|
||||
|
@ -23,7 +23,7 @@ AR ?= $(PREFIX)ar
|
||||
E=
|
||||
CSTDFLAG=--std=c89 -pedantic
|
||||
CFLAGS+=-g
|
||||
CPPFLAGS += -Isrc/ev
|
||||
CPPFLAGS += -I$(S)/src/ev
|
||||
LINKFLAGS=-lm
|
||||
|
||||
CPPFLAGS += -D_LARGEFILE_SOURCE
|
||||
@ -32,7 +32,7 @@ CPPFLAGS += -D_FILE_OFFSET_BITS=64
|
||||
ifeq (SunOS,$(uname_S))
|
||||
EV_CONFIG=config_sunos.h
|
||||
EIO_CONFIG=config_sunos.h
|
||||
CPPFLAGS += -Isrc/ares/config_sunos
|
||||
CPPFLAGS += -I$(S)/src/ares/config_sunos
|
||||
LINKFLAGS+=-lsocket -lnsl
|
||||
UV_OS_FILE=uv-sunos.c
|
||||
endif
|
||||
@ -40,7 +40,7 @@ endif
|
||||
ifeq (Darwin,$(uname_S))
|
||||
EV_CONFIG=config_darwin.h
|
||||
EIO_CONFIG=config_darwin.h
|
||||
CPPFLAGS += -Isrc/ares/config_darwin
|
||||
CPPFLAGS += -I$(S)/src/ares/config_darwin
|
||||
LINKFLAGS+=-framework CoreServices
|
||||
UV_OS_FILE=uv-darwin.c
|
||||
endif
|
||||
@ -49,7 +49,7 @@ ifeq (Linux,$(uname_S))
|
||||
EV_CONFIG=config_linux.h
|
||||
EIO_CONFIG=config_linux.h
|
||||
CSTDFLAG += -D_XOPEN_SOURCE=600
|
||||
CPPFLAGS += -Isrc/ares/config_linux
|
||||
CPPFLAGS += -I$(S)/src/ares/config_linux
|
||||
LINKFLAGS+=-lrt
|
||||
UV_OS_FILE=uv-linux.c
|
||||
endif
|
||||
@ -57,7 +57,7 @@ endif
|
||||
ifeq (FreeBSD,$(uname_S))
|
||||
EV_CONFIG=config_freebsd.h
|
||||
EIO_CONFIG=config_freebsd.h
|
||||
CPPFLAGS += -Isrc/ares/config_freebsd
|
||||
CPPFLAGS += -I$(S)/src/ares/config_freebsd
|
||||
LINKFLAGS+=
|
||||
UV_OS_FILE=uv-freebsd.c
|
||||
endif
|
||||
@ -65,7 +65,7 @@ endif
|
||||
ifneq (,$(findstring CYGWIN,$(uname_S)))
|
||||
EV_CONFIG=config_cygwin.h
|
||||
EIO_CONFIG=config_cygwin.h
|
||||
CPPFLAGS += -Isrc/ares/config_cygwin
|
||||
CPPFLAGS += -I$(S)/src/ares/config_cygwin
|
||||
LINKFLAGS+=
|
||||
UV_OS_FILE=uv-cygwin.c
|
||||
endif
|
||||
@ -78,20 +78,24 @@ RUNNER_LIBS=
|
||||
RUNNER_SRC=test/runner-unix.c
|
||||
|
||||
uv.a: src/uv-unix.o src/uv-common.o src/uv-platform.o src/ev/ev.o src/uv-eio.o src/eio/eio.o $(CARES_OBJS)
|
||||
$(AR) rcs uv.a src/uv-unix.o src/uv-platform.o src/uv-common.o src/uv-eio.o src/ev/ev.o \
|
||||
src/eio/eio.o $(CARES_OBJS)
|
||||
@$(call EE, ar: $@)
|
||||
$(Q)$(AR) rcs uv.a $^
|
||||
|
||||
src/uv-platform.o: src/$(UV_OS_FILE) include/uv.h include/uv-unix.h
|
||||
$(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c src/$(UV_OS_FILE) -o src/uv-platform.o
|
||||
@$(call EE, compile: $@)
|
||||
$(Q)$(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
|
||||
|
||||
src/uv-unix.o: src/uv-unix.c include/uv.h include/uv-unix.h
|
||||
$(CC) $(CSTDFLAG) $(CPPFLAGS) -Ieio $(CFLAGS) -c src/uv-unix.c -o src/uv-unix.o
|
||||
@$(call EE, compile: $@)
|
||||
$(Q)$(CC) $(CSTDFLAG) $(CPPFLAGS) -I$(S)/eio $(CFLAGS) -c $< -o $@
|
||||
|
||||
src/uv-common.o: src/uv-common.c include/uv.h include/uv-unix.h
|
||||
$(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c src/uv-common.c -o src/uv-common.o
|
||||
@$(call EE, compile: $@)
|
||||
$(Q)$(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
|
||||
|
||||
src/ev/ev.o: src/ev/ev.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) -c src/ev/ev.c -o src/ev/ev.o -DEV_CONFIG_H=\"$(EV_CONFIG)\"
|
||||
@$(call EE, compile: $@)
|
||||
$(Q)$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@ -DEV_CONFIG_H=\"$(EV_CONFIG)\"
|
||||
|
||||
|
||||
EIO_CPPFLAGS += $(CPPFLAGS)
|
||||
@ -100,20 +104,9 @@ EIO_CPPFLAGS += -DEIO_STACKSIZE=65536
|
||||
EIO_CPPFLAGS += -D_GNU_SOURCE
|
||||
|
||||
src/eio/eio.o: src/eio/eio.c
|
||||
$(CC) $(EIO_CPPFLAGS) $(CFLAGS) -c src/eio/eio.c -o src/eio/eio.o
|
||||
@$(call EE, compile: $@)
|
||||
$(Q)$(CC) $(EIO_CPPFLAGS) $(CFLAGS) -c $< -o $@
|
||||
|
||||
src/uv-eio.o: src/uv-eio.c
|
||||
$(CC) $(CPPFLAGS) -Isrc/eio/ $(CSTDFLAG) $(CFLAGS) -c src/uv-eio.c -o src/uv-eio.o
|
||||
|
||||
|
||||
clean-platform:
|
||||
-rm -f src/ares/*.o
|
||||
-rm -f src/ev/*.o
|
||||
-rm -f src/eio/*.o
|
||||
-rm -rf test/run-tests.dSYM run-benchmarks.dSYM
|
||||
|
||||
distclean-platform:
|
||||
-rm -f src/ares/*.o
|
||||
-rm -f src/ev/*.o
|
||||
-rm -f src/eio/*.o
|
||||
-rm -rf test/run-tests.dSYM run-benchmarks.dSYM
|
||||
@$(call EE, compile: $@)
|
||||
$(Q)$(CC) $(CPPFLAGS) -I$(S)/src/eio/ $(CSTDFLAG) $(CFLAGS) -c $< -o $@
|
||||
|
Loading…
Reference in New Issue
Block a user