mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Rewrite Makefiles to be closer to doing The Right Thing(tm)
This commit is contained in:
parent
b1ef70b402
commit
0b42b7f537
6 changed files with 299 additions and 392 deletions
476
Makefile.in
476
Makefile.in
|
@ -1,367 +1,151 @@
|
|||
VPATH=%VPATH%
|
||||
# Recursive wildcard function
|
||||
# http://blog.jgc.org/2011/07/gnu-make-recursive-wildcard-function.html
|
||||
rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) \
|
||||
$(filter $(subst *,%,$2),$d))
|
||||
|
||||
RUSTC?=rustc
|
||||
RUSTFLAGS?=
|
||||
include config.mk
|
||||
|
||||
ifneq ($(DISABLE_OPTIMIZE),1)
|
||||
RUSTFLAGS+=-O
|
||||
# Target-and-rule "utility variables"
|
||||
ifdef VERBOSE
|
||||
Q :=
|
||||
E =
|
||||
else
|
||||
Q := @
|
||||
E = echo $(1)
|
||||
endif
|
||||
|
||||
UNAME=$(shell uname)
|
||||
BUILD_DIR=$(shell pwd)
|
||||
S := $(CFG_SRC_DIR)
|
||||
B := $(CFG_BUILD_DIR)
|
||||
|
||||
ifeq ($(UNAME),Darwin)
|
||||
OSTYPE=darwin
|
||||
endif
|
||||
ifeq ($(UNAME),Linux)
|
||||
OSTYPE=linux
|
||||
VPATH := $(S)src
|
||||
|
||||
# Delete the built-in rules.
|
||||
.SUFFIXES:
|
||||
%:: %,v
|
||||
%:: RCS/%,v
|
||||
%:: RCS/%
|
||||
%:: s.%
|
||||
%:: SCCS/s.%
|
||||
|
||||
MKFILE_DEPS := config.stamp $(call rwildcard,$(S)mk/,*)
|
||||
|
||||
CFG_RUSTC_FLAGS := $(RUSTFLAGS)
|
||||
|
||||
ifdef CFG_DISABLE_OPTIMIZE
|
||||
$(info cfg: disabling rustc optimization (CFG_DISABLE_OPTIMIZE))
|
||||
CFG_RUSTC_FLAGS +=
|
||||
else
|
||||
CFG_RUSTC_FLAGS += -O
|
||||
endif
|
||||
|
||||
RUSTLIBS = \
|
||||
-L src/rust-harfbuzz \
|
||||
-L src/rust-mozjs \
|
||||
-L src/rust-azure \
|
||||
-L src/rust-cocoa \
|
||||
-L src/rust-stb-image \
|
||||
-L src/rust-geom \
|
||||
-L src/rust-opengles \
|
||||
-L src/rust-glut \
|
||||
-L src/rust-layers \
|
||||
-L src/rust-http-client \
|
||||
-L src/rust-hubbub \
|
||||
-L src/rust-core-foundation \
|
||||
-L src/rust-io-surface \
|
||||
-L src/sharegl \
|
||||
$(NULL)
|
||||
|
||||
RUST_SRC=$(shell find $(VPATH)/src -type f -name '*.rs')
|
||||
|
||||
SERVO_DEPS = \
|
||||
src/servo/servo.rc \
|
||||
$(RUST_SRC) \
|
||||
$(NULL)
|
||||
CHECK_DEPS =
|
||||
CLEAN_DEPS =
|
||||
AZURE_DEPS = \
|
||||
src/rust-geom/librustgeom.dummy
|
||||
GLUT_DEPS = \
|
||||
src/rust-opengles/librustopengles.dummy
|
||||
LAYERS_DEPS = \
|
||||
src/rust-geom/librustgeom.dummy \
|
||||
src/rust-opengles/librustopengles.dummy \
|
||||
src/rust-glut/librustglut.dummy \
|
||||
src/rust-azure/libazure.dummy
|
||||
SHAREGL_DEPS = \
|
||||
src/rust-opengles/librustopengles.dummy \
|
||||
src/sharegl/libsharegl.dummy
|
||||
|
||||
ifeq ($(OSTYPE),darwin)
|
||||
SERVO_DEPS += \
|
||||
src/rust-cocoa/libcocoa.dummy \
|
||||
src/rust-core-foundation/librustcorefoundation.dummy \
|
||||
src/rust-io-surface/librustiosurface.dummy
|
||||
# I want the cocoa check to come before the servo check since if cocoa
|
||||
# doesn't work neither does servo
|
||||
CHECK_DEPS += \
|
||||
check-rust-cocoa \
|
||||
check-rust-core-foundation \
|
||||
check-rust-io-surface
|
||||
CLEAN_DEPS += \
|
||||
clean-rust-cocoa \
|
||||
clean-rust-core-foundation \
|
||||
clean-rust-io-surface
|
||||
AZURE_DEPS += \
|
||||
src/rust-cocoa/libcocoa.dummy \
|
||||
src/rust-core-foundation/librustcorefoundation.dummy
|
||||
LAYERS_DEPS += \
|
||||
src/rust-cocoa/libcocoa.dummy \
|
||||
src/rust-core-foundation/librustcorefoundation.dummy
|
||||
IOSURFACE_DEPS = src/rust-core-foundation/librustcorefoundation.dummy
|
||||
SHAREGL_DEPS += \
|
||||
src/rust-core-foundation/librustcorefoundation.dummy \
|
||||
src/rust-io-surface/librustiosurface.dummy
|
||||
ifdef CFG_ENABLE_DEBUG
|
||||
$(info cfg: enabling more debugging (CFG_ENABLE_DEBUG))
|
||||
CFG_RUSTC_FLAGS +=
|
||||
CFG_GCCISH_CFLAGS += -DRUST_DEBUG
|
||||
else
|
||||
CFG_GCCISH_CFLAGS += -DRUST_NDEBUG
|
||||
endif
|
||||
|
||||
SERVO_DEPS += \
|
||||
src/mozjs/libjs_static.a \
|
||||
src/rust-harfbuzz/libharfbuzz.dummy \
|
||||
src/rust-mozjs/libjs.dummy \
|
||||
src/rust-azure/libazure.dummy \
|
||||
src/rust-stb-image/libstb-image.dummy \
|
||||
src/rust-geom/librustgeom.dummy \
|
||||
src/rust-opengles/librustopengles.dummy \
|
||||
src/rust-glut/librustglut.dummy \
|
||||
src/rust-layers/librustlayers.dummy \
|
||||
src/rust-http-client/libhttp_client.dummy \
|
||||
src/libparserutils/libparserutils.dummy \
|
||||
src/libhubbub/libhubbub.dummy \
|
||||
src/servo-sandbox/servo-sandbox.dummy \
|
||||
src/rust-hubbub/librusthubbub.dummy \
|
||||
src/sharegl/libsharegl.dummy \
|
||||
$(NULL)
|
||||
|
||||
CHECK_DEPS += \
|
||||
check-rust-harfbuzz \
|
||||
check-rust-mozjs \
|
||||
check-rust-azure \
|
||||
check-rust-stb-image \
|
||||
check-rust-geom \
|
||||
check-rust-opengles \
|
||||
check-rust-glut \
|
||||
check-rust-layers \
|
||||
check-rust-http-client \
|
||||
check-servo \
|
||||
$(NULL)
|
||||
export CFG_RUSTC
|
||||
export CFG_RUSTC_FLAGS
|
||||
|
||||
CLEAN_DEPS += \
|
||||
clean-rust-harfbuzz \
|
||||
clean-rust-mozjs \
|
||||
clean-rust-azure \
|
||||
clean-rust-stb-image \
|
||||
clean-rust-geom \
|
||||
clean-rust-opengles \
|
||||
clean-rust-glut \
|
||||
clean-rust-layers \
|
||||
clean-rust-http-client \
|
||||
clean-libparserutils \
|
||||
clean-libhubbub \
|
||||
clean-servo-sandbox \
|
||||
clean-rust-hubbub \
|
||||
clean-servo \
|
||||
$(NULL)
|
||||
######################################################################
|
||||
# Re-configuration
|
||||
######################################################################
|
||||
|
||||
ifndef CFG_DISABLE_MANAGE_SUBMODULES
|
||||
# This is a pretty expensive operation but I don't see any way to avoid it
|
||||
NEED_GIT_RECONFIG=$(shell cd "$(S)" && "$(CFG_GIT)" submodule status | grep -c '^\(+\|-\)')
|
||||
else
|
||||
NEED_GIT_RECONFIG=0
|
||||
endif
|
||||
|
||||
ifeq ($(NEED_GIT_RECONFIG),0)
|
||||
else
|
||||
# If the submodules have changed then always execute config.mk
|
||||
.PHONY: $(S)config.stamp
|
||||
endif
|
||||
|
||||
$(S)Makefile $(S)config.mk: $(S)config.stamp
|
||||
|
||||
$(S)config.stamp : $(S)configure $(S)Makefile.in
|
||||
@$(call E, cfg: reconfiguring)
|
||||
$(Q)$(S)configure $(CFG_CONFIGURE_ARGS)
|
||||
|
||||
|
||||
define DEF_SUBMODULE_VARS
|
||||
DEPS_$(1) =
|
||||
CFLAGS_$(1) =
|
||||
DONE_$(1) = $$(B)src/$(1)/$(1).dummy
|
||||
DEPS_SUBMODULES += $(1)
|
||||
endef
|
||||
|
||||
# these will get populated.
|
||||
DEPS_SUBMODULES =
|
||||
|
||||
$(foreach submodule,$(CFG_SUBMODULES),\
|
||||
$(eval $(call DEF_SUBMODULE_VARS,$(submodule))))
|
||||
|
||||
# include submodule dependencies configuration
|
||||
include $(S)mk/sub.mk
|
||||
|
||||
# Define how to make submodule targets
|
||||
define DEF_SUBMODULE_RULES
|
||||
# variables that depend on dependency definitions from sub.mk!
|
||||
ENV_CFLAGS_$(1) = CFLAGS="$$(CFLAGS_$(1))"
|
||||
ENV_RFLAGS_$(1) = RUSTFLAGS="$$(strip $$(CFG_RUSTC_FLAGS)) $$(addprefix -L $$(B)src/,$$(DEPS_$(1)))"
|
||||
|
||||
# use a rough approximation of submodule dependencies to trigger calling submodule make
|
||||
# whenever a submodule changes
|
||||
# TODO: this may be a bit brutish, but is there a better way?
|
||||
ROUGH_DEPS_$(1)=$$(call rwildcard,$$(S)src/$(1),*h *c *cpp *rs *rc)
|
||||
|
||||
# the main target for a submodule
|
||||
# --
|
||||
# this depends on the phony command, which enforces an ordering between parallel
|
||||
# recursive makes, but causes the phony command to always run whether or not
|
||||
# anything has actually changes.
|
||||
$$(DONE_$(1)) : $$(DEPS_$(1)) $$(ROUGH_DEPS_$(1))
|
||||
# @$$(call E, make: $(1))
|
||||
# @$$(call E, $(1) deps= $$(DEPS_$(1)))
|
||||
# @$$(call E, $(1) cflags= $$(ENV_CFLAGS_$(1)))
|
||||
# @$$(call E, $(1) rflags= $$(ENV_RFLAGS_$(1)))
|
||||
|
||||
$$(Q) \
|
||||
$$(ENV_CFLAGS_$(1)) \
|
||||
$$(ENV_RFLAGS_$(1)) \
|
||||
$$(MAKE) -C $$(B)src/$(1)
|
||||
$$(Q)touch $$(DONE_$(1))
|
||||
|
||||
# main submodule target
|
||||
$(1) : $$(DEPS_$(1)) $$(DONE_$(1))
|
||||
endef
|
||||
|
||||
$(foreach submodule,$(CFG_SUBMODULES),\
|
||||
$(eval $(call DEF_SUBMODULE_RULES,$(submodule))))
|
||||
|
||||
.PHONY : $(1) $(DEPS_SUBMODULES)
|
||||
|
||||
RFLAGS_servo = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES))
|
||||
SRC_servo = $(call rwildcard,$(S)src/servo/,*.rs)
|
||||
CRATE_servo = $(S)src/servo/servo.rc
|
||||
DONE_SUBMODULES = $(foreach dep,$(DEPS_SUBMODULES),$(DONE_$(dep)))
|
||||
|
||||
DEPS_servo = $(CRATE_servo) $(SRC_servo) $(DONE_SUBMODULES)
|
||||
|
||||
# rules that depend on having correct meta-target vars (DEPS_CLEAN, DEPS_servo, etc)
|
||||
include $(S)mk/check.mk
|
||||
include $(S)mk/clean.mk
|
||||
|
||||
.DEFAULT_GOAL := all
|
||||
.PHONY: all
|
||||
all: servo package
|
||||
|
||||
|
||||
# Servo binaries
|
||||
|
||||
servo: $(SERVO_DEPS)
|
||||
$(RUSTC) $(RUSTFLAGS) $(RUSTLIBS) -o $@ $< --bin
|
||||
|
||||
libservo.dummy: $(SERVO_DEPS)
|
||||
$(RUSTC) $(RUSTFLAGS) $(RUSTLIBS) -o $@ $<
|
||||
touch $@
|
||||
|
||||
servo-test: $(SERVO_DEPS)
|
||||
$(RUSTC) $(RUSTFLAGS) $(RUSTLIBS) --test -o $@ $<
|
||||
|
||||
reftest: src/reftest/reftest.rs libservo.dummy
|
||||
$(RUSTC) $(RUSTFLAGS) $(RUSTLIBS) -o $@ $< -L .
|
||||
|
||||
# Convenient sub-project targets
|
||||
|
||||
.PHONY: mozjs rust-harfbuzz rust-mozjs rust-azure rust-cocoa \
|
||||
rust-stb-image rust-geom rust-opengles rust-glut rust-layers \
|
||||
rust-http-client rust-core-foundation rust-hubbub
|
||||
|
||||
mozjs: src/mozjs/libjs_static.a
|
||||
|
||||
rust-harfbuzz: src/rust-harfbuzz/libharfbuzz.dummy
|
||||
|
||||
rust-mozjs: src/rust-mozjs/libjs.dummy
|
||||
|
||||
rust-azure: src/rust-azure/libazure.dummy
|
||||
|
||||
rust-cocoa: src/rust-cocoa/libcocoa.dummy
|
||||
|
||||
rust-stb-image: src/rust-stb-image/libstb-image.dummy
|
||||
|
||||
rust-geom: src/rust-geom/librustgeom.dummy
|
||||
|
||||
rust-opengles: src/rust-opengles/librustopengles.dummy
|
||||
|
||||
rust-glut: src/rust-glut/librustglut.dummy
|
||||
|
||||
rust-layers: src/rust-layers/librustlayers.dummy
|
||||
|
||||
rust-http-client: src/rust-http-client/libhttp_client.dummy
|
||||
|
||||
rust-core-foundation: src/rust-core-foundation/librustcorefoundation.dummy
|
||||
|
||||
rust-hubbub: src/rust-hubbub/librusthubbub.dummy
|
||||
|
||||
libparserutils: src/libparserutils/libparserutils.dummy
|
||||
|
||||
libhubbub: src/libhubbub/libhubbub.dummy
|
||||
|
||||
servo-sandbox: src/servo-sandbox/servo-sandbox.dummy
|
||||
|
||||
rust-io-surface: src/rust-io-surface/librustiosurface.dummy
|
||||
|
||||
sharegl: src/sharegl/libsharegl.dummy
|
||||
|
||||
|
||||
# Subproject rules
|
||||
|
||||
src/mozjs/libjs_static.a:
|
||||
$(MAKE) -C src/mozjs
|
||||
|
||||
src/rust-harfbuzz/libharfbuzz.dummy:
|
||||
$(MAKE) -C src/rust-harfbuzz
|
||||
|
||||
src/rust-mozjs/libjs.dummy: src/mozjs/libjs_static.a
|
||||
RUSTFLAGS="$(RUSTFLAGS) -L ../mozjs/" CFLAGS="-I../mozjs/dist/include" \
|
||||
$(MAKE) -C src/rust-mozjs
|
||||
|
||||
src/rust-azure/libazure.dummy: $(AZURE_DEPS)
|
||||
RUSTFLAGS="$(RUSTFLAGS) -L ../rust-cocoa -L ../rust-geom" $(MAKE) -C src/rust-azure
|
||||
|
||||
src/rust-cocoa/libcocoa.dummy:
|
||||
$(MAKE) -C src/rust-cocoa
|
||||
|
||||
src/rust-stb-image/libstb-image.dummy:
|
||||
$(MAKE) -C src/rust-stb-image
|
||||
|
||||
src/rust-geom/librustgeom.dummy:
|
||||
$(MAKE) -C src/rust-geom
|
||||
|
||||
src/rust-opengles/librustopengles.dummy:
|
||||
$(MAKE) -C src/rust-opengles
|
||||
|
||||
src/rust-glut/librustglut.dummy: $(GLUT_DEPS)
|
||||
RUSTFLAGS="$(RUSTFLAGS) -L ../rust-opengles" $(MAKE) -C src/rust-glut
|
||||
|
||||
src/rust-layers/librustlayers.dummy: $(LAYERS_DEPS)
|
||||
RUSTFLAGS="$(RUSTFLAGS) -L ../rust-geom -L ../rust-opengles -L ../rust-glut -L ../rust-azure -L ../rust-cocoa" \
|
||||
$(MAKE) -C src/rust-layers
|
||||
|
||||
src/rust-http-client/libhttp_client.dummy:
|
||||
$(MAKE) -C src/rust-http-client
|
||||
|
||||
src/libparserutils/libparserutils.dummy:
|
||||
$(MAKE) -C src/libparserutils
|
||||
|
||||
src/libhubbub/libhubbub.dummy:
|
||||
$(MAKE) -C src/libhubbub
|
||||
|
||||
src/servo-sandbox/servo-sandbox.dummy:
|
||||
$(MAKE) -C src/servo-sandbox
|
||||
|
||||
src/rust-hubbub/librusthubbub.dummy:
|
||||
$(MAKE) -C src/rust-hubbub
|
||||
|
||||
src/rust-core-foundation/librustcorefoundation.dummy:
|
||||
$(MAKE) -C src/rust-core-foundation
|
||||
|
||||
src/rust-io-surface/librustiosurface.dummy: $(IOSURFACE_DEPS)
|
||||
RUSTFLAGS="$(RUSTFLAGS) -L ../rust-core-foundation" $(MAKE) -C src/rust-io-surface
|
||||
|
||||
src/sharegl/libsharegl.dummy: $(SHAREGL_DEPS)
|
||||
RUSTFLAGS="$(RUSTFLAGS) -L ../rust-core-foundation -L ../rust-io-surface -L ../rust-opengles -L ../rust-geom" $(MAKE) -C src/sharegl
|
||||
|
||||
|
||||
# Testing targets
|
||||
|
||||
.PHONY: check $(CHECK_DEPS)
|
||||
|
||||
check: $(CHECK_DEPS)
|
||||
|
||||
check-servo: servo-test
|
||||
./servo-test $(TESTNAME)
|
||||
|
||||
check-ref: reftest
|
||||
./reftest --source-dir=$(VPATH)/src/test/ref --work-dir=src/test/ref $(TESTNAME)
|
||||
|
||||
check-rust-harfbuzz:
|
||||
$(MAKE) check -C src/rust-harfbuzz
|
||||
|
||||
check-rust-mozjs: mozjs
|
||||
RUSTFLAGS="$(RUSTFLAGS) -L ../mozjs/" CFLAGS="-I../mozjs/dist/include" \
|
||||
$(MAKE) check -C src/rust-mozjs
|
||||
|
||||
check-rust-azure: $(AZURE_DEPS)
|
||||
RUSTFLAGS="$(RUSTFLAGS) -L ../rust-cocoa -L ../rust-geom" $(MAKE) check -C src/rust-azure
|
||||
|
||||
check-rust-cocoa:
|
||||
$(MAKE) check -C src/rust-cocoa
|
||||
|
||||
check-rust-stb-image:
|
||||
$(MAKE) check -C src/rust-stb-image
|
||||
|
||||
check-rust-geom:
|
||||
$(MAKE) check -C src/rust-geom
|
||||
|
||||
check-rust-opengles:
|
||||
$(MAKE) check -C src/rust-opengles
|
||||
|
||||
check-rust-glut: $(GLUT_DEPS)
|
||||
RUSTFLAGS="$(RUSTFLAGS) -L ../rust-opengles" $(MAKE) check -C src/rust-glut
|
||||
|
||||
check-rust-layers: $(LAYERS_DEPS)
|
||||
RUSTFLAGS="$(RUSTFLAGS) -L ../rust-geom -L ../rust-opengles -L ../rust-glut -L ../rust-azure -L ../rust-cocoa" \
|
||||
$(MAKE) check -C src/rust-layers
|
||||
|
||||
check-rust-http-client:
|
||||
$(MAKE) check -C src/rust-http-client
|
||||
|
||||
check-rust-core-foundation:
|
||||
$(MAKE) check -C src/rust-core-foundation
|
||||
|
||||
check-rust-io-surface:
|
||||
$(MAKE) check -C src/rust-io-surface
|
||||
|
||||
# Clean targets
|
||||
|
||||
.PHONY: clean $(CLEAN_DEPS)
|
||||
|
||||
clean: $(CLEAN_DEPS)
|
||||
|
||||
clean-rust-harfbuzz:
|
||||
$(MAKE) clean -C src/rust-harfbuzz
|
||||
|
||||
clean-mozjs:
|
||||
$(MAKE) clean -C src/mozjs
|
||||
|
||||
clean-rust-mozjs:
|
||||
$(MAKE) clean -C src/rust-mozjs
|
||||
|
||||
clean-rust-azure:
|
||||
$(MAKE) clean -C src/rust-azure
|
||||
|
||||
clean-rust-cocoa:
|
||||
$(MAKE) clean -C src/rust-cocoa
|
||||
|
||||
clean-rust-stb-image:
|
||||
$(MAKE) clean -C src/rust-stb-image
|
||||
|
||||
clean-rust-geom:
|
||||
$(MAKE) clean -C src/rust-geom
|
||||
|
||||
clean-rust-opengles:
|
||||
$(MAKE) clean -C src/rust-opengles
|
||||
|
||||
clean-rust-glut:
|
||||
$(MAKE) clean -C src/rust-glut
|
||||
|
||||
clean-rust-layers:
|
||||
$(MAKE) clean -C src/rust-layers
|
||||
|
||||
clean-rust-http-client:
|
||||
$(MAKE) clean -C src/rust-http-client
|
||||
|
||||
clean-rust-core-foundation:
|
||||
$(MAKE) clean -C src/rust-core-foundation
|
||||
|
||||
clean-libparserutils:
|
||||
$(MAKE) clean -C src/libparserutils
|
||||
|
||||
clean-libhubbub:
|
||||
$(MAKE) clean -C src/libhubbub
|
||||
|
||||
clean-servo-sandbox:
|
||||
$(MAKE) clean -C src/servo-sandbox
|
||||
|
||||
clean-rust-hubbub:
|
||||
$(MAKE) clean -C src/rust-hubbub
|
||||
|
||||
clean-rust-io-surface:
|
||||
$(MAKE) clean -C src/rust-io-surface
|
||||
|
||||
clean-servo:
|
||||
rm -f servo servo-test
|
||||
|
||||
servo: $(DEPS_servo)
|
||||
$(CFG_RUSTC) $(RFLAGS_servo) -o $@ $< --bin
|
||||
|
||||
# Darwin app packaging
|
||||
|
||||
|
|
110
configure
vendored
110
configure
vendored
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
msg() {
|
||||
echo "configure: $1"
|
||||
|
@ -73,7 +73,7 @@ putvar() {
|
|||
else
|
||||
printf "configure: %-20s := %s %s\n" $1 "$T" "$2"
|
||||
fi
|
||||
printf "%-20s := %s\n" $1 "$T" >>config.tmp
|
||||
printf "%-20s := %s\n" $1 "$T" >>${CFG_SRC_DIR}config.tmp
|
||||
}
|
||||
|
||||
probe() {
|
||||
|
@ -198,6 +198,29 @@ need_cmd sed
|
|||
|
||||
msg "inspecting environment"
|
||||
|
||||
CFG_OSTYPE=$(uname -s)
|
||||
case $CFG_OSTYPE in
|
||||
Linux)
|
||||
CFG_OSTYPE=linux
|
||||
;;
|
||||
|
||||
FreeBSD)
|
||||
CFG_OSTYPE=freebsd
|
||||
;;
|
||||
|
||||
Darwin)
|
||||
CFG_OSTYPE=darwin
|
||||
;;
|
||||
|
||||
MINGW32*)
|
||||
CFG_OSTYPE=mingw32
|
||||
;;
|
||||
*)
|
||||
err "unknown OS type: $CFG_OSTYPE"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
CFG_SRC_DIR="$(cd $(dirname $0) && pwd)/"
|
||||
CFG_BUILD_DIR="$(pwd)/"
|
||||
CFG_SELF=${CFG_SRC_DIR}$(basename $0)
|
||||
|
@ -216,13 +239,15 @@ then
|
|||
echo ""
|
||||
else
|
||||
msg "recreating config.tmp"
|
||||
echo '' >config.tmp
|
||||
echo '' >${CFG_SRC_DIR}config.tmp
|
||||
|
||||
step_msg "processing $CFG_SELF args"
|
||||
fi
|
||||
|
||||
opt optimize 1 "build optimized rust code"
|
||||
opt optimize-cxx 1 "build optimized C++ code"
|
||||
opt manage-submodules 1 "let the build manage the git submodules"
|
||||
valopt prefix "/usr/local" "set installation prefix"
|
||||
opt fast-make 0 "use .gitmodules as timestamp for submodule deps"
|
||||
valopt local-rust-root "/usr/local" "set prefix for local rust binary"
|
||||
|
||||
if [ $HELP -eq 1 ]
|
||||
|
@ -250,7 +275,10 @@ then
|
|||
else
|
||||
LRV=`${CFG_LOCAL_RUST_ROOT}/bin/rustc --version`
|
||||
step_msg "using rustc at: ${CFG_LOCAL_RUST_ROOT} with version: " $LRV
|
||||
CFG_RUSTC = ${CFG_LOCAL_RUST_ROOT}/bin/rustc
|
||||
fi
|
||||
else
|
||||
probe CFG_RUSTC rustc
|
||||
fi
|
||||
|
||||
if [ ! -z "$CFG_ENABLE_CLANG" ]
|
||||
|
@ -316,28 +344,24 @@ step_msg "running submodule autoconf scripts"
|
|||
|
||||
(cd ${CFG_SRC_DIR}src/mozjs/js/src && "${CFG_AUTOCONF213}") || exit $?
|
||||
|
||||
CFG_SUBMODULES="rust-harfbuzz rust-opengles rust-azure rust-stb-image rust-geom rust-glut rust-layers rust-http-client libparserutils libhubbub servo-sandbox rust-hubbub sharegl rust-mozjs mozjs"
|
||||
|
||||
if [ $CFG_OSTYPE == "darwin" ]
|
||||
then
|
||||
CFG_SUBMODULES="rust-cocoa rust-io-surface rust-core-foundation ${CFG_SUBMODULES}"
|
||||
fi
|
||||
|
||||
# needed because Spidermonkey configure is in non-standard location
|
||||
CFG_CONFIGURE_PATHS="${CFG_SUBMODULES} mozjs/js/src/"
|
||||
|
||||
step_msg "making build directories"
|
||||
|
||||
cd "${CFG_BUILD_DIR}"
|
||||
|
||||
make_dir src/mozjs
|
||||
make_dir src/rust-harfbuzz
|
||||
make_dir src/rust-opengles
|
||||
make_dir src/rust-mozjs
|
||||
make_dir src/rust-azure
|
||||
make_dir src/rust-cocoa
|
||||
make_dir src/rust-stb-image
|
||||
make_dir src/rust-geom
|
||||
make_dir src/rust-glut
|
||||
make_dir src/rust-layers
|
||||
make_dir src/rust-http-client
|
||||
make_dir src/libparserutils
|
||||
make_dir src/libhubbub
|
||||
make_dir src/servo-sandbox
|
||||
make_dir src/rust-hubbub
|
||||
make_dir src/rust-core-foundation
|
||||
make_dir src/rust-io-surface
|
||||
make_dir src/sharegl
|
||||
for i in ${CFG_SUBMODULES}
|
||||
do
|
||||
make_dir ${CFG_BUILD_DIR}src/${i}
|
||||
done
|
||||
|
||||
make_dir src/test/ref
|
||||
|
||||
|
@ -345,38 +369,34 @@ make_dir src/test/ref
|
|||
# see how Rust's configure script optionally reconfigures the LLVM module.
|
||||
step_msg "running submodule configure scripts"
|
||||
|
||||
(cd ${CFG_BUILD_DIR}src/mozjs && sh ${CFG_SRC_DIR}src/mozjs/js/src/configure) || exit $?
|
||||
(cd ${CFG_BUILD_DIR}src/rust-opengles && sh ${CFG_SRC_DIR}src/rust-opengles/configure) || exit $?
|
||||
(cd ${CFG_BUILD_DIR}src/rust-harfbuzz && sh ${CFG_SRC_DIR}src/rust-harfbuzz/configure) || exit $?
|
||||
(cd ${CFG_BUILD_DIR}src/rust-mozjs && sh ${CFG_SRC_DIR}src/rust-mozjs/configure) || exit $?
|
||||
(cd ${CFG_BUILD_DIR}src/rust-azure && sh ${CFG_SRC_DIR}src/rust-azure/configure) || exit $?
|
||||
(cd ${CFG_BUILD_DIR}src/rust-cocoa && sh ${CFG_SRC_DIR}src/rust-cocoa/configure) || exit $?
|
||||
(cd ${CFG_BUILD_DIR}src/rust-stb-image && sh ${CFG_SRC_DIR}src/rust-stb-image/configure) || exit $?
|
||||
(cd ${CFG_BUILD_DIR}src/rust-geom && sh ${CFG_SRC_DIR}src/rust-geom/configure) || exit $?
|
||||
(cd ${CFG_BUILD_DIR}src/rust-glut && sh ${CFG_SRC_DIR}src/rust-glut/configure) || exit $?
|
||||
(cd ${CFG_BUILD_DIR}src/rust-layers && sh ${CFG_SRC_DIR}src/rust-layers/configure) || exit $?
|
||||
(cd ${CFG_BUILD_DIR}src/rust-http-client && sh ${CFG_SRC_DIR}src/rust-http-client/configure) || exit $?
|
||||
(cd ${CFG_BUILD_DIR}src/libparserutils && sh ${CFG_SRC_DIR}src/libparserutils/configure) || exit $?
|
||||
(cd ${CFG_BUILD_DIR}src/libhubbub && sh ${CFG_SRC_DIR}src/libhubbub/configure) || exit $?
|
||||
(cd ${CFG_BUILD_DIR}src/servo-sandbox && sh ${CFG_SRC_DIR}src/servo-sandbox/configure) || exit $?
|
||||
(cd ${CFG_BUILD_DIR}src/rust-hubbub && sh ${CFG_SRC_DIR}src/rust-hubbub/configure) || exit $?
|
||||
(cd ${CFG_BUILD_DIR}src/rust-core-foundation && sh ${CFG_SRC_DIR}src/rust-core-foundation/configure) || exit $?
|
||||
(cd ${CFG_BUILD_DIR}src/rust-io-surface && sh ${CFG_SRC_DIR}src/rust-io-surface/configure) || exit $?
|
||||
(cd ${CFG_BUILD_DIR}src/sharegl && sh ${CFG_SRC_DIR}src/sharegl/configure) || exit $?
|
||||
for i in ${CFG_CONFIGURE_PATHS}
|
||||
do
|
||||
if [ -d ${CFG_BUILD_DIR}src/${i} ]
|
||||
then
|
||||
cd ${CFG_BUILD_DIR}src/${i}
|
||||
fi
|
||||
CONFIGURE_SCRIPT="${CFG_SRC_DIR}src/${i}/configure"
|
||||
if [ -f ${CONFIGURE_SCRIPT} ]
|
||||
then
|
||||
sh ${CONFIGURE_SCRIPT}
|
||||
fi
|
||||
done
|
||||
|
||||
step_msg "writing configuration"
|
||||
|
||||
putvar CFG_OSTYPE
|
||||
putvar CFG_SRC_DIR
|
||||
putvar CFG_BUILD_DIR
|
||||
putvar CFG_CONFIGURE_ARGS
|
||||
putvar CFG_PREFIX
|
||||
putvar CFG_C_COMPILER
|
||||
putvar CFG_SUBMODULES
|
||||
putvar CFG_DISABLE_MANAGE_SUBMODULES
|
||||
|
||||
msg
|
||||
sed "s#%VPATH%#${CFG_SRC_DIR}#" ${CFG_SRC_DIR}Makefile.in > Makefile
|
||||
move_if_changed config.tmp config.mk
|
||||
rm -f config.tmp
|
||||
touch config.stamp
|
||||
copy_if_changed ${CFG_SRC_DIR}Makefile.in ${CFG_BUILD_DIR}Makefile
|
||||
move_if_changed ${CFG_SRC_DIR}config.tmp ${CFG_SRC_DIR}config.mk
|
||||
copy_if_changed ${CFG_SRC_DIR}config.mk ${CFG_BUILD_DIR}config.mk
|
||||
rm -f ${CFG_SRC_DIR}config.tmp
|
||||
touch ${CFG_SRC_DIR}config.stamp
|
||||
|
||||
step_msg "complete"
|
||||
|
|
35
mk/check.mk
Normal file
35
mk/check.mk
Normal file
|
@ -0,0 +1,35 @@
|
|||
define DEF_SUBMODULE_TEST_RULES
|
||||
# check target
|
||||
check-$(1) : $$(DONE_$(1))
|
||||
@$$(call E, make check: $(1))
|
||||
|
||||
$$(Q) \
|
||||
$$(ENV_CFLAGS_$(1)) \
|
||||
$$(ENV_RFLAGS_$(1)) \
|
||||
$$(MAKE) -C $$(B)src/$(1) check
|
||||
|
||||
DEPS_CLEAN += clean-$(1)
|
||||
endef
|
||||
|
||||
$(foreach submodule,$(CFG_SUBMODULES),\
|
||||
$(eval $(call DEF_SUBMODULE_TEST_RULES,$(submodule))))
|
||||
|
||||
|
||||
# Testing targets
|
||||
|
||||
servo-test: $(DEPS_servo)
|
||||
$(CFG_RUSTC) $(RFLAGS_servo) --test -o $@ $<
|
||||
|
||||
reftest: src/reftest/reftest.rs servo
|
||||
$(CFG_RUSTC) $(RFLAGS_servo) -o $@ $< -L .
|
||||
|
||||
.PHONY: check $(DEPS_CHECK)
|
||||
|
||||
check: $(CHECK_DEPS) check-servo
|
||||
|
||||
check-servo: servo-test
|
||||
./servo-test $(TESTNAME)
|
||||
|
||||
check-ref: reftest
|
||||
./reftest --source-dir=$(VPATH)/src/test/ref --work-dir=src/test/ref $(TESTNAME)
|
||||
|
20
mk/clean.mk
Normal file
20
mk/clean.mk
Normal file
|
@ -0,0 +1,20 @@
|
|||
define DEF_SUBMODULE_CLEAN_RULES
|
||||
# clean target
|
||||
clean-$(1) :
|
||||
@$$(call E, make clean: $(1))
|
||||
$$(Q)rm -f $$(DONE_$(1))
|
||||
$$(Q)$$(MAKE) -C $$(B)src/$(1) clean
|
||||
|
||||
# add these targets to meta-targets
|
||||
DEPS_CLEAN += clean-$(1)
|
||||
endef
|
||||
|
||||
$(foreach submodule,$(CFG_SUBMODULES),\
|
||||
$(eval $(call DEF_SUBMODULE_CLEAN_RULES,$(submodule))))
|
||||
|
||||
.PHONY: clean $(DEPS_CLEAN)
|
||||
|
||||
clean: $(DEPS_CLEAN) clean-servo
|
||||
|
||||
clean-servo:
|
||||
rm -f servo servo-test
|
48
mk/sub.mk
Normal file
48
mk/sub.mk
Normal file
|
@ -0,0 +1,48 @@
|
|||
DEPS_rust-azure += \
|
||||
rust-geom
|
||||
|
||||
DEPS_rust-glut += \
|
||||
rust-opengles
|
||||
|
||||
DEPS_rust-layers += \
|
||||
rust-geom \
|
||||
rust-opengles \
|
||||
rust-glut \
|
||||
rust-azure
|
||||
|
||||
DEPS_sharegl += \
|
||||
rust-opengles \
|
||||
rust-geom
|
||||
|
||||
DEPS_servo-sandbox += \
|
||||
libhubbub \
|
||||
libparserutils
|
||||
|
||||
DEPS_rust-hubbub += \
|
||||
libhubbub
|
||||
|
||||
CFLAGS_mozjs += \
|
||||
"-I../mozjs/dist/include"
|
||||
|
||||
DEPS_rust-mozjs += \
|
||||
mozjs
|
||||
|
||||
CFLAGS_rust-mozjs += \
|
||||
"-I../mozjs/dist/include"
|
||||
|
||||
# Platform-specific dependencies
|
||||
ifeq ($(CFG_OSTYPE),darwin)
|
||||
DEPS_rust-azure += \
|
||||
rust-cocoa \
|
||||
rust-core-foundation
|
||||
|
||||
DEPS_rust-layers += \
|
||||
rust-cocoa
|
||||
|
||||
DEPS_rust-io-surface += \
|
||||
rust-core-foundation
|
||||
|
||||
DEPS_sharegl += \
|
||||
rust-core-foundation \
|
||||
rust-io-surface
|
||||
endif
|
|
@ -1 +1 @@
|
|||
Subproject commit fd581833ae18aafdba1594eb0af283f64c76931e
|
||||
Subproject commit 22a7aa74798117d9dcfb4640290b35b0950f063b
|
Loading…
Add table
Add a link
Reference in a new issue