-
Notifications
You must be signed in to change notification settings - Fork 156
Expand file tree
/
Copy pathMakefile
More file actions
100 lines (84 loc) · 3.13 KB
/
Makefile
File metadata and controls
100 lines (84 loc) · 3.13 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
ifdef $$XDG_DATA_HOME
XDG_DATA_HOME := $$XDG_DATA_HOME
else
XDG_DATA_HOME := ${HOME}/.local/share
endif
SOURCE := $$PWD
EXT_ID := paperwm@paperwm.github.com
EXT_DIR := $(XDG_DATA_HOME)/gnome-shell/extensions
TARGET := $(EXT_DIR)/$(EXT_ID)
CONFIG_FILES = config/user.js config/user.css
GSCHEMA_FILES = schemas/org.gnome.shell.extensions.paperwm.gschema.xml
JS_FILES = $(wildcard *.js)
UI_FILES = $(wildcard *.ui)
RESOURCE_FILES = $(wildcard resources/*)
RELEASE_FILES = $(JS_FILES) $(UI_FILES) $(RESOURCE_FILES) \
$(CONFIG_FILES) $(GSCHEMA_FILES) \
schemas/gschemas.compiled \
metadata.json \
stylesheet.css \
LICENSE
ZIP := zip
ifneq (,$(shell command -v gnome-extensions))
GNOME_EXT_DISABLE := gnome-extensions disable
else
GNOME_EXT_DISABLE := gnome-shell-extension-tool --disable
endif
SHELL=/bin/bash
## Update compiled files
all: $(RELEASE_FILES)
## Install PaperWM on this system
install: schemas/gschemas.compiled
@if [[ ! -L "$(TARGET)" && -d "$(TARGET)" ]]; \
then \
echo; \
echo "INSTALL FAILED:"; \
echo; \
echo "A previous (non-symlinked) installation of PaperWM already exists at:"; \
echo "'$(TARGET)'."; \
echo; \
echo "Please remove the installed version from that path and re-run this install script."; \
echo; \
exit 1; \
fi
@$(call rich_echo,"MKDIR","$(EXT_DIR)")
@mkdir -p $(EXT_DIR)
@$(call rich_echo,"LINK","$(EXT_ID)")
@ln -snf $(SOURCE) $(TARGET)
@echo
@echo "INSTALL SUCCESSFUL:"
@echo
@echo "If this is the first time installing PaperWM, then please logout/login"
@echo "and enable the PaperWM extension, either with the GNOME Extensions application,"
@echo "or manually by executing the following command from a terminal:"
@echo
@echo "gnome-extensions enable $(EXT_ID)"
@echo
## Uninstall PaperWM from this system
uninstall:
@$(call rich_echo,"GNOME_EXT_DISABLE", "$(EXT_ID)")
@$(GNOME_EXT_DISABLE) $(EXT_ID)
@if [[ `readlink -f $(TARGET)` != `readlink -f $$PWD` ]]; \
then \
echo "'$(TARGET)' does not link to '$$PWD', refusing to remove."; \
exit 1; \
fi
@if [ -L $(TARGET) ]; \
then \
$(call rich_echo,"RM", "$(TARGET)") \
rm $(EXT); \
else \
read -p "Remove $(TARGET)? (y/N): " -n 1 -r \
echo \
[[ $$REPLY =~ ^[Yy]$ ]] && rm -rf $(TARGET); \
fi
## Generate a release zip for review on GNOME Extensions
release: $(EXT_ID).zip
$(EXT_ID).zip: $(RELEASE_FILES)
@$(call rich_echo,"ZIP","$@")
@$(ZIP) -r $@ $^
schemas/gschemas.compiled: $(GSCHEMA_FILES)
@$(call rich_echo,"MAKE","$@")
@$(MAKE) -C schemas gschemas.compiled
.PHONY: install uninstall release
include lib.mk