-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (52 loc) · 2.26 KB
/
Makefile
File metadata and controls
63 lines (52 loc) · 2.26 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
VERSION := 3.0.0
BINARY := tsc-bridge
DIST := dist
.PHONY: all build-mac build-windows build-windows-32 package-mac package-windows icons app dmg clean
all: build-mac icons app
# macOS: CGO required for systray
build-mac:
@mkdir -p $(DIST)
CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -o $(DIST)/$(BINARY)-mac .
@echo "Built $(DIST)/$(BINARY)-mac (macOS arm64)"
# Windows 64-bit: Intel + AMD x86-64 (brew install mingw-w64)
build-windows:
@mkdir -p $(DIST)
CGO_ENABLED=1 GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc \
go build -ldflags="-s -w -H windowsgui" -o $(DIST)/$(BINARY).exe .
@echo "Built $(DIST)/$(BINARY).exe (Windows amd64)"
# Windows 32-bit: Intel + AMD x86 legacy (brew install mingw-w64)
build-windows-32:
@mkdir -p $(DIST)
CGO_ENABLED=1 GOOS=windows GOARCH=386 CC=i686-w64-mingw32-gcc \
go build -ldflags="-s -w -H windowsgui" -o $(DIST)/$(BINARY)-32.exe .
@echo "Built $(DIST)/$(BINARY)-32.exe (Windows 386)"
# Generate all icon formats
icons: build-mac
@$(DIST)/$(BINARY)-mac --generate-icon $(DIST)/icon_1024.png
@$(DIST)/$(BINARY)-mac --generate-ico $(DIST)/$(BINARY).ico
@echo "Generated icons"
# Package macOS .app bundle
app: build-mac icons
@bash build.sh 2>/dev/null || true
# Create macOS DMG
dmg: app
@echo "DMG created by build.sh"
# Package macOS: binary + installer + LaunchAgent plist
package-mac: build-mac
@mkdir -p $(DIST)/tsc-bridge-mac-$(VERSION)
cp $(DIST)/$(BINARY)-mac $(DIST)/tsc-bridge-mac-$(VERSION)/$(BINARY)
cp install_mac.sh $(DIST)/tsc-bridge-mac-$(VERSION)/
cp com.tsc-bridge.plist $(DIST)/tsc-bridge-mac-$(VERSION)/
cd $(DIST) && zip -r tsc-bridge-mac-$(VERSION).zip tsc-bridge-mac-$(VERSION)/
@echo "Packaged $(DIST)/tsc-bridge-mac-$(VERSION).zip"
# Package Windows: binary + installer batch
package-windows: build-windows
@mkdir -p $(DIST)/tsc-bridge-win-$(VERSION)
cp $(DIST)/$(BINARY).exe $(DIST)/tsc-bridge-win-$(VERSION)/
cp $(DIST)/$(BINARY).ico $(DIST)/tsc-bridge-win-$(VERSION)/ 2>/dev/null || true
cp install_windows.bat $(DIST)/tsc-bridge-win-$(VERSION)/
cp tsc-bridge.iss $(DIST)/tsc-bridge-win-$(VERSION)/ 2>/dev/null || true
cd $(DIST) && zip -r tsc-bridge-win-$(VERSION).zip tsc-bridge-win-$(VERSION)/
@echo "Packaged $(DIST)/tsc-bridge-win-$(VERSION).zip"
clean:
rm -rf $(DIST)