-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
119 lines (106 loc) · 3.72 KB
/
Makefile
File metadata and controls
119 lines (106 loc) · 3.72 KB
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
# DevWatch — Development Makefile
UUID := devwatch@github.io
INSTALL := $(HOME)/.local/share/gnome-shell/extensions/$(UUID)
SRC := $(shell pwd)
# Re-link every source file in the project to the GNOME extensions directory.
# Run `make link` once after adding any new .js / .css / .json file.
.PHONY: link
link: compile-schemas
@mkdir -p $(INSTALL)
@for f in $(SRC)/*.js $(SRC)/*.css $(SRC)/*.json; do \
[ -f "$$f" ] || continue; \
ln -sf "$$f" "$(INSTALL)/$$(basename $$f)"; \
echo " Linked: $$(basename $$f)"; \
done
@for d in ui core utils schemas; do \
[ -d "$(SRC)/$$d" ] || continue; \
mkdir -p "$(INSTALL)/$$d"; \
for f in "$(SRC)/$$d"/*; do \
[ -f "$$f" ] || continue; \
ln -sf "$$f" "$(INSTALL)/$$d/$$(basename $$f)"; \
echo " Linked: $$d/$$(basename $$f)"; \
done; \
done
# Compile GSettings schemas (required whenever the .gschema.xml changes)
.PHONY: compile-schemas
compile-schemas:
@glib-compile-schemas $(SRC)/schemas/
@echo " Schemas compiled."
# Pack the extension into a distributable zip (compile schemas + MO files first)
# Output: devwatch@github.io.shell-extension.zip — ready for EGO upload.
.PHONY: pack
pack: compile-schemas compile-mo
gnome-extensions pack \
--force \
--extra-source=ui \
--extra-source=core \
--extra-source=utils \
--extra-source=schemas \
--extra-source=po \
.
@echo " Built: $(UUID).shell-extension.zip"
# Enable the extension (works only after a login where the shell picks it up)
.PHONY: enable
enable:
gnome-extensions enable $(UUID)
# Disable the extension
.PHONY: disable
disable:
gnome-extensions disable $(UUID)
# Tail the GNOME Shell log — your console.log() appears here
.PHONY: log
log:
journalctl -f -o cat /usr/bin/gnome-shell
# Show extension status
.PHONY: status
status:
gnome-extensions info $(UUID)
# Launch a nested Wayland GNOME Shell for safe testing.
# Must be run from a terminal INSIDE your graphical GNOME session
# (needs $WAYLAND_DISPLAY set — use gnome-terminal, not VS Code terminal).
.PHONY: nested
nested:
MUTTER_DEBUG_DUMMY_MODE_SPECS=1920x1080 \
dbus-run-session -- gnome-shell --devkit --wayland
# ── i18n helpers ──────────────────────────────────────────────────────────────
DOMAIN := devwatch@github.io
POT := po/$(DOMAIN).pot
# Extract translatable strings from all source files listed in po/POTFILES.
# Run after adding new _('...') calls to update the translation template.
.PHONY: pot
pot:
@xgettext \
--from-code=UTF-8 \
--language=JavaScript \
--keyword=_ \
--keyword=ngettext:1,2 \
--keyword=pgettext:1c,2 \
--output=$(POT) \
$(shell cat po/POTFILES | grep -v '^#' | grep -v '^$$')
@echo " Updated: $(POT)"
# Merge each existing .po file with the latest .pot template.
# Run after `make pot` to propagate new strings to translators.
.PHONY: update-po
update-po: pot
@for lang in $$(cat po/LINGUAS | grep -v '^#' | grep -v '^$$'); do \
pofile="po/$$lang.po"; \
if [ -f "$$pofile" ]; then \
msgmerge --update "$$pofile" $(POT); \
echo " Updated: $$pofile"; \
else \
msginit --input=$(POT) --locale=$$lang --output="$$pofile" --no-translator; \
echo " Created: $$pofile"; \
fi; \
done
# Compile all .po files listed in po/LINGUAS into binary .mo files,
# installed under locale/ so that initTranslations() can find them.
.PHONY: compile-mo
compile-mo:
@for lang in $$(cat po/LINGUAS | grep -v '^#' | grep -v '^$$'); do \
pofile="po/$$lang.po"; \
modir="locale/$$lang/LC_MESSAGES"; \
mofile="$$modir/$(DOMAIN).mo"; \
mkdir -p "$$modir"; \
msgfmt "$$pofile" -o "$$mofile"; \
echo " Compiled: $$mofile"; \
done