-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (53 loc) · 1.72 KB
/
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
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
PRODUCT_NAME = LocalizedGenStrings
VERSION = $(version)
PREFIX ?= /usr/local
CD = cd
CP = $(shell whereis cp) -Rf
GIT = $(shell which git)
HUB = $(shell which hub)
MKDIR = $(shell which mkdir) -p
RM = $(shell whereis rm) -rf
SED = /usr/bin/sed
SWIFT = $(shell which swift)
TAR = $(shell whereis tar) cJf
TARGET_PLATFORM = x86_64-apple-macosx
TARBALL = "LocalizedGetStrings-$(VERSION).mojave.tar.xz"
BINARY_DIRECTORY = $(PREFIX)/bin
BUILD_DIRECTORY = $(shell pwd)/.build/$(TARGET_PLATFORM)/release
OUTPUT_EXECUTABLE = $(BUILD_DIRECTORY)/$(PRODUCT_NAME)
INSTALL_EXECUTABLE_PATH = $(BINARY_DIRECTORY)/$(PRODUCT_NAME)
SWIFT_BUILD_FLAGS = --configuration release --disable-sandbox
.PHONY: all
all: build
.PHONY: test
test: clean
$(SWIFT) test
.PHONY: build
build:
$(SWIFT) build $(SWIFT_BUILD_FLAGS)
.PHONY: install
install: build
$(MKDIR) $(BINARY_DIRECTORY)
$(CP) "$(OUTPUT_EXECUTABLE)" "$(BINARY_DIRECTORY)"
.PHONY: package
package: build
$(CD) "$(BUILD_DIRECTORY)" && $(TAR) $(TARBALL) "$(PRODUCT_NAME)"
$(CP) "$(BUILD_DIRECTORY)/$(TARBALL)" $(TARBALL)
.PHONY: release
release: clean package
$(GIT) --git-dir=../homebrew-tap/.git pull origin master
$(SED) -i '' '4s/.*/ version "$(VERSION)"/' ../homebrew-tap/swiftbrew.rb
$(SED) -i '' '6s/.*/ sha256 "$(shell shasum -a 256 "$(TARBALL)" | cut -f 1 -d " ")"/' ../homebrew-tap/swiftbrew.rb
$(HUB) release create --message $(VERSION) --attach $(TARBALL) $(VERSION)
$(CD) ../homebrew-tap && \
$(GIT) commit swiftbrew.rb -m "Release version $(VERSION)"
$(GIT) --git-dir=../homebrew-tap/.git push origin master
.PHONY: xcode
xcode:
$(SWIFT) package generate-xcodeproj
.PHONY: uninstall
uninstall:
$(RM) "$(BINARY_DIRECTORY)/$(PRODUCT_NAME)"
.PHONY: clean
clean:
$(SWIFT) package clean