@@ -16,22 +16,19 @@ endif
16
16
17
17
# Valid values are: amd64, arm64.
18
18
TARGET_ARCH ?= $(NATIVE_ARCH )
19
-
20
- ifeq ($(NATIVE_ARCH ) ,$(TARGET_ARCH ) )
21
- ARCH_PREFIX :=
22
- else ifeq ($(TARGET_ARCH),arm64)
23
- ARCH_PREFIX := aarch64-linux-gnu-
19
+ ifeq ($(TARGET_ARCH ) ,arm64)
20
+ ARCH_PREFIX := aarch64
24
21
else ifeq ($(TARGET_ARCH),amd64)
25
- ARCH_PREFIX := x86_64-linux-gnu-
22
+ ARCH_PREFIX := x86_64
26
23
else
27
24
$(error Unsupported architecture : $(TARGET_ARCH ) )
28
25
endif
29
26
30
27
export TARGET_ARCH
31
28
export CGO_ENABLED = 1
32
29
export GOARCH = $(TARGET_ARCH )
33
- export CC = $(ARCH_PREFIX ) gcc
34
- export OBJCOPY = $(ARCH_PREFIX ) objcopy
30
+ export CC = $(ARCH_PREFIX ) -linux-gnu- gcc
31
+ export OBJCOPY = $(ARCH_PREFIX ) -linux-gnu- objcopy
35
32
36
33
BRANCH = $(shell git rev-parse --abbrev-ref HEAD | tr -d '-' | tr '[:upper:]' '[:lower:]')
37
34
COMMIT_SHORT_SHA = $(shell git rev-parse --short=8 HEAD)
@@ -78,18 +75,10 @@ ebpf-profiler: generate ebpf rust-components
78
75
go build $(GO_FLAGS ) -tags $(GO_TAGS )
79
76
80
77
rust-targets :
81
- ifeq ($(TARGET_ARCH ) ,arm64)
82
- rustup target add aarch64-unknown-linux-musl
83
- else ifeq ($(TARGET_ARCH),amd64)
84
- rustup target add x86_64-unknown-linux-musl
85
- endif
78
+ rustup target add $(ARCH_PREFIX ) -unknown-linux-musl
86
79
87
80
rust-components : rust-targets
88
- ifeq ($(TARGET_ARCH ) ,arm64)
89
- RUSTFLAGS="--remap-path-prefix $(PWD)=/" cargo build --lib --release --target aarch64-unknown-linux-musl
90
- else ifeq ($(TARGET_ARCH),amd64)
91
- RUSTFLAGS="--remap-path-prefix $(PWD)=/" cargo build --lib --release --target x86_64-unknown-linux-musl
92
- endif
81
+ RUSTFLAGS=" --remap-path-prefix $( PWD) =/" cargo build --lib --release --target $(ARCH_PREFIX ) -unknown-linux-musl
93
82
94
83
rust-tests : rust-targets
95
84
cargo test
0 commit comments