-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
34 lines (28 loc) · 986 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# This Makefile is expected to be run inside nix-shell.
TARGET ?= x86_64-unknown-linux-musl
CARGO_FLAGS := --release --target $(TARGET)
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
mkfile_dir := $(dir $(mkfile_path))
ifeq ($(TARGET),x86_64-pc-windows-gnu)
SRC_BIN := $(mkfile_dir)/target/$(TARGET)/release/hello-random.exe
DEST_BIN := $(mkfile_dir)/out/hello-random-$(TARGET).exe
OPENSSL_STATIC_FLAG := OPENSSL_STATIC=0
else
SRC_BIN := $(mkfile_dir)/target/$(TARGET)/release/hello-random
DEST_BIN := $(mkfile_dir)/out/hello-random-$(TARGET)
OPENSSL_STATIC_FLAG := OPENSSL_STATIC=1
endif
.PHONY: all
all: Cargo.toml Cargo.lock src/main.rs
$(OPENSSL_STATIC_FLAG) cargo build -vv --locked $(CARGO_FLAGS)
cp $(SRC_BIN) $(DEST_BIN)
.PHONY: run
run: all
cargo run $(CARGO_FLAGS)
# This target calls other targets to build reproducible artifacts
.PHONY: r10e-build
r10e-build: Dockerfile run.sh
$(mkfile_dir)/run.sh
.PHONY: clean
clean:
rm -rf $(mkfile_dir)/out