-
Notifications
You must be signed in to change notification settings - Fork 71
/
Makefile
76 lines (57 loc) · 1.94 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
PROJECT_NAME = krohnkite
PROJECT_VER = 0.8.2
PROJECT_REV = $(shell git rev-parse HEAD | cut -b-7)
KWINPKG_FILE = $(PROJECT_NAME)-$(PROJECT_VER).kwinscript
KWINPKG_DIR = pkg
KWIN_META = $(KWINPKG_DIR)/metadata.desktop
KWIN_QML = $(KWINPKG_DIR)/contents/ui/main.qml
NODE_SCRIPT = krohnkite.js
NODE_META = package.json
NODE_FILES = $(NODE_SCRIPT) $(NODE_META) package-lock.json
SRC = $(shell find src -name "*.ts")
all: $(KWINPKG_DIR)
clean:
@rm -rvf $(KWINPKG_DIR)
@rm -vf $(NODE_FILES)
install: package
plasmapkg2 -t kwinscript -s $(PROJECT_NAME) \
&& plasmapkg2 -u $(KWINPKG_FILE) \
|| plasmapkg2 -i $(KWINPKG_FILE)
uninstall:
plasmapkg2 -t kwinscript -r $(PROJECT_NAME)
package: $(KWINPKG_FILE)
test: $(NODE_SCRIPT) $(NODE_META)
npm test
run: $(KWINPKG_DIR)
bin/load-script.sh "$(KWIN_QML)" "$(PROJECT_NAME)-test"
@find "$(KWINPKG_DIR)" '(' -name "*.qmlc" -o -name "*.jsc" ')' -delete
stop:
bin/load-script.sh "unload" "$(PROJECT_NAME)-test"
$(KWINPKG_FILE): $(KWINPKG_DIR)
@rm -f "$(KWINPKG_FILE)"
@7z a -tzip $(KWINPKG_FILE) ./$(KWINPKG_DIR)/*
$(KWINPKG_DIR): $(KWIN_META)
$(KWINPKG_DIR): $(KWIN_QML)
$(KWINPKG_DIR): $(KWINPKG_DIR)/contents/ui/config.ui
$(KWINPKG_DIR): $(KWINPKG_DIR)/contents/ui/popup.qml
$(KWINPKG_DIR): $(KWINPKG_DIR)/contents/code/script.js
$(KWINPKG_DIR): $(KWINPKG_DIR)/contents/config/main.xml
@touch $@
$(KWIN_META): res/metadata.desktop
@mkdir -vp `dirname $(KWIN_META)`
sed "s/\$$VER/$(PROJECT_VER)/" $< \
| sed "s/\$$REV/$(PROJECT_REV)/" \
> $(KWIN_META)
$(KWIN_QML): res/main.qml
$(KWINPKG_DIR)/contents/ui/config.ui: res/config.ui
$(KWINPKG_DIR)/contents/ui/popup.qml: res/popup.qml
$(KWINPKG_DIR)/contents/code/script.js: $(NODE_SCRIPT)
$(KWINPKG_DIR)/contents/config/main.xml: res/config.xml
$(KWINPKG_DIR)/%:
@mkdir -vp `dirname $@`
@cp -v $< $@
$(NODE_SCRIPT): $(SRC)
tsc
$(NODE_META): res/package.json
sed "s/\$$VER/$(PROJECT_VER).0/" $< > $@
.PHONY: all clean install package test run stop