Skip to content

Commit c57d555

Browse files
committed
chore: support for different build targets
1 parent 07190cf commit c57d555

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1+
TARGET ?= aarch64-apple-darwin
2+
13
.PHONY: default test
24

35
default: release
46

57
build:
68
make -C ./src/file-explorer-ui dist
7-
make -C ./src/http-server build
9+
make -C ./src/http-server build TARGET=$(TARGET)
810

911
release:
1012
make -C ./src/file-explorer-ui release
11-
make -C ./src/http-server release
13+
make -C ./src/http-server release TARGET=$(TARGET)
1214

1315
run:
1416
make -C ./src/http-server run

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,21 @@ Build release binaries with:
2828
make release
2929
```
3030

31+
Optionally you can build for other targets by specifying the `TARGET` variable
32+
33+
```bash
34+
make release TARGET=<target-triple>
35+
```
36+
37+
For example:
38+
39+
```bash
40+
# Install aarch64-unknown-linux-gnu target
41+
rustup target install aarch64-unknown-linux-gnu
42+
# Build for aarch64-unknown-linux-gnu target
43+
make release TARGET=aarch64-unknown-linux-gnu
44+
```
45+
3146
Then use the following _alias_ for convenience
3247

3348
```bash

src/http-server/Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1+
TARGET ?= aarch64-apple-darwin
2+
13
.PHONY: default
24

35
default:
46
cargo r -- start
57

68
build:
7-
cargo b
9+
@echo "Building for target: $(TARGET)"
10+
cargo b --target $(TARGET)
811

912
release:
10-
cargo b --release
13+
@echo "Building with release mode for target: $(TARGET)"
14+
cargo b --release --target $(TARGET)
1115

1216
dist:
1317
make -C ../file-explorer-ui dist

0 commit comments

Comments
 (0)