-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
61 lines (49 loc) · 1.76 KB
/
Makefile
File metadata and controls
61 lines (49 loc) · 1.76 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
BINARY := slack-status
DESTDIR := /usr/local/bin
MACOS_PROJECT := macos/SlackStatusApp.xcodeproj
MACOS_SCHEME := SlackStatusApp
MACOS_CONFIGURATION ?= Debug
MACOS_DERIVED_DATA := macos/build
MACOS_APP := $(MACOS_DERIVED_DATA)/Build/Products/$(MACOS_CONFIGURATION)/$(MACOS_SCHEME).app
-include .env
export
OAUTH_URL := https://api.slack.com/apps/$(APP_ID)/oauth
LDFLAGS := -X 'main.oauthURL="$(OAUTH_URL)"'
.PHONY: help init env build install uninstall macos-build macos-open macos-run
help:
@echo ""
@echo "To initialize, run: make init"
@echo ""
@echo "Usage: make <target>"
@echo "Targets:"
@echo " init Initialize .env file"
@echo " build Build the binary"
@echo " macos-build Build the macOS menu bar app with xcodebuild"
@echo " macos-open Launch the built macOS menu bar app via open"
@echo " macos-run Build and run the macOS menu bar app directly"
@echo " install Install the binary to $(DESTDIR)"
@echo " uninstall Uninstall the binary from $(DESTDIR)"
@echo ""
init:
@cp .env.example .env
@echo ""
@echo "Please edit .env to set APP_ID"
@echo "Visit https://api.slack.com/apps and select \"status service\" app."
@echo "Copy the app id from the URL <https://api.slack.com/apps/APP_ID/> and paste it into .env"
@echo ""
env:
@echo "APP_ID=$(APP_ID)"
@echo "OAUTH_URL=$(OAUTH_URL)"
@echo "LDFLAGS=$(LDFLAGS)"
build:
go build -ldflags "$(LDFLAGS)" -o $(BINARY)
macos-build:
xcodebuild -project $(MACOS_PROJECT) -scheme $(MACOS_SCHEME) -configuration $(MACOS_CONFIGURATION) -derivedDataPath $(MACOS_DERIVED_DATA) build
macos-open: macos-build
open $(MACOS_APP)
macos-run: macos-build
$(MACOS_APP)/Contents/MacOS/$(MACOS_SCHEME)
install: build
sudo install -m 755 $(BINARY) $(DESTDIR)/$(BINARY)
uninstall:
sudo rm -f $(DESTDIR)/$(BINARY)