-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
71 lines (62 loc) · 1.92 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
# Variables
PUBLISH_DIR := ./publish
CARGO_TARGET_DIR := ./target/release
TAURI_APP_DIR := ./app/search-files-app
TAURI_TARGET_DIR := $(TAURI_APP_DIR)/src-tauri/target/release
RUST_BINARY := file_elf
TAURI_BINARY := search-files-app
TAURI_DEB:= bundle/deb/search-files-app_*_amd64.deb
TAURI_IMG:= bundle/appimage/search-files-app_*_amd64.AppImage
TAURI_RPM:= bundle/rpm/search-files-app-*.x86_64.rpm
ZIP_FILE := release_package_linux.zip
# Default target: build everything
.PHONY: all
all: elf tauri
# Build the Rust project
.PHONY: elf
elf:
@echo "Building Rust file_elf project..."
cargo build --features webserver --release
# Build the Tauri app
.PHONY: tauri
tauri:
@echo "Building Tauri app..."
cd $(TAURI_APP_DIR) && cargo tauri build
# Ensure the publish directory exists
.PHONY: publish-dir
publish-dir:
@mkdir -p $(PUBLISH_DIR)
# publish the build artifacts to the publish directory
.PHONY: publish
publish: publish-dir
@echo "Copying files to the publish directory..."
cp $(CARGO_TARGET_DIR)/$(RUST_BINARY) $(PUBLISH_DIR)/
cp ./base.toml $(PUBLISH_DIR)/
cp $(TAURI_TARGET_DIR)/$(TAURI_BINARY) $(PUBLISH_DIR)/
cp $(TAURI_TARGET_DIR)/$(TAURI_DEB) $(PUBLISH_DIR)/
cp $(TAURI_TARGET_DIR)/$(TAURI_IMG) $(PUBLISH_DIR)/
cp $(TAURI_TARGET_DIR)/$(TAURI_RPM) $(PUBLISH_DIR)/
@echo "Packaging files into $(ZIP_FILE)..."
cd $(PUBLISH_DIR) && zip -r ../$(ZIP_FILE) .
# Clean the build artifacts
.PHONY: clean
clean:
@echo "Cleaning build artifacts..."
cargo clean
rm -rf $(PUBLISH_DIR)
rm -rf $(TAURI_APP_DIR)/build/
rm -rf $(TAURI_APP_DIR)/src-tauri/target/
# If you want to only clean the publish directory
.PHONY: clean-publish
clean-publish:
@echo "Cleaning the publish directory..."
rm -rf $(PUBLISH_DIR)
.PHONY: clean-tauri
clean-tauri:
@echo "Cleaning the tauri..."
rm -rf $(TAURI_APP_DIR)/build/
rm -rf $(TAURI_APP_DIR)/src-tauri/target/
.PHONY: clean-elf
clean-elf:
@echo "Cleaning the Rust file_elf project..."
cargo clean