mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 20:24:31 +00:00
libs: refine Makefile rules
Refine Makefile rules to better support the KATA ci env. Fixes: #3536 Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
This commit is contained in:
parent
7cdee4980c
commit
6f8acb94c2
7
Makefile
7
Makefile
@ -6,6 +6,7 @@
|
||||
# List of available components
|
||||
COMPONENTS =
|
||||
|
||||
COMPONENTS += libs
|
||||
COMPONENTS += agent
|
||||
COMPONENTS += runtime
|
||||
|
||||
@ -21,11 +22,6 @@ STANDARD_TARGETS = build check clean install test vendor
|
||||
|
||||
default: all
|
||||
|
||||
all: libs-crate-tests build
|
||||
|
||||
libs-crate-tests:
|
||||
make -C src/libs
|
||||
|
||||
include utils.mk
|
||||
include ./tools/packaging/kata-deploy/local-build/Makefile
|
||||
|
||||
@ -49,7 +45,6 @@ docs-url-alive-check:
|
||||
binary-tarball \
|
||||
default \
|
||||
install-binary-tarball \
|
||||
libs-crate-tests \
|
||||
static-checks \
|
||||
docs-url-alive-check
|
||||
|
||||
|
@ -107,10 +107,7 @@ endef
|
||||
##TARGET default: build code
|
||||
default: $(TARGET) show-header
|
||||
|
||||
$(TARGET): $(GENERATED_CODE) libs-crate-tests $(TARGET_PATH)
|
||||
|
||||
libs-crate-tests:
|
||||
make -C $(CWD)/../libs
|
||||
$(TARGET): $(GENERATED_CODE) $(TARGET_PATH)
|
||||
|
||||
$(TARGET_PATH): show-summary
|
||||
@RUSTFLAGS="$(EXTRA_RUSTFLAGS) --deny warnings" cargo build --target $(TRIPLE) --$(BUILD_TYPE) $(EXTRA_RUSTFEATURES)
|
||||
@ -203,7 +200,6 @@ codecov-html: check_tarpaulin
|
||||
|
||||
.PHONY: \
|
||||
help \
|
||||
libs-crate-tests \
|
||||
optimize \
|
||||
show-header \
|
||||
show-summary \
|
||||
|
@ -3,16 +3,40 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
# It is not necessary to have a build target as this crate is built
|
||||
# automatically by the consumers of it.
|
||||
#
|
||||
# However, it is essential that the crate be tested.
|
||||
default: test
|
||||
EXTRA_RUSTFEATURES :=
|
||||
|
||||
EXTRA_TEST_FLAGS :=
|
||||
USERID=$(shell id -u)
|
||||
ifeq ($(USERID), 0)
|
||||
override EXTRA_TEST_FLAGS = --ignored
|
||||
endif
|
||||
|
||||
default: build
|
||||
|
||||
build:
|
||||
cargo build --all-features
|
||||
|
||||
check: clippy format
|
||||
|
||||
clippy:
|
||||
@echo "INFO: cargo clippy..."
|
||||
cargo clippy --all-targets --all-features --release \
|
||||
-- \
|
||||
-D warnings
|
||||
|
||||
format:
|
||||
@echo "INFO: cargo fmt..."
|
||||
cargo fmt -- --check
|
||||
|
||||
clean:
|
||||
cargo clean
|
||||
|
||||
# It is essential to run these tests using *both* build profiles.
|
||||
# See the `test_logger_levels()` test for further information.
|
||||
test:
|
||||
@echo "INFO: testing log levels for development build"
|
||||
@cargo test
|
||||
@echo "INFO: testing log levels for release build"
|
||||
@cargo test --release
|
||||
@echo "INFO: testing libraries for development build"
|
||||
cargo test --all $(EXTRA_RUSTFEATURES) -- --nocapture $(EXTRA_TEST_FLAGS)
|
||||
@echo "INFO: testing libraries for release build"
|
||||
cargo test --release --all $(EXTRA_RUSTFEATURES) -- --nocapture $(EXTRA_TEST_FLAGS)
|
||||
|
||||
.PHONY: install vendor
|
||||
|
@ -8,12 +8,9 @@ include ../../../utils.mk
|
||||
.DEFAULT_GOAL := default
|
||||
default: build
|
||||
|
||||
build: libs-crate-tests
|
||||
build:
|
||||
@RUSTFLAGS="$(EXTRA_RUSTFLAGS) --deny warnings" cargo build --target $(TRIPLE) --$(BUILD_TYPE)
|
||||
|
||||
libs-crate-tests:
|
||||
make -C $(CWD)/../../libs
|
||||
|
||||
clean:
|
||||
cargo clean
|
||||
|
||||
@ -32,6 +29,5 @@ check: standard_rust_check
|
||||
check \
|
||||
clean \
|
||||
install \
|
||||
libs-crate-tests \
|
||||
test \
|
||||
vendor
|
||||
|
@ -8,12 +8,9 @@ include ../../../utils.mk
|
||||
.DEFAULT_GOAL := default
|
||||
default: build
|
||||
|
||||
build: libs-crate-tests
|
||||
build:
|
||||
@RUSTFLAGS="$(EXTRA_RUSTFLAGS) --deny warnings" cargo build --target $(TRIPLE) --$(BUILD_TYPE)
|
||||
|
||||
libs-crate-tests:
|
||||
make -C $(CWD)/../../libs
|
||||
|
||||
clean:
|
||||
cargo clean
|
||||
|
||||
@ -32,6 +29,5 @@ check: standard_rust_check
|
||||
check \
|
||||
clean \
|
||||
install \
|
||||
libs-crate-tests \
|
||||
test \
|
||||
vendor
|
||||
|
Loading…
Reference in New Issue
Block a user