-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
78 lines (65 loc) · 2.44 KB
/
Makefile
File metadata and controls
78 lines (65 loc) · 2.44 KB
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
.PHONY: web-build web-serve mac-build mac-dmg mac-run mac-install mac-xcode rust-build version-sync version-bump release clean
# Paths
VERSION_FILE := VERSION
BUILD_NUMBER_FILE := BUILD_NUMBER
MAC_APP_DIR := apps/mac
RUST_SRC := crates/swipe-engine
RUST_TARGET := aarch64-apple-darwin
RUST_LIB_NAME := libswipe_engine.a
# --- Web ---
web-build:
cd apps/web && wasm-pack build --target web
mkdir -p build
cp apps/web/pkg/swipe_web.js apps/web/pkg/swipe_web_bg.wasm build/
cp apps/web/www/index.html build/
web-serve: web-build
cd build && python3 -m http.server 8000
# --- Versioning ---
version-sync:
./scripts/sync_version.sh
version-bump:
@if [ -f $(BUILD_NUMBER_FILE) ]; then \
BUILD=$$(cat $(BUILD_NUMBER_FILE) | tr -d '[:space:]'); \
NEW_BUILD=$$(($$BUILD + 1)); \
echo $$NEW_BUILD > $(BUILD_NUMBER_FILE); \
echo "Bumped build number to $$NEW_BUILD"; \
else \
echo "1" > $(BUILD_NUMBER_FILE); \
echo "Created BUILD_NUMBER file with 1"; \
fi
# --- Rust ---
rust-build:
cd $(RUST_SRC) && cargo build --release --features ffi --target $(RUST_TARGET)
mkdir -p $(MAC_APP_DIR)/Rust
cp target/$(RUST_TARGET)/release/$(RUST_LIB_NAME) $(MAC_APP_DIR)/Rust/$(RUST_LIB_NAME)
# --- Mac ---
mac-xcode: version-sync
cd $(MAC_APP_DIR) && xcodegen generate
mac-build: version-bump mac-xcode rust-build
cd $(MAC_APP_DIR) && xcodebuild -project SwipeTypeMac.xcodeproj -scheme SwipeTypeMac -configuration Release -derivedDataPath BuildData build
mkdir -p $(MAC_APP_DIR)/build/Release
cp -R $(MAC_APP_DIR)/BuildData/Build/Products/Release/SwipeType.app $(MAC_APP_DIR)/build/Release/
mac-run:
./$(MAC_APP_DIR)/build/Release/SwipeType.app/Contents/MacOS/SwipeType
mac-install: mac-build
cp -r $(MAC_APP_DIR)/build/Release/SwipeType.app /Applications/
mac-dmg: mac-build
@echo "Packaging into DMG..."
mkdir -p $(MAC_APP_DIR)/build/dmg
rm -rf $(MAC_APP_DIR)/build/dmg/*
cp -R $(MAC_APP_DIR)/build/Release/SwipeType.app $(MAC_APP_DIR)/build/dmg/
ln -s /Applications $(MAC_APP_DIR)/build/dmg/Applications
hdiutil create -volname "SwipeType" -srcfolder $(MAC_APP_DIR)/build/dmg -ov -format UDZO $(MAC_APP_DIR)/build/SwipeType.dmg
@echo "Created $(MAC_APP_DIR)/build/SwipeType.dmg"
# --- Release ---
release:
@./scripts/release.sh
# --- Cleanup ---
clean:
rm -rf build
rm -rf $(MAC_APP_DIR)/build
rm -rf $(MAC_APP_DIR)/BuildData
rm -rf $(MAC_APP_DIR)/Rust/*.a
rm -rf $(MAC_APP_DIR)/SwipeTypeMac.xcodeproj
cd apps/web && rm -rf pkg target
cd $(RUST_SRC) && cargo clean