Skip to content

Commit

Permalink
fix RUSTFLAGS in makefile scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
aarkegz committed Dec 23, 2024
1 parent 53fb216 commit 1238464
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions scripts/make/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ else
endif

ifneq ($(filter $(MAKECMDGOALS),doc doc_check_missing),) # run `cargo doc`
RUSTFLAGS := $(RUSTFLAGS_WITHOUT_LINK_ARG)
$(if $(V), $(info RUSTDOCFLAGS: "$(RUSTDOCFLAGS)"))
export RUSTDOCFLAGS
else ifeq ($(filter $(MAKECMDGOALS),clippy unittest unittest_no_fail_fast),) # not run `cargo test` or `cargo clippy`
Expand All @@ -22,13 +23,16 @@ else ifeq ($(filter $(MAKECMDGOALS),clippy unittest unittest_no_fail_fast),) # n
$(info app features: "$(APP_FEAT)")
endif
ifeq ($(APP_TYPE), c)
RUSTFLAGS := $(RUSTFLAGS_WITHOUT_LINK_ARG)
$(if $(V), $(info CFLAGS: "$(CFLAGS)") $(info LDFLAGS: "$(LDFLAGS)"))
else
$(if $(V), $(info RUSTFLAGS: "$(RUSTFLAGS)"))
export RUSTFLAGS
RUSTFLAGS := $(RUSTFLAGS_WITH_LINK_ARG)
endif
endif

$(if $(V), $(info RUSTFLAGS: "$(RUSTFLAGS)"))
export RUSTFLAGS

_cargo_build:
@printf " $(GREEN_C)Building$(END_C) App: $(APP_NAME), Arch: $(ARCH), Platform: $(PLATFORM_NAME), App type: $(APP_TYPE)\n"
ifeq ($(APP_TYPE), rust)
Expand Down
3 changes: 2 additions & 1 deletion scripts/make/cargo.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ build_args := \
$(build_args-$(MODE)) \
$(verbose)

RUSTFLAGS := -C link-arg=-T$(LD_SCRIPT) -C link-arg=-no-pie -C link-arg=-znostart-stop-gc -A unsafe_op_in_unsafe_fn
RUSTFLAGS_WITHOUT_LINK_ARG := -A unsafe_op_in_unsafe_fn
RUSTFLAGS_WITH_LINK_ARG := $(RUSTFLAGS_WITHOUT_LINK_ARG) -C link-arg=-T$(LD_SCRIPT) -C link-arg=-no-pie -C link-arg=-znostart-stop-gc
RUSTDOCFLAGS := -Z unstable-options --enable-index-page -D rustdoc::broken_intra_doc_links

ifeq ($(MAKECMDGOALS), doc_check_missing)
Expand Down

0 comments on commit 1238464

Please sign in to comment.