-
Notifications
You must be signed in to change notification settings - Fork 275
/
Makefile
169 lines (131 loc) · 3.58 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#
# Makefile
# mas
#
################################################################################
#
# Variables
#
CMD_NAME = mas
SHELL = /bin/sh
PREFIX ?= $(shell brew --prefix)
SWIFT_VERSION = 5.7.1
# set EXECUTABLE_DIRECTORY according to your specific environment
# run swift build and see where the output executable is created
# OS specific differences
UNAME = ${shell uname}
ARCH = ${shell uname -m}
ifeq ($(UNAME), Darwin)
PLATFORM = $(ARCH)-apple-macosx
EXECUTABLE_DIRECTORY = ./.build/${PLATFORM}/debug
endif
################################################################################
#
# Help
#
.DEFAULT_GOAL := help
.PHONY: help
help: MAKEFILE_FMT = " \033[36m%-25s\033[0m%s\n"
help: ## (default) Displays this message
@echo "mas Makefile"
@echo ""
@echo "Targets:"
@grep -E '^[a-zA-Z0-9_-]*:.*?##' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?##"}; {printf $(MAKEFILE_FMT), $$1, $$2}'
: # Hacky way to display a newline ##
################################################################################
#
# ℹ️ Info Targets
#
.PHONY: version
version: ## Prints versions of tools used by this Makefile.
xcodebuild -version
swiftenv version
swift --version
swift package tools-version
.PHONY: init
init: ## Installs tools.
- swiftenv install $(SWIFT_VERSION)
swiftenv local $(SWIFT_VERSION)
################################################################################
#
# 👢 Bootstrap
#
.PHONY: bootstrap
bootstrap: ## Installs tools.
script/bootstrap -f
.PHONY: bootstrap-update
bootstrap-update: ## Upgrades and installs tools.
script/bootstrap
################################################################################
#
# 👩🏻💻 Development Targets
#
.PHONY: clean
clean: ## Cleans built products.
script/clean
.PHONY: lint
lint: ## Lints source code.
script/lint
.PHONY: format
format: ## Formats source code.
script/format
.PHONY: build
build: ## Builds the project.
script/build
.PHONY: test
test: build ## Runs tests.
script/test
# make run ARGS="asdf"
.PHONY: run
run: build
${EXECUTABLE_DIRECTORY}/${CMD_NAME} $(ARGS)
.PHONY: update-headers
update-headers: ## Updates private macOS headers.
script/update_headers
################################################################################
#
# 🕊️ Swift Package Targets
#
.PHONY: describe
describe: ## Describes the Swift package.
swift package describe
.PHONY: resolve
resolve: ## Resolves SwiftPM dependencies.
swift package resolve
.PHONY: dependencies
dependencies: resolve ## Lists SwiftPM dependencies.
swift package show-dependencies
.PHONY: update
update: resolve ## Updates SwiftPM dependencies.
swift package update
################################################################################
#
# 🚀 Release Targets
#
.PHONY: build-universal
build-universal: ## Builds a "fat" universal binary.
script/build --universal
.PHONY: install
install: build ## Installs the binary.
script/install $(PREFIX)
.PHONY: install-universal
install-universal: build-universal ## Installs a universal binary.
script/install --universal
.PHONY: uninstall
uninstall: ## Uninstalls the binary.
script/uninstall
.PHONY: package
package: build ## Packages the project.
script/package
.PHONY: package-install
package-install: package ## Installs the package.
script/package_install
.PHONY: bottle
bottle: ## Builds Homebrew bottles.
script/bottle
.PHONY: brew_formula_update
brew_formula_update: ## Updates homebrew-core formula.
script/brew_formula_update
.PHONY: brew_release_validate
brew_release_validate: ## Builds Homebrew bottle for the current system.
script/brew_release_validate