forked from ikatson/rqbit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
116 lines (97 loc) · 3.54 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
all:
@PHONY: webui-deps
webui-deps:
cd desktop && npm install
cd crates/librqbit/webui && npm install
@PHONY: webui-dev
webui-dev: webui-deps
cd crates/librqbit/webui && \
npm run dev
@PHONY: webui-build
webui-build: webui-deps
cd crates/librqbit/webui && \
npm run build
@PHONY: devserver
devserver:
echo -n '' > /tmp/rqbit-log && cargo run --release -- \
--log-file /tmp/rqbit-log \
--log-file-rust-log=debug,librqbit=trace \
server start /tmp/scratch/
@PHONY: clean
clean:
rm -rf target
@PHONY: sign-debug
sign-debug:
codesign -f --entitlements resources/debugging.entitlements -s - target/debug/rqbit
@PHONY: sign-release
sign-release:
codesign -f --entitlements resources/debugging.entitlements -s - target/release/rqbit
@PHONY: build-release
build-release:
cargo build --release
@PHONY: install
install: build-release
$(MAKE) build-release
$(MAKE) sign-release
install target/release/rqbit "$(HOME)/bin/"
@PHONY: release-macos-universal
release-macos-universal:
cargo build --target aarch64-apple-darwin --profile release-github
cargo build --target x86_64-apple-darwin --profile release-github
lipo \
./target/aarch64-apple-darwin/release-github/rqbit \
./target/x86_64-apple-darwin/release-github/rqbit \
-create \
-output ./target/x86_64-apple-darwin/release-github/rqbit-osx-universal
@PHONY: release-windows
release-windows:
# prereqs:
# brew install mingw-w64
cargo build --target x86_64-pc-windows-gnu --profile release-github
@PHONY: release-linux-current-target
release-linux-current-target:
CC_$(TARGET_SNAKE_CASE)=$(CROSS_COMPILE_PREFIX)-gcc \
CXX_$(TARGET_SNAKE_CASE)=$(CROSS_COMPILE_PREFIX)-g++ \
AR_$(TARGET_SNAKE_CASE)=$(CROSS_COMPILE_PREFIX)-ar \
CARGO_TARGET_$(TARGET_SNAKE_UPPER_CASE)_LINKER=$(CROSS_COMPILE_PREFIX)-gcc \
cargo build --profile release-github --target=$(TARGET) --features=openssl-vendored
@PHONY: release-linux
release-linux: release-linux-x86_64 release-linux-aarch64 release-linux-armv6 release-linux-armv7
@PHONY: release-linux-x86_64
release-linux-x86_64:
TARGET=x86_64-unknown-linux-gnu \
TARGET_SNAKE_CASE=x86_64_unknown_linux_gnu \
TARGET_SNAKE_UPPER_CASE=X86_64_UNKNOWN_LINUX_GNU \
CROSS_COMPILE_PREFIX=x86_64-unknown-linux-gnu \
$(MAKE) release-linux-current-target
@PHONY: release-linux-aarch64
release-linux-aarch64:
TARGET=aarch64-unknown-linux-gnu \
TARGET_SNAKE_CASE=aarch64_unknown_linux_gnu \
TARGET_SNAKE_UPPER_CASE=AARCH64_UNKNOWN_LINUX_GNU \
CROSS_COMPILE_PREFIX=aarch64-unknown-linux-gnu \
$(MAKE) release-linux-current-target
@PHONY: release-linux-armv6
release-linux-armv6:
TARGET=arm-unknown-linux-gnueabihf \
TARGET_SNAKE_CASE=arm_unknown_linux_gnueabihf \
TARGET_SNAKE_UPPER_CASE=ARM_UNKNOWN_LINUX_GNUEABIHF \
CROSS_COMPILE_PREFIX=arm-linux-gnueabihf \
LDFLAGS=-latomic \
$(MAKE) release-linux-current-target
# armv7-unknown-linux-gnueabihf
@PHONY: release-linux-armv7
release-linux-armv7:
TARGET=armv7-unknown-linux-gnueabihf \
TARGET_SNAKE_CASE=armv7_unknown_linux_gnueabihf \
TARGET_SNAKE_UPPER_CASE=ARMV7_UNKNOWN_LINUX_GNUEABIHF \
CROSS_COMPILE_PREFIX=armv7-linux-gnueabihf \
$(MAKE) release-linux-current-target
@PHONY: release-all
release-all: release-windows release-linux release-macos-universal
rm -rf /tmp/rqbit-release
mkdir -p /tmp/rqbit-release
cp ./target/x86_64-pc-windows-gnu/release-github/rqbit.exe /tmp/rqbit-release
cp ./target/x86_64-apple-darwin/release-github/rqbit-osx-universal /tmp/rqbit-release
cp ./target/x86_64-unknown-linux-gnu/release-github/rqbit /tmp/rqbit-release/rqbit-linux-x86_64
echo "The release was built in /tmp/rqbit-release"