This repository has been archived by the owner on Apr 20, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
115 lines (93 loc) · 2.97 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
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
# Basic Makefile with bits inspired by dash-to-dock
UUID=org.gnome-shell.desktop-icons
GSCHEMA_FILE=org.gnome.shell.extensions.desktop-icons.gschema.xml
GIT_HEAD=$(shell git rev-parse HEAD)
LAST_RELEASE=$(shell git describe --abbrev=0 --tags --match v[0-9]*)
GIT_LAST_TAG=$(shell git show-ref -s $(LAST_RELEASE))
# define VERSION and VSTRING
ifeq ($(GIT_LAST_TAG),$(GIT_HEAD))
VERSION=$(subst v,,$(LAST_RELEASE))
VSTRING=$(LAST_RELEASE)
else
VERSION=$(shell git rev-parse --short HEAD)
VSTRING=$(VERSION)
endif
ifeq ($(strip $(INSTALL)),system) # check if INSTALL == system
INSTALL_TYPE=system
SHARE_PREFIX=$(DESTDIR)/usr/share
INSTALL_BASE=$(SHARE_PREFIX)/gnome-shell/extensions
else
INSTALL_TYPE=local
INSTALL_BASE=~/.local/share/gnome-shell/extensions
endif
JS=*.js
UI=*.ui
MD=*.md
CSS=*.css
JSON=*.json
DIRS=schemas
all: build
help:
@echo "Usage: make [help | all | clean | install | jshint | compile |"
@echo " enable | disable | zip-file]"
@echo ""
@echo "all build the project and create the build directory"
@echo "clean delete the build directory"
@echo "install install the extension"
@echo "uninstall uninstall the extension"
@echo "enable enable the extension"
@echo "disable disable the extension"
@echo "jshint run jshint"
@echo "compile compile the gschema xml file"
@echo "zip-file create a deployable zip file"
@echo "tgz-file create a tar.gz file"
enable:
-gnome-shell-extension-tool -e $(UUID)
disable:
-gnome-shell-extension-tool -d $(UUID)
clean:
rm -f ./schemas/gschemas.compiled
rm -rf ./build
rm -f ./$(UUID)*.zip
rm -f ./$(UUID)*.tar.gz
rm -f MD5SUMS SHA1SUMS SHA256SUMS SHA512SUMS
jshint:
jshint $(JS)
test: jshint
install: build
mkdir -p $(INSTALL_BASE)/$(UUID)
cp -r ./build/* $(INSTALL_BASE)/$(UUID)
ifeq ($(INSTALL_TYPE),system)
mkdir -p $(SHARE_PREFIX)/glib-2.0/schemas
cp -r ./schemas/$(GSCHEMA_FILE) $(SHARE_PREFIX)/glib-2.0/schemas
endif
rm -rf ./build
uninstall:
rm -rf $(INSTALL_BASE)/$(UUID)
ifeq ($(INSTALL_TYPE),system)
rm -f $(SHARE_PREFIX)/glib-2.0/schemas/$(GSCHEMA_FILE)
endif
compile:
glib-compile-schemas ./schemas
build: compile
mkdir -p ./build
cp $(JS) $(CSS) $(JSON) $(MD) $(UI) ./build
cp -r $(DIRS) ./build
sed -i 's/"version": -1/"version": "$(VERSION)"/' build/metadata.json;
zip-file: build
mv ./build ./org.gnome.desktop-icons-reworked-$(VSTRING)
zip -qr $(UUID)_$(VSTRING).zip org.gnome.desktop-icons-reworked-$(VSTRING)
rm -rf ./org.gnome.desktop-icons-reworked-$(VSTRING)
$(MAKE) _checksums ARCHIVE_FILE=*.zip
tgz-file: build
mv ./build ./org.gnome.desktop-icons-reworked-$(VSTRING)
tar -zcf $(UUID)_$(VSTRING).tar.gz org.gnome.desktop-icons-reworked-$(VSTRING)
rm -rf ./org.gnome.desktop-icons-reworked-$(VSTRING)
$(MAKE) _checksums ARCHIVE_FILE=*.tar.gz
_checksums:
md5sum $(ARCHIVE_FILE) >> MD5SUMS
sha1sum $(ARCHIVE_FILE) >> SHA1SUMS
sha256sum $(ARCHIVE_FILE) >> SHA256SUMS
sha512sum $(ARCHIVE_FILE) >> SHA512SUMS
.PHONY: FORCE
FORCE: