forked from samhh/bukubrow-webext
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
65 lines (55 loc) · 1.75 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
# The use of `${MAKE} target` is to allow the reuse of targets and also ensure
# explicit ordering
SHELL := /usr/bin/env bash
# Vars
TEMP_BUILD_DIR = .build
RELEASE_DIR = release
# Prepare build and release dirs
.PHONY: prepare
prepare:
mkdir -p $(TEMP_BUILD_DIR) $(RELEASE_DIR)
# Remove build dir
.PHONY: clean
clean:
rm -rf $(TEMP_BUILD_DIR)
# Remove build and release dirs
.PHONY: wipe
wipe:
${MAKE} clean
rm -rf $(RELEASE_DIR)
# Build WebExtension via Yarn and zip into release dir
.PHONY: webext
webext:
${MAKE} prepare
cd webextension && yarn && yarn build
cd webextension/dist && zip -r '../../$(RELEASE_DIR)/webext' ./*
${MAKE} clean
# Copy files over to build dir as expected by binary
.PHONY: prepare-binary
prepare-binary:
${MAKE} prepare
cp binary/browser-hosts/chrome.json $(TEMP_BUILD_DIR)/chrome-host.json
cp binary/browser-hosts/firefox.json $(TEMP_BUILD_DIR)/firefox-host.json
cp binary/install.sh $(TEMP_BUILD_DIR)/
# Build for Linux and zip into release dir
.PHONY: binary-linux-x64
binary-linux-x64:
${MAKE} prepare-binary
cd binary && cargo build --release --target=x86_64-unknown-linux-gnu
mv binary/target/x86_64-unknown-linux-gnu/release/bukubrow $(TEMP_BUILD_DIR)/bukubrow-linux-x64
cd $(TEMP_BUILD_DIR) && zip -r '../$(RELEASE_DIR)/binary-linux-x64' ./*
${MAKE} clean
# Build for macOS and zip into release dir
.PHONY: binary-darwin-x64
binary-darwin-x64:
${MAKE} prepare-binary
cd binary && cargo build --release --target=x86_64-apple-darwin
mv binary/target/x86_64-apple-darwin/release/bukubrow $(TEMP_BUILD_DIR)/bukubrow-darwin-x64
cd $(TEMP_BUILD_DIR) && zip -r '../$(RELEASE_DIR)/binary-darwin-x64' ./*
${MAKE} clean
# Full release
.PHONY: release
release:
${MAKE} webext
${MAKE} binary-linux-x64
${MAKE} binary-darwin-x64