This repository has been archived by the owner on Sep 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
/
Makefile
80 lines (60 loc) · 1.87 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
VERSION = 42.0
EXTENSION = [email protected]
SRCDIR = $(EXTENSION)
BUILDDIR = build/
PACKAGE = shell-volume-mixer-$(VERSION).zip
FILES = LICENSE README.md
LOCALE_DIR = $(SRCDIR)/locale
LOCALES_SRC = $(foreach dir,$(LOCALE_DIR),$(wildcard $(dir)/*/*/*.po))
LOCALES = $(patsubst %.po,%.mo,$(LOCALES_SRC))
SOURCES = \
pautils/lib/*.py \
pautils/query.py \
lib/** \
*.js \
prefs.ui \
stylesheet.css \
$(LOCALES:$(SRCDIR)/%=%) \
$(GSCHEMA) $(SCHEMA_COMP)
I18N = \
*.js \
lib/**/*.js \
prefs.ui
SCHEMA_COMP = schemas/gschemas.compiled
GSCHEMA = schemas/org.gnome.shell.extensions.shell-volume-mixer.gschema.xml
SRCFILES = $(addprefix $(SRCDIR)/, $(SOURCES) $(GSCHEMA) $(GSCHEMA_COMP))
dist: clean build check package
build: install-deps i18n stylesheet.css
package: $(PACKAGE)
prepare:
mkdir -p $(BUILDDIR)
install-deps:
npm install
git submodule update --init
$(SRCDIR)/$(SCHEMA_COMP): $(SRCDIR)/$(GSCHEMA)
glib-compile-schemas --targetdir=$(SRCDIR)/schemas $(SRCDIR)/schemas
$(PACKAGE): metadata.json $(SRCFILES) $(FILES)
cd $(SRCDIR) && zip -r ../$(PACKAGE) $(SOURCES)
zip $(PACKAGE) $(FILES)
cd $(BUILDDIR) && zip ../$(PACKAGE) *
i18n: $(LOCALES_SRC)
@xgettext \
--keyword --keyword=__ \
--omit-header \
--default-domain=$(EXTENSION) \
--from-code=UTF-8 \
--output=$(LOCALE_DIR)/translations.pot \
$(wildcard $(addprefix $(SRCDIR)/, $(I18N)))
metadata.json: prepare
cat $(addprefix $(SRCDIR)/, metadata.json) | grep -v '"version":' > $(BUILDDIR)/metadata.json
stylesheet.css:
npm run build
# remove harmful content produced by gnome-shell-sass
sed -i '/\/\*\sGlobal\sValues\s\*\//,/\/\*\sGeneral\sTypography\s\*/d' $(SRCDIR)/stylesheet.css
check:
npm run eslint
clean:
@test ! -d "$(BUILDDIR)" || rm -rf $(BUILDDIR)
@test ! -f "$(SRCDIR)/$(SCHEMA_COMP)" || rm $(SRCDIR)/$(SCHEMA_COMP)
@test ! -f "$(PACKAGE)" || rm $(PACKAGE)
.PHONY: clean i18n