-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (38 loc) · 1.56 KB
/
Copy pathMakefile
File metadata and controls
47 lines (38 loc) · 1.56 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
.PHONY: build build-helper install uninstall test clean release
BINARY := break-reminder
HELPER := break-screen
BUILD_DIR := bin
INSTALL_DIR := $(HOME)/.local/bin
VERSION := $(shell cat VERSION 2>/dev/null || echo "dev")
LDFLAGS := -ldflags "-s -w -X main.version=$(VERSION)"
build-helper:
@mkdir -p $(BUILD_DIR)
cd helpers && swift build -c release
cp helpers/.build/release/BreakScreenApp $(BUILD_DIR)/$(HELPER)
cp helpers/.build/release/DashboardApp $(BUILD_DIR)/break-dashboard
cp helpers/.build/release/MenuBarApp $(BUILD_DIR)/break-menubar
build: build-helper
go build $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY) ./cmd/break-reminder
install: build
@mkdir -p $(INSTALL_DIR)
cp $(BUILD_DIR)/$(BINARY) $(INSTALL_DIR)/
cp $(BUILD_DIR)/$(HELPER) $(INSTALL_DIR)/
cp $(BUILD_DIR)/break-dashboard $(INSTALL_DIR)/
cp $(BUILD_DIR)/break-menubar $(INSTALL_DIR)/
$(INSTALL_DIR)/$(BINARY) service install
@echo "Installed to $(INSTALL_DIR)/$(BINARY)"
uninstall:
$(INSTALL_DIR)/$(BINARY) service uninstall || true
rm -f $(INSTALL_DIR)/$(BINARY)
@echo "Uninstalled"
test:
go test ./...
cd helpers && swift test
release: build
@echo "Creating release archive $(VERSION)..."
cd $(BUILD_DIR) && tar czf $(BINARY)-$(VERSION)-darwin-arm64.tar.gz $(BINARY) $(HELPER) break-dashboard break-menubar
cd $(BUILD_DIR) && shasum -a 256 $(BINARY)-$(VERSION)-darwin-arm64.tar.gz > $(BINARY)-$(VERSION)-darwin-arm64.tar.gz.sha256
@echo "Archive: $(BUILD_DIR)/$(BINARY)-$(VERSION)-darwin-arm64.tar.gz"
@cat $(BUILD_DIR)/$(BINARY)-$(VERSION)-darwin-arm64.tar.gz.sha256
clean:
rm -rf $(BUILD_DIR)