Makefile: Fix rust agent build using "--release".

Based on @ericho's work on the bug

Depends-on: github.com/kata-containers/tests#2277

Fixes: #69

Signed-off-by: Yang Bo <bo@hyper.sh>
This commit is contained in:
Yang Bo 2020-02-03 18:30:07 +08:00
parent b5e741ba8b
commit a3e46a369f

View File

@ -23,11 +23,12 @@ COMMIT_MSG = $(if $(COMMIT),$(COMMIT),unknown)
# Exported to allow cargo to see it # Exported to allow cargo to see it
export VERSION_COMMIT := $(if $(COMMIT),$(VERSION)-$(COMMIT),$(VERSION)) export VERSION_COMMIT := $(if $(COMMIT),$(VERSION)-$(COMMIT),$(VERSION))
BUILD_TYPE = debug BUILD_TYPE = release
ARCH = $(shell uname -m) ARCH = $(shell uname -m)
LIBC = musl LIBC = musl
TRIPLE = $(ARCH)-unknown-linux-$(LIBC) TRIPLE = $(ARCH)-unknown-linux-$(LIBC)
RUSTFLAGS = -C linker=musl-gcc
TARGET_PATH = target/$(TRIPLE)/$(BUILD_TYPE)/$(TARGET) TARGET_PATH = target/$(TRIPLE)/$(BUILD_TYPE)/$(TARGET)
@ -52,7 +53,7 @@ default: $(TARGET) show-header
$(TARGET): $(TARGET_PATH) $(TARGET): $(TARGET_PATH)
$(TARGET_PATH): $(SOURCES) | show-summary $(TARGET_PATH): $(SOURCES) | show-summary
@cargo build --target $(TRIPLE) @RUSTFLAGS="$(RUSTFLAGS)" cargo build --target $(TRIPLE) --$(BUILD_TYPE)
show-header: show-header:
@printf "%s - version %s (commit %s)\n\n" "$(TARGET)" "$(VERSION)" "$(COMMIT_MSG)" @printf "%s - version %s (commit %s)\n\n" "$(TARGET)" "$(VERSION)" "$(COMMIT_MSG)"
@ -64,10 +65,10 @@ clean:
@cargo clean @cargo clean
check: check:
@cargo test --target $(TRIPLE) @RUSTFLAGS="$(RUSTFLAGS)" cargo test --target $(TRIPLE) --$(BUILD_TYPE)
run: run:
@cargo run --target $(TRIPLE) @RUSTFLAGS="$(RUSTFLAGS)" cargo run --target $(TRIPLE) --$(BUILD_TYPE)
show-summary: show-header show-summary: show-header
@printf "project:\n" @printf "project:\n"