Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tamer/Cargo.toml8
-rw-r--r--tamer/Makefile.am4
-rw-r--r--tamer/README.md23
-rw-r--r--tamer/configure.ac3
4 files changed, 36 insertions, 2 deletions
diff --git a/tamer/Cargo.toml b/tamer/Cargo.toml
index a8b246b..8a31d36 100644
--- a/tamer/Cargo.toml
+++ b/tamer/Cargo.toml
@@ -6,7 +6,13 @@ description="TAME on Rust"
license="GPLv3+"
edition = "2018"
-# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+[profile.dev]
+# Release-level optimizations. Spending the extra couple of moments
+# compile-time is well worth the huge savings we get at runtime. Note that
+# this is still every so slightly slower than a release build; see other
+# profile options for release at
+# <https://doc.rust-lang.org/cargo/reference/manifest.html>.
+opt-level = 3
[dependencies]
quick-xml = ">= 0.17.0"
diff --git a/tamer/Makefile.am b/tamer/Makefile.am
index 51fdcdd..2cc502c 100644
--- a/tamer/Makefile.am
+++ b/tamer/Makefile.am
@@ -20,8 +20,10 @@
.PHONY: all
+CARGO_BUILD_FLAGS=@CARGO_BUILD_FLAGS@
+
all:
- @CARGO@ build
+ @CARGO@ build $(CARGO_BUILD_FLAGS)
doc: html
html-am:
diff --git a/tamer/README.md b/tamer/README.md
index 686f2ff..6d44f02 100644
--- a/tamer/README.md
+++ b/tamer/README.md
@@ -24,3 +24,26 @@ To bootstrap from the source repository, run `./bootstrap`.
To configure the build for your system, run `./configure`. To build, run
`make`. To run tests, run `make check`.
+You may also invoke `cargo` directly, which `make` will do for you using
+options provided to `configure`.
+
+*Note that the default development build results in terrible runtime
+performance!* See [#Build Flags][] below for instructions on how to
+generate a release binary.
+
+
+### Build Flags
+The environment variable `CARGO_BUILD_FLAGS` can be used to provide
+additional arguments to `cargo build` when invoked via `make`. This can be
+provided optionally during `configure` and can be overridden when invoking
+`make`. For example:
+
+```sh
+# release build
+$ ./configure && make CARGO_BUILD_FLAGS=--release
+$ ./configure CARGO_BUILD_FLAGS=--release && make
+
+# dev build
+$ ./configure && make
+$ ./configure CARGO_BUILD_FLAGS=--release && make CARGO_BUILD_FLAGS=
+```
diff --git a/tamer/configure.ac b/tamer/configure.ac
index 0fc7bf4..9ed3526 100644
--- a/tamer/configure.ac
+++ b/tamer/configure.ac
@@ -52,6 +52,9 @@ AX_COMPARE_VERSION([$rustc_version], [ge], [$rustc_ver_req],
[AC_MSG_RESULT([yes ($rustc_version)])],
[AC_MSG_ERROR([no ($rustc_version)])])
+AC_ARG_VAR([CARGO_BUILD_FLAGS],
+ [Flags to be passed to `cargo build' when invoked via Make])
+
AC_CONFIG_FILES([Makefile])
AC_OUTPUT