-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
32 lines (24 loc) · 795 Bytes
/
Makefile
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
TOOL_NAME = EXECUTABLE-NAME
VERSION = 0.1.0
PREFIX = /usr/local
INSTALL_PATH = $(PREFIX)/bin/$(TOOL_NAME)
BUILD_PATH = .build/release/$(TOOL_NAME)
CURRENT_PATH = $(PWD)
REPO = https://github.com/AUTHOR-HANDLE/$(TOOL_NAME)
RELEASE_TAR = $(REPO)/archive/$(VERSION).tar.gz
SHA = $(shell curl -L -s $(RELEASE_TAR) | shasum -a 256 | sed 's/ .*//')
.PHONY: build install uninstall format_code update_brew
build:
swift build --disable-sandbox -c release
install: build
mkdir -p $(PREFIX)/bin
cp -f $(BUILD_PATH) $(INSTALL_PATH)
uninstall:
rm -f $(INSTALL_PATH)
format_code:
swiftformat .
update_brew:
sed -i '' 's|\(url ".*/archive/\)\(.*\)\(.tar\)|\1$(VERSION)\3|' formula.rb
sed -i '' 's|\(sha256 "\)\(.*\)\("\)|\1$(SHA)\3|' formula.rb
git add .
git commit -m "Update to $(VERSION)"