|
1 | 1 | all: build |
2 | 2 |
|
3 | | -AKG := target/release/authrorized-keys-github |
| 3 | +NATIVE_EXE := target/release/authorized-keys-github |
4 | 4 |
|
5 | 5 | # When building the testing image, make the UID and GID match ours |
6 | 6 | UID := $(shell id -u) |
@@ -34,16 +34,35 @@ endef |
34 | 34 | # To speed up interactive development with cargo, cache the cargo home in a subdir of `target` |
35 | 35 | target/.docker_cargo_home: |
36 | 36 | mkdir -p $@ |
37 | | -$(AKG): target/.docker_cargo_home |
| 37 | +$(NATIVE_EXE): target/.docker_cargo_home |
38 | 38 | else |
39 | 39 | define docker_exec |
40 | 40 | $(2) |
41 | 41 | endef |
42 | 42 | endif |
43 | 43 |
|
44 | | -$(AKG): Cargo.toml Cargo.lock src/main.rs |
| 44 | +$(NATIVE_EXE): Cargo.toml Cargo.lock src/main.rs |
45 | 45 | $(call docker_exec,rust,cargo build --color=always --release) |
46 | | -build: $(AKG) |
| 46 | +build: $(NATIVE_EXE) |
| 47 | + |
| 48 | +# Use `cross` to build for other architectures |
| 49 | +target/%/release/authorized-keys-github: |
| 50 | +ifeq ($(shell which cross 2>/dev/null),) |
| 51 | + cargo install cross --git https://github.com/cross-rs/cross |
| 52 | +endif |
| 53 | + cross build --target $* --release |
| 54 | + |
| 55 | +# `ring` has some build problems, preventing us from building on: |
| 56 | +# - powerpc64le-unknown-linux-gnu |
| 57 | +# - arm-unknown-linux-gnueabihf |
| 58 | +TARGET_TRIPLETS := aarch64-unknown-linux-gnu \ |
| 59 | + aarch64-unknown-linux-musl \ |
| 60 | + armv7-unknown-linux-gnueabihf \ |
| 61 | + i686-unknown-linux-gnu \ |
| 62 | + i686-unknown-linux-musl \ |
| 63 | + x86_64-unknown-linux-gnu \ |
| 64 | + x86_64-unknown-linux-musl |
| 65 | +$(foreach triplet,$(TARGET_TRIPLETS),$(eval multibuild: target/$(triplet)/release/authorized-keys-github)) |
47 | 66 |
|
48 | 67 | check: |
49 | 68 | $(call docker_exec,rust,cargo fmt --color=always --all -- --check) |
|
0 commit comments