-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
71 lines (61 loc) · 1.5 KB
/
Makefile
File metadata and controls
71 lines (61 loc) · 1.5 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
# Initialize environment variables
GOOS ?= $(shell go env GOOS)
ARCH ?= auto
BUILD_SCRIPTS_DIR = scripts
# Help message
.PHONY: help
help:
@echo "Usage: make [target]"
@echo ""
@echo "Targets:"
@echo " default Auto-detect platform (default)"
@echo " win Build Windows version"
@echo " linux Build Linux version"
@echo " mac Build universal macOS version"
@echo " mac-arm Build for Apple Silicon"
@echo " mac-intel Build for Intel chips"
@echo " help Show this help message"
# Default target
.PHONY: default
default: check-scripts
@$(MAKE) $(GOOS)
# Platform-specific targets
.PHONY: darwin
darwin: mac
.PHONY: linux
linux: check-scripts
@echo "Building for Linux..."
@$(BUILD_SCRIPTS_DIR)/build.sh
.PHONY: windows
windows: check-scripts
@echo "Building for Windows..."
@$(BUILD_SCRIPTS_DIR)/build-windows.sh
.PHONY: mac
mac: check-scripts
ifeq ($(ARCH),auto)
@if [ "$$(uname -m)" = "arm64" ]; then \
$(MAKE) mac-arm; \
else \
$(MAKE) mac-intel; \
fi
else
@$(BUILD_SCRIPTS_DIR)/build-macos.sh
endif
.PHONY: mac-arm
mac-arm: check-scripts
@echo "Building for macOS (Apple Silicon)..."
@$(BUILD_SCRIPTS_DIR)/build-macos-arm.sh
.PHONY: mac-intel
mac-intel: check-scripts
@echo "Building for macOS (Intel)..."
@$(BUILD_SCRIPTS_DIR)/build-macos-intel.sh
# Alias targets
.PHONY: win
win: windows
# Common checks
check-scripts:
@chmod +x $(BUILD_SCRIPTS_DIR)/*.sh
@if [ ! -d "$(BUILD_SCRIPTS_DIR)" ]; then \
echo "Error: Build scripts directory missing"; \
exit 1; \
fi