Introduce CARGO_BUILD_FLAGS

This is intended to permit passing `--release`, since dev builds are
terribly slow (e.g. 6s -> 0.2s).  See README.md for more information.
master
Mike Gerwitz 2019-11-27 09:17:27 -05:00
parent d96f090337
commit e53482f2a3
4 changed files with 36 additions and 2 deletions

View File

@ -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"

View File

@ -20,8 +20,10 @@
.PHONY: all
CARGO_BUILD_FLAGS=@CARGO_BUILD_FLAGS@
all:
@CARGO@ build
@CARGO@ build $(CARGO_BUILD_FLAGS)
doc: html
html-am:

View File

@ -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=
```

View File

@ -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