Upgraded to latest rust
This commit is contained in:
parent
359f197e52
commit
5bf12185a8
3 changed files with 122 additions and 114 deletions
224
Makefile
224
Makefile
|
|
@ -25,8 +25,8 @@
|
||||||
SHELL := /bin/bash
|
SHELL := /bin/bash
|
||||||
|
|
||||||
# The default make command.
|
# The default make command.
|
||||||
# Change this to 'make lib' if you are building a library.
|
# Change this to 'lib' if you are building a library.
|
||||||
DEFAULT = make exe
|
DEFAULT = exe
|
||||||
|
|
||||||
EXAMPLE_FILES = examples/*.rs
|
EXAMPLE_FILES = examples/*.rs
|
||||||
SOURCE_FILES = $(shell test -e src/ && find src -type f)
|
SOURCE_FILES = $(shell test -e src/ && find src -type f)
|
||||||
|
|
@ -56,12 +56,16 @@ RLIB = target/$(TARGET)/lib/$(RLIB_FILE)
|
||||||
DYLIB_FILE = $(shell (rustc --crate-type=dylib --crate-file-name "src/lib.rs" 2> /dev/null) || (echo "dummy.dylib"))
|
DYLIB_FILE = $(shell (rustc --crate-type=dylib --crate-file-name "src/lib.rs" 2> /dev/null) || (echo "dummy.dylib"))
|
||||||
DYLIB = target/$(TARGET)/lib/$(DYLIB_FILE)
|
DYLIB = target/$(TARGET)/lib/$(DYLIB_FILE)
|
||||||
|
|
||||||
all:
|
ifdef VERBOSE
|
||||||
$(DEFAULT)
|
Q :=
|
||||||
|
else
|
||||||
|
Q := @
|
||||||
|
endif
|
||||||
|
|
||||||
|
all: $(DEFAULT)
|
||||||
|
|
||||||
help:
|
help:
|
||||||
clear \
|
$(Q)echo "--- rust-empty (0.3 005)" \
|
||||||
&& echo "--- rust-empty (0.3 005)" \
|
|
||||||
&& echo "make run - Runs executable" \
|
&& echo "make run - Runs executable" \
|
||||||
&& echo "make exe - Builds main executable" \
|
&& echo "make exe - Builds main executable" \
|
||||||
&& echo "make lib - Both static and dynamic library" \
|
&& echo "make lib - Both static and dynamic library" \
|
||||||
|
|
@ -115,8 +119,7 @@ help:
|
||||||
test-external
|
test-external
|
||||||
|
|
||||||
nightly-install:
|
nightly-install:
|
||||||
clear \
|
$(Q)cd ~ \
|
||||||
&& cd ~ \
|
|
||||||
&& curl -s http://www.rust-lang.org/rustup.sh > rustup.sh \
|
&& curl -s http://www.rust-lang.org/rustup.sh > rustup.sh \
|
||||||
&& ( \
|
&& ( \
|
||||||
echo "Rust install-script stored as '~/rustup.sh'" ; \
|
echo "Rust install-script stored as '~/rustup.sh'" ; \
|
||||||
|
|
@ -129,8 +132,7 @@ nightly-install:
|
||||||
)
|
)
|
||||||
|
|
||||||
nightly-uninstall:
|
nightly-uninstall:
|
||||||
clear \
|
$(Q)cd ~ \
|
||||||
&& cd ~ \
|
|
||||||
&& curl -s http://www.rust-lang.org/rustup.sh > rustup.sh \
|
&& curl -s http://www.rust-lang.org/rustup.sh > rustup.sh \
|
||||||
&& ( \
|
&& ( \
|
||||||
echo "Rust install-script stored as '~/rustup.sh'" ; \
|
echo "Rust install-script stored as '~/rustup.sh'" ; \
|
||||||
|
|
@ -143,37 +145,32 @@ nightly-uninstall:
|
||||||
)
|
)
|
||||||
|
|
||||||
cargo-lite-exe: src/main.rs
|
cargo-lite-exe: src/main.rs
|
||||||
( \
|
$(Q)( \
|
||||||
test -e cargo-lite.conf \
|
test -e cargo-lite.conf \
|
||||||
&& clear \
|
|
||||||
&& echo "--- The file 'cargo-lite.conf' already exists" \
|
&& echo "--- The file 'cargo-lite.conf' already exists" \
|
||||||
) \
|
) \
|
||||||
|| \
|
|| \
|
||||||
( \
|
( \
|
||||||
echo -e "deps = [\n]\n\n[build]\ncrate_root = \"src/main.rs\"\nrustc_args = []\n" > cargo-lite.conf \
|
echo -e "deps = [\n]\n\n[build]\ncrate_root = \"src/main.rs\"\nrustc_args = []\n" > cargo-lite.conf \
|
||||||
&& clear \
|
|
||||||
&& echo "--- Created 'cargo-lite.conf' for executable" \
|
&& echo "--- Created 'cargo-lite.conf' for executable" \
|
||||||
&& cat cargo-lite.conf \
|
&& cat cargo-lite.conf \
|
||||||
)
|
)
|
||||||
|
|
||||||
cargo-lite-lib: src/lib.rs
|
cargo-lite-lib: src/lib.rs
|
||||||
( \
|
$(Q)( \
|
||||||
test -e cargo-lite.conf \
|
test -e cargo-lite.conf \
|
||||||
&& clear \
|
|
||||||
&& echo "--- The file 'cargo-lite.conf' already exists" \
|
&& echo "--- The file 'cargo-lite.conf' already exists" \
|
||||||
) \
|
) \
|
||||||
|| \
|
|| \
|
||||||
( \
|
( \
|
||||||
echo -e "deps = [\n]\n\n[build]\ncrate_root = \"src/lib.rs\"\ncrate_type = \"library\"\nrustc_args = []\n" > cargo-lite.conf \
|
echo -e "deps = [\n]\n\n[build]\ncrate_root = \"src/lib.rs\"\ncrate_type = \"library\"\nrustc_args = []\n" > cargo-lite.conf \
|
||||||
&& clear \
|
|
||||||
&& echo "--- Created 'cargo-lite.conf' for library" \
|
&& echo "--- Created 'cargo-lite.conf' for library" \
|
||||||
&& cat cargo-lite.conf \
|
&& cat cargo-lite.conf \
|
||||||
)
|
)
|
||||||
|
|
||||||
cargo-exe: src/main.rs
|
cargo-exe: src/main.rs
|
||||||
( \
|
$(Q)( \
|
||||||
test -e Cargo.toml \
|
test -e Cargo.toml \
|
||||||
&& clear \
|
|
||||||
&& echo "--- The file 'Cargo.toml' already exists" \
|
&& echo "--- The file 'Cargo.toml' already exists" \
|
||||||
) \
|
) \
|
||||||
|| \
|
|| \
|
||||||
|
|
@ -181,15 +178,13 @@ cargo-exe: src/main.rs
|
||||||
name=$${PWD##/*/} ; \
|
name=$${PWD##/*/} ; \
|
||||||
readme=$$((test -e README.md && echo -e "readme = \"README.md\"") || ("")) ; \
|
readme=$$((test -e README.md && echo -e "readme = \"README.md\"") || ("")) ; \
|
||||||
echo -e "[project]\n\nname = \"$$name\"\nversion = \"0.0\"\n$$readme\nauthors = [\"Your Name <your@email.com>\"]\ntags = []\n\n[[bin]]\n\nname = \"$$name\"\npath = \"bin/main.rs\"\n" > Cargo.toml \
|
echo -e "[project]\n\nname = \"$$name\"\nversion = \"0.0\"\n$$readme\nauthors = [\"Your Name <your@email.com>\"]\ntags = []\n\n[[bin]]\n\nname = \"$$name\"\npath = \"bin/main.rs\"\n" > Cargo.toml \
|
||||||
&& clear \
|
|
||||||
&& echo "--- Created 'Cargo.toml' for executable" \
|
&& echo "--- Created 'Cargo.toml' for executable" \
|
||||||
&& cat Cargo.toml \
|
&& cat Cargo.toml \
|
||||||
)
|
)
|
||||||
|
|
||||||
cargo-lib: src/main.rs
|
cargo-lib: src/main.rs
|
||||||
( \
|
$(Q)( \
|
||||||
test -e Cargo.toml \
|
test -e Cargo.toml \
|
||||||
&& clear \
|
|
||||||
&& echo "--- The file 'Cargo.toml' already exists" \
|
&& echo "--- The file 'Cargo.toml' already exists" \
|
||||||
) \
|
) \
|
||||||
|| \
|
|| \
|
||||||
|
|
@ -197,147 +192,121 @@ cargo-lib: src/main.rs
|
||||||
name=$${PWD##/*/} ; \
|
name=$${PWD##/*/} ; \
|
||||||
readme=$$((test -e README.md && echo -e "readme = \"README.md\"") || ("")) ; \
|
readme=$$((test -e README.md && echo -e "readme = \"README.md\"") || ("")) ; \
|
||||||
echo -e "[project]\n\nname = \"$$name\"\nversion = \"0.0\"\n$$readme\nauthors = [\"Your Name <your@email.com>\"]\ntags = []\n\n[[lib]]\n\nname = \"$$name\"\npath = \"bin/lib.rs\"\n" > Cargo.toml \
|
echo -e "[project]\n\nname = \"$$name\"\nversion = \"0.0\"\n$$readme\nauthors = [\"Your Name <your@email.com>\"]\ntags = []\n\n[[lib]]\n\nname = \"$$name\"\npath = \"bin/lib.rs\"\n" > Cargo.toml \
|
||||||
&& clear \
|
|
||||||
&& echo "--- Created 'Cargo.toml' for executable" \
|
&& echo "--- Created 'Cargo.toml' for executable" \
|
||||||
&& cat Cargo.toml \
|
&& cat Cargo.toml \
|
||||||
)
|
)
|
||||||
|
|
||||||
rust-ci-lib: src/lib.rs
|
rust-ci-lib: src/lib.rs
|
||||||
( \
|
$(Q)( \
|
||||||
test -e .travis.yml \
|
test -e .travis.yml \
|
||||||
&& clear \
|
|
||||||
&& echo "--- The file '.travis.yml' already exists" \
|
&& echo "--- The file '.travis.yml' already exists" \
|
||||||
) \
|
) \
|
||||||
|| \
|
|| \
|
||||||
( \
|
( \
|
||||||
echo -e "before_install:\n\t- yes | sudo add-apt-repository ppa:hansjorg/rust\n\t- sudo apt-get update\ninstall:\n\t- sudo apt-get install rust-nightly\nscript:\n\t- make lib\n" > .travis.yml \
|
echo -e "before_install:\n\t- yes | sudo add-apt-repository ppa:hansjorg/rust\n\t- sudo apt-get update\ninstall:\n\t- sudo apt-get install rust-nightly\nscript:\n\t- make lib\n" > .travis.yml \
|
||||||
&& clear \
|
|
||||||
&& echo "--- Created '.travis.yml' for library" \
|
&& echo "--- Created '.travis.yml' for library" \
|
||||||
&& cat .travis.yml \
|
&& cat .travis.yml \
|
||||||
)
|
)
|
||||||
|
|
||||||
rust-ci-exe: src/main.rs
|
rust-ci-exe: src/main.rs
|
||||||
( \
|
$(Q)( \
|
||||||
test -e .travis.yml \
|
test -e .travis.yml \
|
||||||
&& clear \
|
|
||||||
&& echo "--- The file '.travis.yml' already exists" \
|
&& echo "--- The file '.travis.yml' already exists" \
|
||||||
) \
|
) \
|
||||||
|| \
|
|| \
|
||||||
( \
|
( \
|
||||||
echo -e "before_install:\n\t- yes | sudo add-apt-repository ppa:hansjorg/rust\n\t- sudo apt-get update\ninstall:\n\t- sudo apt-get install rust-nightly\nscript:\n\t- make exe\n" > .travis.yml \
|
echo -e "before_install:\n\t- yes | sudo add-apt-repository ppa:hansjorg/rust\n\t- sudo apt-get update\ninstall:\n\t- sudo apt-get install rust-nightly\nscript:\n\t- make exe\n" > .travis.yml \
|
||||||
&& clear \
|
|
||||||
&& echo "--- Created '.travis.yml' for executable" \
|
&& echo "--- Created '.travis.yml' for executable" \
|
||||||
&& cat .travis.yml \
|
&& cat .travis.yml \
|
||||||
)
|
)
|
||||||
|
|
||||||
doc: $(SOURCE_FILES) | src/
|
doc: $(SOURCE_FILES) | src/
|
||||||
clear \
|
$(Q)$(RUSTDOC) src/lib.rs -L "target/$(TARGET)/lib" \
|
||||||
&& $(RUSTDOC) src/lib.rs -L "target/$(TARGET)/lib" \
|
|
||||||
&& clear \
|
|
||||||
&& echo "--- Built documentation"
|
&& echo "--- Built documentation"
|
||||||
|
|
||||||
run: exe
|
run: exe
|
||||||
clear \
|
$(Q)cd bin/ \
|
||||||
&& cd bin/ \
|
|
||||||
&& ./main
|
&& ./main
|
||||||
|
|
||||||
exe: bin/main | $(TARGET_LIB_DIR)
|
exe: bin/main | $(TARGET_LIB_DIR)
|
||||||
|
|
||||||
bin/main: $(SOURCE_FILES) | bin/ src/main.rs
|
bin/main: $(SOURCE_FILES) | bin/ src/main.rs
|
||||||
clear \
|
$(Q)$(COMPILER) --target "$(TARGET)" $(COMPILER_FLAGS) src/main.rs -o bin/main -L "target/$(TARGET)/lib" \
|
||||||
&& $(COMPILER) --target "$(TARGET)" $(COMPILER_FLAGS) src/main.rs -o bin/main -L "target/$(TARGET)/lib" \
|
|
||||||
&& echo "--- Built executable" \
|
&& echo "--- Built executable" \
|
||||||
&& echo "--- Type 'make run' to run executable"
|
&& echo "--- Type 'make run' to run executable"
|
||||||
|
|
||||||
test: test-internal test-external
|
test: test-internal test-external
|
||||||
clear \
|
$(Q)echo "--- Internal tests succeeded" \
|
||||||
&& echo "--- Internal tests succeeded" \
|
|
||||||
&& echo "--- External tests succeeded"
|
&& echo "--- External tests succeeded"
|
||||||
|
|
||||||
test-external: bin/test-external
|
test-external: bin/test-external
|
||||||
cd "bin/" \
|
$(Q)cd "bin/" \
|
||||||
&& ./test-external
|
&& ./test-external
|
||||||
|
|
||||||
bin/test-external: $(SOURCE_FILES) | rlib bin/ src/test.rs
|
bin/test-external: $(SOURCE_FILES) | rlib bin/ src/test.rs
|
||||||
clear \
|
$(Q)$(COMPILER) --target "$(TARGET)" $(COMPILER_FLAGS) --test src/test.rs -o bin/test-external -L "target/$(TARGET)/lib" \
|
||||||
&& $(COMPILER) --target "$(TARGET)" $(COMPILER_FLAGS) --test src/test.rs -o bin/test-external -L "target/$(TARGET)/lib" \
|
|
||||||
&& echo "--- Built external test runner"
|
&& echo "--- Built external test runner"
|
||||||
|
|
||||||
test-internal: bin/test-internal
|
test-internal: bin/test-internal
|
||||||
cd "bin/" \
|
$(Q)cd "bin/" \
|
||||||
&& ./test-internal
|
&& ./test-internal
|
||||||
|
|
||||||
bin/test-internal: $(SOURCE_FILES) | rlib src/ bin/
|
bin/test-internal: $(SOURCE_FILES) | rlib src/ bin/
|
||||||
clear \
|
$(Q)$(COMPILER) --target "$(TARGET)" $(COMPILER_FLAGS) --test src/lib.rs -o bin/test-internal -L "target/$(TARGET)/lib" \
|
||||||
&& $(COMPILER) --target "$(TARGET)" $(COMPILER_FLAGS) --test src/lib.rs -o bin/test-internal -L "target/$(TARGET)/lib" \
|
|
||||||
&& echo "--- Built internal test runner"
|
&& echo "--- Built internal test runner"
|
||||||
|
|
||||||
bench: bench-internal bench-external
|
bench: bench-internal bench-external
|
||||||
|
|
||||||
bench-external: test-external
|
bench-external: test-external
|
||||||
clear \
|
$(Q)bin/test-external --bench
|
||||||
&& bin/test-external --bench
|
|
||||||
|
|
||||||
bench-internal: test-internal
|
bench-internal: test-internal
|
||||||
clear \
|
$(Q)bin/test-internal --bench
|
||||||
&& bin/test-internal --bench
|
|
||||||
|
|
||||||
lib: rlib dylib
|
lib: rlib dylib
|
||||||
clear \
|
$(Q)echo "--- Type 'make test' to test library"
|
||||||
&& echo "--- Built rlib" \
|
|
||||||
&& echo "--- Built dylib" \
|
|
||||||
&& echo "--- Type 'make test' to test library"
|
|
||||||
|
|
||||||
rlib: $(RLIB)
|
rlib: $(RLIB)
|
||||||
|
|
||||||
$(RLIB): $(SOURCE_FILES) | src/lib.rs $(TARGET_LIB_DIR)
|
$(RLIB): $(SOURCE_FILES) | src/lib.rs $(TARGET_LIB_DIR)
|
||||||
clear \
|
$(Q)$(COMPILER) --target "$(TARGET)" $(COMPILER_FLAGS) --crate-type=rlib src/lib.rs -L "target/$(TARGET)/lib" --out-dir "target/$(TARGET)/lib/" \
|
||||||
&& $(COMPILER) --target "$(TARGET)" $(COMPILER_FLAGS) --crate-type=rlib src/lib.rs -L "target/$(TARGET)/lib" --out-dir "target/$(TARGET)/lib/" \
|
&& echo "--- Built rlib"
|
||||||
&& clear \
|
|
||||||
&& echo "--- Built rlib" \
|
|
||||||
&& echo "--- Type 'make test' to test library"
|
|
||||||
|
|
||||||
dylib: $(DYLIB)
|
dylib: $(DYLIB)
|
||||||
|
|
||||||
$(DYLIB): $(SOURCE_FILES) | src/lib.rs $(TARGET_LIB_DIR)
|
$(DYLIB): $(SOURCE_FILES) | src/lib.rs $(TARGET_LIB_DIR)
|
||||||
clear \
|
$(Q)$(COMPILER) --target "$(TARGET)" $(COMPILER_FLAGS) --crate-type=dylib src/lib.rs -L "target/$(TARGET)/lib" --out-dir "target/$(TARGET)/lib/" \
|
||||||
&& $(COMPILER) --target "$(TARGET)" $(COMPILER_FLAGS) --crate-type=dylib src/lib.rs -L "target/$(TARGET)/lib" --out-dir "target/$(TARGET)/lib/" \
|
&& echo "--- Built dylib"
|
||||||
&& clear \
|
|
||||||
&& echo "--- Built dylib" \
|
|
||||||
&& echo "--- Type 'make test' to test library"
|
|
||||||
|
|
||||||
bin:
|
bin:
|
||||||
mkdir -p bin
|
$(Q)mkdir -p bin
|
||||||
|
|
||||||
$(TARGET_LIB_DIR):
|
$(TARGET_LIB_DIR):
|
||||||
mkdir -p $(TARGET_LIB_DIR)
|
$(Q)mkdir -p $(TARGET_LIB_DIR)
|
||||||
|
|
||||||
src:
|
src:
|
||||||
mkdir -p src
|
$(Q)mkdir -p src
|
||||||
|
|
||||||
examples-dir:
|
examples-dir:
|
||||||
test -e examples \
|
$(Q)test -e examples \
|
||||||
|| \
|
|| \
|
||||||
( \
|
( \
|
||||||
mkdir examples \
|
mkdir examples \
|
||||||
&& echo -e "fn main() {\n\tprintln!(\"Hello!\");\n}\n" > examples/hello.rs \
|
&& echo -e "fn main() {\n\tprintln!(\"Hello!\");\n}\n" > examples/hello.rs \
|
||||||
&& clear \
|
|
||||||
&& echo "--- Created examples folder" \
|
&& echo "--- Created examples folder" \
|
||||||
)
|
)
|
||||||
|
|
||||||
rust-dir:
|
rust-dir:
|
||||||
mkdir -p .rust
|
$(Q)mkdir -p .rust
|
||||||
|
|
||||||
git-ignore:
|
git-ignore:
|
||||||
( \
|
$(Q)( \
|
||||||
test -e .gitignore \
|
test -e .gitignore \
|
||||||
&& clear \
|
|
||||||
&& echo "--- The file '.gitignore' already exists" \
|
&& echo "--- The file '.gitignore' already exists" \
|
||||||
) \
|
) \
|
||||||
|| \
|
|| \
|
||||||
( \
|
( \
|
||||||
echo -e ".DS_Store\n*~\n*#\n*.o\n*.so\n*.swp\n*.dylib\n*.dSYM\n*.dll\n*.rlib\n*.dummy\n*.exe\n*-test\n/bin/main\n/bin/test-internal\n/bin/test-external\n/doc/\n/target/\n/build/\n/.rust/\nrusti.sh\n" > .gitignore \
|
echo -e ".DS_Store\n*~\n*#\n*.o\n*.so\n*.swp\n*.dylib\n*.dSYM\n*.dll\n*.rlib\n*.dummy\n*.exe\n*-test\n/bin/main\n/bin/test-internal\n/bin/test-external\n/doc/\n/target/\n/build/\n/.rust/\nrusti.sh\n" > .gitignore \
|
||||||
&& clear \
|
|
||||||
&& echo "--- Created '.gitignore' for git" \
|
&& echo "--- Created '.gitignore' for git" \
|
||||||
&& cat .gitignore \
|
&& cat .gitignore \
|
||||||
)
|
)
|
||||||
|
|
@ -345,88 +314,130 @@ git-ignore:
|
||||||
examples: $(EXAMPLE_FILES)
|
examples: $(EXAMPLE_FILES)
|
||||||
|
|
||||||
$(EXAMPLE_FILES): lib examples-dir
|
$(EXAMPLE_FILES): lib examples-dir
|
||||||
$(COMPILER) --target "$(TARGET)" $(COMPILER_FLAGS) $@ -L "target/$(TARGET)/lib" --out-dir examples/ \
|
$(Q)$(COMPILER) --target "$(TARGET)" $(COMPILER_FLAGS) $@ -L "target/$(TARGET)/lib" --out-dir examples/ \
|
||||||
&& clear \
|
|
||||||
&& echo "--- Built examples"
|
&& echo "--- Built examples"
|
||||||
|
|
||||||
src/main.rs: | src/
|
src/main.rs: | src/
|
||||||
test -e src/main.rs \
|
$(Q)test -e src/main.rs \
|
||||||
|| \
|
|| \
|
||||||
( \
|
( \
|
||||||
echo -e "fn main() {\n\tprintln!(\"Hello world!\");\n}" > src/main.rs \
|
echo -e "fn main() {\n\tprintln!(\"Hello world!\");\n}" > src/main.rs \
|
||||||
)
|
)
|
||||||
|
|
||||||
src/test.rs: | src/
|
src/test.rs: | src/
|
||||||
test -e src/test.rs \
|
$(Q)test -e src/test.rs \
|
||||||
|| \
|
|| \
|
||||||
( \
|
( \
|
||||||
touch src/test.rs \
|
touch src/test.rs \
|
||||||
)
|
)
|
||||||
|
|
||||||
src/lib.rs: | src/
|
src/lib.rs: | src/
|
||||||
test -e src/lib.rs \
|
$(Q)test -e src/lib.rs \
|
||||||
|| \
|
|| \
|
||||||
( \
|
( \
|
||||||
echo -e "#![crate_id = \"\"]\n#![deny(missing_doc)]\n\n//! Documentation goes here.\n" > src/lib.rs \
|
echo -e "#![crate_id = \"\"]\n#![deny(missing_doc)]\n\n//! Documentation goes here.\n" > src/lib.rs \
|
||||||
)
|
)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f "$(RLIB)"
|
$(Q)rm -f "$(RLIB)"
|
||||||
rm -f "$(DYLIB)"
|
$(Q)rm -f "$(DYLIB)"
|
||||||
rm -rf "doc/"
|
$(Q)rm -rf "doc/"
|
||||||
rm -f "bin/main"
|
$(Q)rm -f "bin/main"
|
||||||
rm -f "bin/test-internal"
|
$(Q)rm -f "bin/test-internal"
|
||||||
rm -f "bin/test-external"
|
$(Q)rm -f "bin/test-external"
|
||||||
clear \
|
$(Q)echo "--- Deleted binaries and documentation"
|
||||||
&& echo "--- Deleted binaries and documentation"
|
|
||||||
|
|
||||||
clear-project:
|
clear-project:
|
||||||
rm -f ".symlink-info"
|
$(Q)rm -f ".symlink-info"
|
||||||
rm -f "cargo-lite.conf"
|
$(Q)rm -f "cargo-lite.conf"
|
||||||
rm -f ".travis.yml"
|
$(Q)rm -f ".travis.yml"
|
||||||
rm -f "rusti.sh"
|
$(Q)rm -f "rusti.sh"
|
||||||
rm -rf "target/"
|
$(Q)rm -rf "target/"
|
||||||
rm -rf "src/"
|
$(Q)rm -rf "src/"
|
||||||
rm -rf "bin/"
|
$(Q)rm -rf "bin/"
|
||||||
rm -rf "examples/"
|
$(Q)rm -rf "examples/"
|
||||||
rm -rf "doc/"
|
$(Q)rm -rf "doc/"
|
||||||
clear \
|
$(Q)echo "--- Removed all source files, binaries and documentation" \
|
||||||
&& echo "--- Removed all source files, binaries and documentation" \
|
|
||||||
&& echo "--- Content in project folder" \
|
&& echo "--- Content in project folder" \
|
||||||
&& ls -a
|
&& ls -a
|
||||||
|
|
||||||
clear-git:
|
clear-git:
|
||||||
rm -f ".gitignore"
|
$(Q)rm -f ".gitignore"
|
||||||
rm -rf ".git"
|
$(Q)rm -rf ".git"
|
||||||
clear \
|
$(Q)echo "--- Removed Git" \
|
||||||
&& echo "--- Removed Git" \
|
|
||||||
&& echo "--- Content in project folder" \
|
&& echo "--- Content in project folder" \
|
||||||
&& ls -a
|
&& ls -a
|
||||||
|
|
||||||
|
# borrowed from http://stackoverflow.com/q/649246/1256624
|
||||||
|
define RUSTI_SCRIPT
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#written by mcpherrin
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
echo -n "> "
|
||||||
|
read line
|
||||||
|
TMP="`mktemp r.XXXXXX`"
|
||||||
|
$(COMPILER) - -o $$TMP -L "target/$(TARGET)/lib/" <<EOF
|
||||||
|
#![feature(globs, macro_rules, phase, struct_variant)]
|
||||||
|
extern crate arena;
|
||||||
|
extern crate collections;
|
||||||
|
extern crate flate;
|
||||||
|
#[phase(syntax)] extern crate fourcc;
|
||||||
|
extern crate glob;
|
||||||
|
extern crate green;
|
||||||
|
extern crate hexfloat;
|
||||||
|
extern crate libc;
|
||||||
|
#[phase(syntax, link)] extern crate log;
|
||||||
|
extern crate native;
|
||||||
|
extern crate num;
|
||||||
|
extern crate rand;
|
||||||
|
extern crate rustc;
|
||||||
|
extern crate rustdoc;
|
||||||
|
extern crate rustuv;
|
||||||
|
extern crate semver;
|
||||||
|
extern crate serialize;
|
||||||
|
extern crate sync;
|
||||||
|
extern crate syntax;
|
||||||
|
extern crate term;
|
||||||
|
extern crate test;
|
||||||
|
extern crate time;
|
||||||
|
extern crate url;
|
||||||
|
extern crate uuid;
|
||||||
|
extern crate workcache;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let r = { $$line };
|
||||||
|
println!("{:?}", r);
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
./$$TMP
|
||||||
|
rm $$TMP
|
||||||
|
done
|
||||||
|
endef
|
||||||
|
export RUSTI_SCRIPT
|
||||||
|
|
||||||
rusti: $(TARGET_LIB_DIR)
|
rusti: $(TARGET_LIB_DIR)
|
||||||
( \
|
$(Q)( \
|
||||||
test -e rusti.sh \
|
test -e rusti.sh \
|
||||||
&& clear \
|
|
||||||
&& echo "--- The file 'rusti.sh' already exists" \
|
&& echo "--- The file 'rusti.sh' already exists" \
|
||||||
) \
|
) \
|
||||||
|| \
|
|| \
|
||||||
( \
|
( \
|
||||||
echo -e "#!/bin/bash\n\n#written by mcpherrin\n\nwhile true; do\n echo -n \"> \"\n read line\n TMP=\"`mktemp r.XXXXXX`\"\n $(COMPILER) - -o \$$TMP -L "target/$(TARGET)/lib/" <<EOF\n #![feature(globs, macro_rules, phase, struct_variant)]\n extern crate arena;\n extern crate collections;\n extern crate flate;\n #[phase(syntax)] extern crate fourcc;\n extern crate glob;\n extern crate green;\n extern crate hexfloat;\n extern crate libc;\n #[phase(syntax, link)] extern crate log;\n extern crate native;\n extern crate num;\n extern crate rand;\n extern crate rustc;\n extern crate rustdoc;\n extern crate rustuv;\n extern crate semver;\n extern crate serialize;\n extern crate sync;\n extern crate syntax;\n extern crate term;\n extern crate test;\n extern crate time;\n extern crate url;\n extern crate uuid;\n extern crate workcache;\n\n fn main() {\n let r = { \$$line };\n println!(\"{:?}\", r);\n }\nEOF\n ./\$$TMP\n rm \$$TMP\ndone" > rusti.sh \
|
echo -e "$$RUSTI_SCRIPT" > rusti.sh \
|
||||||
&& chmod +x rusti.sh \
|
&& chmod +x rusti.sh \
|
||||||
&& clear \
|
|
||||||
&& echo "--- Created 'rusti.sh'" \
|
&& echo "--- Created 'rusti.sh'" \
|
||||||
&& echo "--- Type './rusti.sh' to start interactive Rust" \
|
&& echo "--- Type './rusti.sh' to start interactive Rust" \
|
||||||
)
|
)
|
||||||
|
|
||||||
loc:
|
loc:
|
||||||
clear \
|
$(Q)echo "--- Counting lines of .rs files in 'src' (LOC):" \
|
||||||
&& echo "--- Counting lines of .rs files in 'src' (LOC):" \
|
|
||||||
&& find src/ -type f -name "*.rs" -exec cat {} \; | wc -l
|
&& find src/ -type f -name "*.rs" -exec cat {} \; | wc -l
|
||||||
|
|
||||||
# Finds the original locations of symlinked libraries and
|
# Finds the original locations of symlinked libraries and
|
||||||
# prints the commit hash with remote branches containing that commit.
|
# prints the commit hash with remote branches containing that commit.
|
||||||
symlink-info:
|
symlink-info:
|
||||||
current=$$(pwd) ; \
|
$(Q) current=$$(pwd) ; \
|
||||||
for symlib in $$(find target/*/lib -type l) ; do \
|
for symlib in $$(find target/*/lib -type l) ; do \
|
||||||
cd $$current ; \
|
cd $$current ; \
|
||||||
echo $$symlib ; \
|
echo $$symlib ; \
|
||||||
|
|
@ -441,8 +452,5 @@ symlink-info:
|
||||||
done \
|
done \
|
||||||
> .symlink-info \
|
> .symlink-info \
|
||||||
&& cd $$current \
|
&& cd $$current \
|
||||||
&& clear \
|
|
||||||
&& echo "--- Created '.symlink-info'" \
|
&& echo "--- Created '.symlink-info'" \
|
||||||
&& cat .symlink-info
|
&& cat .symlink-info
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ impl<'a> Game for App<'a> {
|
||||||
self.number_renderer = Some(NumberRenderer::new(asset_store));
|
self.number_renderer = Some(NumberRenderer::new(asset_store));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&self, c: &Context, gl: &mut Gl) {
|
fn render(&self, _ext_dt: f64, c: &Context, gl: &mut Gl) {
|
||||||
self.board.render(self.number_renderer.get_ref(), c, gl);
|
self.board.render(self.number_renderer.get_ref(), c, gl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ use serialize::{
|
||||||
static SETTING_FILENAME: &'static str = "settings.json";
|
static SETTING_FILENAME: &'static str = "settings.json";
|
||||||
|
|
||||||
pub struct Settings {
|
pub struct Settings {
|
||||||
pub asset_folder: StrBuf,
|
pub asset_folder: String,
|
||||||
pub window_size: [u32, ..2],
|
pub window_size: [u32, ..2],
|
||||||
pub window_background_color: [f32, ..3],
|
pub window_background_color: [f32, ..3],
|
||||||
pub board_padding: f64,
|
pub board_padding: f64,
|
||||||
|
|
@ -125,7 +125,7 @@ impl Settings {
|
||||||
|
|
||||||
#[deriving(Encodable, Decodable)]
|
#[deriving(Encodable, Decodable)]
|
||||||
struct SettingsInJson {
|
struct SettingsInJson {
|
||||||
asset_folder: StrBuf,
|
asset_folder: String,
|
||||||
|
|
||||||
// r g b (0 - 255)
|
// r g b (0 - 255)
|
||||||
window_background_color: Vec<f32>,
|
window_background_color: Vec<f32>,
|
||||||
|
|
@ -220,12 +220,12 @@ impl SettingsInJson {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn save(&self) {
|
pub fn save(&self) {
|
||||||
let exe_path = self_exe_path().unwrap();
|
let exe_path = self_exe_path();
|
||||||
if exe_path.is_none() {
|
if exe_path.is_none() {
|
||||||
println!("WARNING: Failed to save settings: can't find exe path.");
|
println!("WARNING: Failed to save settings: can't find exe path.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let path = exe_path.join(Path::new(SETTING_FILENAME));
|
let path = exe_path.unwrap().join(Path::new(SETTING_FILENAME));
|
||||||
let file = File::create(&path).unwrap();
|
let file = File::create(&path).unwrap();
|
||||||
let mut writer = BufferedWriter::new(file);
|
let mut writer = BufferedWriter::new(file);
|
||||||
let mut encoder = json::Encoder::new(&mut writer);
|
let mut encoder = json::Encoder::new(&mut writer);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue