Skip to content

Commit 8c700b5

Browse files
authored
Simplify build (#444)
1 parent 49fdb40 commit 8c700b5

File tree

4 files changed

+8
-19
lines changed

4 files changed

+8
-19
lines changed

Makefile

+7-18
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,19 @@ endif
1616

1717
# Valid values are: amd64, arm64.
1818
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
2421
else ifeq ($(TARGET_ARCH),amd64)
25-
ARCH_PREFIX := x86_64-linux-gnu-
22+
ARCH_PREFIX := x86_64
2623
else
2724
$(error Unsupported architecture: $(TARGET_ARCH))
2825
endif
2926

3027
export TARGET_ARCH
3128
export CGO_ENABLED = 1
3229
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
3532

3633
BRANCH = $(shell git rev-parse --abbrev-ref HEAD | tr -d '-' | tr '[:upper:]' '[:lower:]')
3734
COMMIT_SHORT_SHA = $(shell git rev-parse --short=8 HEAD)
@@ -78,18 +75,10 @@ ebpf-profiler: generate ebpf rust-components
7875
go build $(GO_FLAGS) -tags $(GO_TAGS)
7976

8077
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
8679

8780
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
9382

9483
rust-tests: rust-targets
9584
cargo test

rust-crates/symblib-capi/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ rust-version.workspace = true
66
license.workspace = true
77

88
[lib]
9-
crate-type = ["staticlib", "cdylib"]
9+
crate-type = ["staticlib"]
1010

1111
[dependencies]
1212
symblib.path = "../symblib"
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)