-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
70 lines (59 loc) · 1.67 KB
/
makefile
File metadata and controls
70 lines (59 loc) · 1.67 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
DIST_DIR := dist
ENTRY_POINT := cmd/surisc/main.go
NSIS_SCRIPT := installer/installer.nsis
NSIS_OUTPUT := $(DIST_DIR)/surisc-setup.exe
NSIS_VERSION := 1.0.0
DEB_NAME := surisc
DEB_VERSION ?= 1.0.0
all: exe installer-nsis
# ----------------------------
# Windows binary
# ----------------------------
exe:
@echo "Building Windows executable..."
@mkdir -p $(DIST_DIR)
GOOS=windows GOARCH=amd64 go build -o $(DIST_DIR)/surisc.exe $(ENTRY_POINT)
# ----------------------------
# Linux binary (REQUIRED for .deb)
# ----------------------------
linux:
@echo "Building Linux binary..."
@mkdir -p $(DIST_DIR)
GOOS=linux GOARCH=amd64 go build -o $(DIST_DIR)/surisc $(ENTRY_POINT)
# ----------------------------
# NSIS Installer
# ----------------------------
installer-nsis: exe
@echo "Building NSIS installer..."
@makensis \
-DOUTPUT_FILE=$(NSIS_OUTPUT) \
-DPRODUCT_VERSION=$(VERSION) \
$(NSIS_SCRIPT)
# ----------------------------
# Debian package
# ----------------------------
deb: linux check-fpm
@echo "Building Debian (.deb) package..."
fpm -s dir -t deb \
-n $(DEB_NAME) \
-v $(DEB_VERSION) \
--description "Surisc CLI tool" \
$(DIST_DIR)/surisc=/usr/local/bin/surisc
# ----------------------------
# Test
# ----------------------------
test:
@echo "Running tests..."
go test ./...
# ----------------------------
# FPM check
# ----------------------------
check-fpm:
@which fpm > /dev/null || (echo "fpm is not installed. Install it with: gem install --no-document fpm" && exit 1)
# ----------------------------
# Clean
# ----------------------------
clean:
@echo "Cleaning build artifacts..."
rm -rf $(DIST_DIR)
.PHONY: all exe linux installer-nsis deb test clean