-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.core
281 lines (223 loc) · 8.02 KB
/
Makefile.core
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
# Makefile.core
# Created: Tue, Jul 16, 2024 at 11:43:13 AM
# Purpose:
# Contains the core libraries.
ifeq ($(USE_SUDO),true)
SUDO := sudo
else
SUDO :=
endif
# The stub prefix is intentional to avoid the warning for Makefile, which
# wants to avoid having a similar target.
STUB_LIBS := \
stubs/config \
stubs/list \
stubs/logger \
stubs/logger-factory \
stubs/plist-buddy \
stubs/string \
stubs/string-builder \
stubs/spot-test \
stubs/user
# config
# Needs to be ordered because the use script will compile dependent scripts.
# Transitive scripts need to be compiled first before it can be referenced by
# another library.
CORE_LIBS := \
logger-factory \
decorator \
simple-test \
unit-test \
list \
string \
regex \
regex-pattern \
map \
date-time \
plutil \
config \
emoji \
switch \
clipboard \
speech \
dialog \
file \
idler \
keyboard \
lov \
plist-buddy \
process \
retry \
string-builder \
stack \
system-events \
ui-util \
unicodes \
window \
logger \
property-list \
spot-test \
menu \
math \
speech-recognition-server
APPS_PATH=/Applications/AppleScript
_init:
ifeq ($(DEPLOY_TYPE), user)
mkdir -p ~/Library/Script\ Libraries/core
mkdir -p ~/Applications/AppleScript/Stay\ Open/
else
$(SUDO) mkdir -p /Library/Script\ Libraries/core
$(SUDO) mkdir -p /Applications/AppleScript/Stay\ Open/
endif
mkdir -p ~/applescript-core/sounds/
mkdir -p ~/applescript-core/logs/
cp -n config-default.template ~/applescript-core/config-default.plist || true
cp -n config-emoji.template ~/applescript-core/config-emoji.plist || true
cp -n plist.template ~/applescript-core/config-lib-factory.plist || true
cp -n plist.template ~/applescript-core/lov.plist || true
cp -n plist.template ~/applescript-core/config-system.plist || true
cp -n plist.template ~/applescript-core/session.plist || true
cp -n plist.template ~/applescript-core/switches.plist || true
cp -n plist.template ~/applescript-core/config-user.plist || true
cp -n plist.template ~/applescript-core/config-business.plist || true
cp -n notification-app-id-name.plist ~/applescript-core/notification-app-id-name.plist || true
cp -a assets/sounds/. ~/applescript-core/sounds/
# ./scripts/build-bundle.sh 'core/Text Utilities'
plutil -replace 'Project applescript-core' -string "`pwd`" ~/applescript-core/config-system.plist
clean:
find . -name '*.scpt' ! -name "main.scpt" -delete
install: _init build
ifeq ($(DEPLOY_TYPE), user)
mkdir -p ~/Library/'Script Libraries'/core/test
mkdir -p ~/Library/'Script Libraries'/core/app
else
$(SUDO) mkdir -p /Library/'Script Libraries'/core/test
$(SUDO) mkdir -p /Library/'Script Libraries'/core/app
endif
touch ~/applescript-core/logs/applescript-core.log
# osascript scripts/setup-applescript-core-project-path.applescript
./scripts/setup-switches.sh
@echo "Installation done"
$(STUB_LIBS): Makefile
# osacompile -o "$(HOME)/Library/Script Libraries/core/$(patsubst stubs/%,%,$@).scpt" "scripts/stub.applescript"
$(SUDO) osacompile -o "$(SCRIPT_LIBRARY_PATH)/core/$(patsubst stubs/%,%,$@).scpt" "scripts/stub.applescript"
$(CORE_LIBS): Makefile
$(SUDO) ./scripts/build-lib.sh core/$@
build-standard:
ifeq ($(OS_NAME), sonoma)
$(SUDO) ./scripts/build-lib.sh macOS-version/14-sonoma/std
else ifeq ($(OS_NAME), ventura)
$(SUDO) ./scripts/build-lib.sh macOS-version/13-ventura/std
else ifeq ($(OS_NAME), monterey)
$(SUDO) ./scripts/build-lib.sh macOS-version/12-monterey/std
else
$(SUDO) ./scripts/build-lib.sh macOS-version/12-monterey/std
@echo "build-core unimplemented macOS version error"
endif
build-core-bundle:
$(SUDO) ./scripts/build-bundle.sh 'core/Text Utilities'
@echo "Core Bundle compiled."
# There are circular dependency issue that needs to be considered. You may need
# to re-order the build of the script depending on which script is needed first.
build: \
build-stub \
build-standard \
build-core-bundle \
build-core \
build-control-center \
build-user
build-extras: \
build-counter \
build-redis \
build-terminal
build-all: \
build \
build-extras \
build-macos-apps
install-all: build-all
build-stub: $(STUB_LIBS)
@echo "Stubs compiled. This target is meant to help compile other scripts. \
Make sure this is not the last target you run, otherwise the scripts that \
need the real library will fail."
build-core: $(CORE_LIBS)
@echo "Core libraries compiled."
build-lib:
$(SUDO) ./scripts/build-lib.sh $(SOURCE)
build-bundle:
$(SUDO) ./scripts/build-bundle.sh $(SOURCE)
reveal-scripts: # Reveal the deployed scripts.
open ~/Library/Script\ Libraries
build-apps: \
build-automator \
build-calendar \
build-console \
install-control-center \
build-dock \
build-finder \
build-notification-center \
build-preview \
install-safari \
build-system-settings \
build-terminal
# macOS Version-Specific Apps -------------------------------------------------
build-control-center:
$(SUDO) osacompile -o "$(SCRIPT_LIBRARY_PATH)/core/control-center.scpt" "scripts/stub.applescript"
ifeq ($(OS_NAME), sonoma)
# $(SUDO) osacompile -o "$(HOME)/Library/Script Libraries/core/control-center.scpt" "scripts/stub.applescript"
$(SUDO) ./scripts/build-lib.sh "macOS-version/14-sonoma/control-center_network"
$(SUDO) ./scripts/build-lib.sh "macOS-version/14-sonoma/control-center_sound"
$(SUDO) ./scripts/build-lib.sh "macOS-version/14-sonoma/control-center_focus"
$(SUDO) ./scripts/build-lib.sh "macOS-version/14-sonoma/control-center_bluetooth"
$(SUDO) ./scripts/build-lib.sh "macOS-version/14-sonoma/control-center_wifi"
$(SUDO) ./scripts/build-lib.sh "macOS-version/14-sonoma/control-center"
else ifeq ($(OS_NAME), ventura)
$(SUDO) ./scripts/build-lib.sh "macOS-version/13-ventura/control-center_network"
$(SUDO) ./scripts/build-lib.sh "macOS-version/13-ventura/control-center_sound"
$(SUDO) ./scripts/build-lib.sh "macOS-version/13-ventura/control-center_focus"
$(SUDO) ./scripts/build-lib.sh "macOS-version/13-ventura/control-center"
else ifeq ($(OS_NAME), monterey)
$(SUDO) ./scripts/build-lib.sh "macOS-version/12-monterey/control-center"
else
$(SUDO) ./scripts/build-lib.sh "macOS-version/12-monterey/control-center"
@echo "Unsupported macOS version for control-center"
endif
install-control-center: build-control-center
build-dock:
$(SUDO) ./scripts/build-lib.sh "macOS-version/14-sonoma/dock"
build-notification-center:
# $(SUDO) osacompile -o "$(SCRIPT_LIBRARY_PATH)/core/notification-center.scpt" "scripts/stub.applescript"
ifeq ($(OS_NAME), sequoia)
$(SUDO) ./scripts/build-lib.sh "macOS-version/15-sequoia/notification-center-helper"
$(SUDO) ./scripts/build-lib.sh "macOS-version/15-sequoia/notification-center"
else ifeq ($(OS_NAME), sonoma)
$(SUDO) ./scripts/build-lib.sh "macOS-version/14-sonoma/notification-center-helper"
$(SUDO) ./scripts/build-lib.sh "macOS-version/14-sonoma/notification-center"
else ifeq ($(OS_NAME), ventura)
$(SUDO) ./scripts/build-lib.sh "macOS-version/13-ventura/notification-center-helper"
$(SUDO) ./scripts/build-lib.sh "macOS-version/13-ventura/notification-center"
else ifeq ($(OS_NAME), monterey)
$(SUDO) ./scripts/build-lib.sh "macOS-version/12-monterey/notification-center-helper"
$(SUDO) ./scripts/build-lib.sh "macOS-version/12-monterey/notification-center"
else
$(SUDO) ./scripts/build-lib.sh "macOS-version/12-monterey/notification-center-helper"
$(SUDO) ./scripts/build-lib.sh "macOS-version/12-monterey/notification-center"
@echo "Unsupported macOS version for notification-center"
endif
build-user:
$(SUDO) ./scripts/build-lib.sh libs/user/user
# Directory containing the files
DECORATORS_PATH = ./core/decorators
# Get all the .txt files in the directory
DECORATORS = $(wildcard $(DECORATORS_PATH)/dec-*.applescript)
build-decorators:
@for file in $(DECORATORS); do \
no_ext=$${file%.applescript}; \
echo "Building $$file"; \
$(SUDO) ./scripts/build-lib.sh "$$no_ext"; \
done
@echo "Done building core decorators"
# Library Decorators
install-dvorak:
$(SUDO) ./scripts/build-lib.sh core/decorators/dec-keyboard-dvorak-cmd
$(SUDO) ./scripts/build-lib.sh core/keyboard
$(SUDO) ./scripts/factory-insert.sh KeyboardInstance core/dec-keyboard-dvorak-cmd