-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathMakefile
65 lines (55 loc) · 1.6 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
PKG_NAME = sp-tray
UUID = [email protected]
BASE_MODULES = metadata.json LICENSE.txt
SRC_MODULES = constants.js dbus.js extension.js panelButton.js
PREFS_MODULES = prefs.js settingsFields.js prefs.xml
INSTALLBASE = $(HOME)/.local/share/gnome-shell/extensions
DEST = $(INSTALLBASE)/$(UUID)
MSGSRC = $(wildcard locale/*/*/*.po)
ifdef VERSION
ZIPVER = -v$(VERSION)
else
ZIPVER = -v$(shell cat metadata.json | sed '/"version"/!d' | sed s/\"version\"://g | sed s/\ //g | sed s/,//g)
endif
all: extension
extension: ./schemas/gschemas.compiled $(MSGSRC:.po=.mo)
./schemas/gschemas.compiled: ./schemas/org.gnome.shell.extensions.sp-tray.gschema.xml
glib-compile-schemas ./schemas/
./po/%.mo: ./po/%.po
msgfmt -c $< -o $@
clean:
rm -f ./schemas/gschemas.compiled
rm -f ./po/*.mo
install: _build
rm -rf $(DEST)
mkdir -p $(DEST)
cp -r ./_build/* $(DEST)
-rm -fR _build
echo done
uninstall:
rm -rf $(DEST)
package: _build
cd _build ; \
zip -qr "$(PKG_NAME)$(ZIPVER).zip" .
mv _build/$(PKG_NAME)$(ZIPVER).zip ./
-rm -fR _build
_build: all
-rm -fR ./_build
mkdir _build
cp $(BASE_MODULES) $(SRC_MODULES) _build
cp $(PREFS_MODULES) _build
mkdir -p _build/schemas
cp schemas/*.xml _build/schemas
cp schemas/gschemas.compiled _build/schemas
mkdir -p _build/locale
for l in $(MSGSRC:.po=.mo) ; do \
af=_build/`dirname $$l .mo`; \
lf=_build/$$l; \
mkdir -p $$af; \
cp $$l $$lf; \
done;
ifdef VERSION
sed -i 's/"version": .*/"version": $(VERSION)/' _build/metadata.json;
else ifneq ($(strip $(GIT_VER)),)
sed -i '/"version": .*/i\ \ "git-version": "$(GIT_VER)",' _build/metadata.json;
endif