-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
150 lines (116 loc) · 3.51 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
# I shamelessly stole this from https://github.com/SideStore/SideStore/
SHELL := /bin/bash
.PHONY: help ios update tvos
HOMEBREW := $(shell command -v brew 2>/dev/null)
default: help
# Add the following 'help' target to your Makefile
# And add help text after each target name starting with '\#\#'
# A category can be added with @category
# COLORS
GREEN := $(shell tput -Txterm setaf 2)
YELLOW := $(shell tput -Txterm setaf 3)
WHITE := $(shell tput -Txterm setaf 7)
RESET := $(shell tput -Txterm sgr0)
## ----- Helper functions ------
# Helper target for declaring an external executable as a recipe dependency.
# For example,
# `my_target: | _program_awk`
# will fail before running the target named `my_target` if the command `awk` is
# not found on the system path.
_program_%: FORCE
@_=$(or $(shell which $* 2> /dev/null),$(error `$*` command not found. Please install `$*` and try again))
# Helper target for declaring required environment variables.
#
# For example,
# `my_target`: | _var_PARAMETER`
#
# will fail before running `my_target` if the variable `PARAMETER` is not declared.
_var_%: FORCE
@_=$(or $($*),$(error `$*` is a required parameter))
_tag: | _var_VERSION
make --no-print-directory -B README.md
git commit -am "Tagging release $(VERSION)"
git tag -a $(VERSION) $(if $(NOTES),-m '$(NOTES)',-m $(VERSION))
.PHONY: _tag
_push: | _var_VERSION
git push origin $(VERSION)
git push origin master
.PHONY: _push
## ------ Commmands -----------
TARGET_MAX_CHAR_NUM=20
## Show help
help:
@echo ''
@echo 'Usage:'
@echo ' ${YELLOW}make${RESET} ${GREEN}<target>${RESET}'
@echo ''
@echo 'Targets:'
@awk '/^[a-zA-Z\-\_0-9]+:/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")-1); \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf " ${YELLOW}%-$(TARGET_MAX_CHAR_NUM)s${RESET} ${GREEN}%s${RESET}\n", helpCommand, helpMessage; \
} \
} \
{ lastLine = $$0 }' \
$(MAKEFILE_LIST)
## Install dependencies.
install_node_dependencies:
$(info Install node dependencies…)
npm ci
install_ionic:
$(info Install ionic…)
npm install -g @ionic/cli
setup: \
pre_setup \
install_node_dependencies \
install_ionic
# check_for_homebrew \
# update_homebrew \
pre_setup:
$(info Project setup…)
check_for_homebrew:
$(info Checking for Homebrew…)
ifeq ($(HOMEBREW),)
$(error Homebrew is not installed)
endif
update_homebrew:
$(info Updating Homebrew…)
brew update
install_swift_lint:
$(info Install swiftlint…)
brew unlink swiftlint || true
brew install swiftlint
brew link --overwrite swiftlint
pull:
$(info Pulling new commits…)
git stash push || true
git pull
git stash pop || true
## -- Building --
build_proj:
ionic capacitor sync
ionic capacitor build ios
pod_install:
cd ios/App/App && pod install
generate_assets:
npx --yes @capacitor/assets generate --ios --iconBackgroundColor '#eeeeee' --iconBackgroundColorDark '#222222' --splashBackgroundColor '#eeeeee' --splashBackgroundColorDark '#111111'
build:
@$(MAKE) build_proj
@$(MAKE) pod_install
@$(MAKE) generate_assets
@xcodebuild -workspace ios/App/App.xcworkspace \
-scheme App \
-sdk iphoneos \
archive -configuration release \
-archivePath ./archive \
CODE_SIGNING_REQUIRED=NO \
AD_HOC_CODE_SIGNING_ALLOWED=YES \
CODE_SIGNING_ALLOWED=NO \
ORG_IDENTIFIER=me.nabdev \
ipa:
mkdir Payload
mkdir Payload/GearGlimpse.app
cp -R archive.xcarchive/Products/Applications/App.app/ Payload/App.app/
zip -r GearGlimpse.ipa Payload