-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
80 lines (62 loc) · 2.35 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
### Copyright (c) 2022-2024 Zenin Easa Panthakkalakath ###
all:
make clean
make install
make lint
make build-mac-intel
make build-mac-m1
make build-windows
make build-linux
install:
npm install
clean:
rm -rf node_modules bundle.js package-lock.json out
lint:
npx eslint --config eslint.config.js
npx copyright-header --copyrightHolder "Zenin Easa Panthakkalakath"
lintfix:
npx eslint --config eslint.config.js --fix
npx copyright-header --fix --copyrightHolder "Zenin Easa Panthakkalakath" --forceModificationYear 2024
build-mac-intel:
$(call BUILD_MAC_DMG,darwin,x64)
build-mac-m1:
$(call BUILD_MAC_DMG,darwin,arm64)
build-windows:
npx electron-forge make --platform=win32 --arch=x64
build-linux:
npx electron-forge make --platform=linux --arch=x64
# To have the icon on the macOS APP-file and DMG-file
MAC_ICON_PATH := DesktopApp/images/joycast.icns
MAKE_PATH := out/make
define BUILD_MAC_DMG
$(eval VERSION := $(shell npm pkg get version --workspaces=false | tr -d \"))
$(eval MAC_APP_PATH := out/joycast-$(1)-$(2)/joycast.app)
$(eval MAC_APP_RENAMED_PATH := out/joycast-$(1)-$(2)/joycast-$(VERSION).app)
$(eval MAC_DMG_PATH := $(MAKE_PATH)/joycast-$(VERSION)-$(2).dmg)
$(eval APPDMG_JSON_PATH := appdmg.json)
$(eval ICNS_PATH := out/icon_mac.icns)
$(eval RSRC_PATH := out/icns.rsrc)
npx electron-forge package --platform=$(1) --arch=$(2)
cp $(MAC_ICON_PATH) $(MAC_APP_PATH)/Contents/Resources/electron.icns
cp -rf $(MAC_APP_PATH) $(MAC_APP_RENAMED_PATH)
rm -rf $(MAC_APP_PATH)
touch $(MAC_APP_RENAMED_PATH)
echo '{' > $(APPDMG_JSON_PATH)
echo '"title": "joycast",' >> $(APPDMG_JSON_PATH)
echo '"icon": "$(MAC_ICON_PATH)",' >> $(APPDMG_JSON_PATH)
echo '"background-color": "#2b2e2f",' >> $(APPDMG_JSON_PATH)
echo '"contents": [' >> $(APPDMG_JSON_PATH)
echo '{ "x": 448, "y": 344, "type": "link", "path": "/Applications" },' >> $(APPDMG_JSON_PATH)
echo '{ "x": 192, "y": 344, "type": "file", "path": "$(MAC_APP_RENAMED_PATH)" }' >> $(APPDMG_JSON_PATH)
echo ']' >> $(APPDMG_JSON_PATH)
echo '}' >> $(APPDMG_JSON_PATH)
mkdir -p $(MAKE_PATH)
rm -rf $(MAC_DMG_PATH)
npx appdmg $(APPDMG_JSON_PATH) $(MAC_DMG_PATH)
cp -rf $(MAC_ICON_PATH) $(ICNS_PATH)
sips -i $(ICNS_PATH)
DeRez -only icns $(ICNS_PATH) > $(RSRC_PATH)
Rez -append $(RSRC_PATH) -o $(MAC_DMG_PATH)
SetFile -a C $(MAC_DMG_PATH)
rm $(ICNS_PATH) $(RSRC_PATH) $(APPDMG_JSON_PATH)
endef