-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
87 lines (71 loc) · 2.53 KB
/
Makefile
File metadata and controls
87 lines (71 loc) · 2.53 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
79
80
81
82
83
84
85
.PHONY: build build-backend build-frontend install clean test run help
# Variables
BACKEND_DIR=backend
FRONTEND_DIR=frontend
BINARY_NAME=heymac
BUILD_DIR=build
help: ## Show this help message
@echo 'Usage: make [target]'
@echo ''
@echo 'Available targets:'
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-15s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
build: build-backend build-frontend ## Build both backend and frontend
@echo "Build completed!"
build-backend: ## Build backend only
@echo "Building backend..."
cd $(BACKEND_DIR) && go mod download
cd $(BACKEND_DIR) && go build -o $(BINARY_NAME) cmd/server/main.go
@echo "Backend built successfully!"
build-frontend: ## Build frontend only
@echo "Building frontend..."
cd $(FRONTEND_DIR) && npm install
cd $(FRONTEND_DIR) && npm run build
@echo "Frontend built successfully!"
install: build ## Install dependencies and build
@echo "Installing dependencies..."
cd $(BACKEND_DIR) && go mod download
cd $(FRONTEND_DIR) && npm install
@echo "Installation completed!"
clean: ## Clean build artifacts
@echo "Cleaning..."
rm -f $(BACKEND_DIR)/$(BINARY_NAME)
rm -rf $(FRONTEND_DIR)/dist
rm -rf $(BUILD_DIR)
@echo "Clean completed!"
test: ## Run tests
@echo "Running tests..."
cd $(BACKEND_DIR) && go test ./...
cd $(FRONTEND_DIR) && npm test
@echo "Tests completed!"
run: build-backend ## Run backend server
@echo "Starting server..."
cd $(BACKEND_DIR) && ./$(BINARY_NAME)
run-dev: ## Run in development mode
@echo "Starting in development mode..."
@echo "Backend: http://localhost:5656"
@echo "Frontend: http://localhost:5173"
@trap 'kill 0' EXIT; \
cd $(BACKEND_DIR) && go run cmd/server/main.go & \
cd $(FRONTEND_DIR) && npm run dev & \
wait
check-port: ## Check if port 5656 is available
@lsof -i :5656 || echo "Port 5656 is available"
setup-dirs: ## Create necessary directories
@echo "Creating directories..."
mkdir -p ~/Library/Logs/heymac
mkdir -p ~/Library/Application\ Support/heymac
@echo "Directories created!"
setup-config: ## Copy config example to config.yaml
@if [ ! -f config.yaml ]; then \
cp config.yaml.example config.yaml; \
echo "Created config.yaml from example. Please edit it!"; \
else \
echo "config.yaml already exists. Skipping..."; \
fi
deploy: build setup-dirs ## Build and prepare for deployment
@echo "Deployment preparation completed!"
@echo "Next steps:"
@echo "1. Edit config.yaml"
@echo "2. Setup sudo permissions (see README.md)"
@echo "3. Create LaunchDaemons (see README.md)"
@echo "4. Setup Cloudflare Tunnel (see README.md)"