Add Makefile and enable rust-ci doc export

This commit is contained in:
Brendan Zabarauskas 2014-02-14 07:18:10 +11:00
parent 07f01efbc5
commit 11f8e29e17
4 changed files with 116 additions and 11 deletions

8
.gitignore vendored
View file

@ -1,5 +1,5 @@
.DS_Store
.rust
bin
build
lib
/lib/
/bench/
/test/
/doc/

View file

@ -1,12 +1,33 @@
# Copyright 2014 The CGMath Developers. For a full listing of the authors,
# refer to the AUTHORS file at the top-level directory of this distribution.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
env:
global:
- secure: N41M4QTWbez7FRMh2HQqB3Z051FcruoRGLTdMdQJNMaZRqJiAfUBTO5NGXS5XGjIofknE4r/+WLv7KED2rTf6nvLFOHmGY2pL+agABcyD0DU0ltRLckjONWTxFN+SMTB0l38v3XIXxXX5y977Hl6wk3++kYZgCNVG3OTkJwWzQg=
before_install:
- yes | sudo add-apt-repository ppa:hansjorg/rust
- sudo apt-get update
install:
- sudo apt-get install rust-nightly
script:
- mkdir -p lib bin
- rustc --out-dir lib ./src/cgmath/lib.rs
- rustc --out-dir bin --test -L ./lib ./src/test/test.rs
- rustc --out-dir bin --test -L ./lib ./src/bench/bench.rs
- ./bin/test
# - ./bin/bench --bench
- make
# - make check # bench is too slow
- make test
- sudo make install
- sudo make uninstall
- make clean
- make doc
after_script:
- curl http://www.rust-ci.org/artifacts/put?t=$RUSTCI_TOKEN | sh

83
Makefile Normal file
View file

@ -0,0 +1,83 @@
# Copyright 2014 The CGMath Developers. For a full listing of the authors,
# refer to the AUTHORS file at the top-level directory of this distribution.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
RUSTC = rustc
RUSTDOC = rustdoc
SRC_DIR = src
LIB_FILE = $(SRC_DIR)/cgmath/lib.rs
TEST_FILE = $(SRC_DIR)/test/test.rs
BENCH_FILE = $(SRC_DIR)/bench/bench.rs
CRATE_NAME = $(shell $(RUSTC) --crate-name $(LIB_FILE))
CRATE_FILES = $(shell $(RUSTC) --crate-file-name $(LIB_FILE))
LIB_DIR = lib
TEST_DIR = test
BENCH_DIR = bench
DOC_DIR = doc
INSTALL_PREFIX = /usr/local
LIB_INSTALL_DIR = $(INSTALL_PREFIX)/lib
all: lib doc
lib:
mkdir -p $(LIB_DIR)
$(RUSTC) --out-dir=$(LIB_DIR) -O $(LIB_FILE)
test: lib
mkdir -p $(TEST_DIR)
$(RUSTC) -L $(LIB_DIR) --out-dir=$(TEST_DIR) --test $(TEST_FILE)
$(TEST_DIR)/test
bench: lib
mkdir -p $(BENCH_DIR)
$(RUSTC) -L $(LIB_DIR) --out-dir=$(BENCH_DIR) -O --test $(BENCH_FILE)
$(BENCH_DIR)/bench --bench
check: test bench
doc:
mkdir -p $(DOC_DIR)
$(RUSTDOC) -o $(DOC_DIR) $(LIB_FILE)
install: lib
@ $(foreach crate, $(CRATE_FILES), \
cp $(LIB_DIR)/$(crate) $(LIB_INSTALL_DIR)/$(crate) && \
echo "Installed $(crate) to $(LIB_INSTALL_DIR)" ; \
)
uninstall:
@-rm -f $(LIB_INSTALL_DIR)/lib$(CRATE_NAME)-*.rlib ||:
@-rm -f $(LIB_INSTALL_DIR)/lib$(CRATE_NAME)-*.so ||:
@-rm -f $(LIB_INSTALL_DIR)/lib$(CRATE_NAME)-*.dylib ||:
clean:
rm -rf $(LIB_DIR)
rm -rf $(TEST_DIR)
rm -rf $(BENCH_DIR)
rm -rf $(DOC_DIR)
.PHONY: \
all \
lib \
test \
bench \
check \
doc \
install \
uninstall \
clean

View file

@ -14,7 +14,8 @@
// limitations under the License.
#[crate_id="cgmath#0.1"];
#[crate_type = "lib"];
#[crate_type = "rlib"];
#[crate_type = "dylib"];
#[comment = "A mathematics library for computer graphics."];
#[license = "ASL2"];