-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
70 lines (57 loc) · 1.68 KB
/
Makefile
File metadata and controls
70 lines (57 loc) · 1.68 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
SHELL := /bin/zsh
# Detect target triple for Tauri sidecar naming
UNAME_S := $(shell uname -s)
UNAME_M := $(shell uname -m)
ifeq ($(UNAME_S),Darwin)
ifeq ($(UNAME_M),arm64)
TARGET_TRIPLE := aarch64-apple-darwin
else
TARGET_TRIPLE := x86_64-apple-darwin
endif
else ifeq ($(UNAME_S),Linux)
ifeq ($(UNAME_M),aarch64)
TARGET_TRIPLE := aarch64-unknown-linux-gnu
else
TARGET_TRIPLE := x86_64-unknown-linux-gnu
endif
endif
SIDECAR_NAME := gnz-backend-$(TARGET_TRIPLE)
.PHONY: all dev build install clean backend ui tauri setup
all: build
# Install dependencies
setup:
cd ui && pnpm install
cd backend && go mod tidy
# Build Go backend and place as sidecar (only if sources changed)
backend:
@NEWEST_SRC=$$(find backend -name '*.go' -newer desktop/binaries/$(SIDECAR_NAME) 2>/dev/null | head -1); \
if [ ! -f desktop/binaries/$(SIDECAR_NAME) ] || [ -n "$$NEWEST_SRC" ]; then \
cd backend && go build -o ../desktop/binaries/$(SIDECAR_NAME) ./cmd/gnz-backend/; \
echo "Built sidecar: desktop/binaries/$(SIDECAR_NAME)"; \
else \
echo "Sidecar up to date, skipping Go build"; \
fi
# Build frontend
ui:
cd ui && pnpm build
# Build everything and package with Tauri
build: backend ui
pnpm tauri build
# Build and open DMG for installation
install: build
@open desktop/target/release/bundle/dmg/*.dmg
# Development mode
dev: backend
./scripts/dev.sh
# Clean build artifacts
clean:
rm -rf ui/dist
rm -rf desktop/binaries/gnz-backend-*
rm -rf desktop/target
cd backend && rm -f gnz-backend
# Just build and check the backend
backend-check:
cd backend && go vet ./...
cd backend && go build -o gnz-backend ./cmd/gnz-backend/
@echo "Backend OK"
cd backend && rm -f gnz-backend