This repository has been archived by the owner on Dec 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Makefile
91 lines (62 loc) · 2.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
####################################################
# Ultimate QGIS plugin Makefile
####################################################
# REQUIREMENTS
# 1. This Makefile is for linux environment. It shall be extended to be used on other OS.
# 2. Folder name is the plugin name
# TIPS
# 1. If .ui files are in a subfolder and resources on top level
# create a file resources_rc.py with:
# from ..resources_rc import *
####################################################
# CONFIGURATION
# QGIS DIR
QGISDIR = $(HOME)/.qgis-dev
# i18n
LN_DIR = i18n
TRANSLATED_LANG = fr de
# COMMAND TO RUN DEFAULT APPLICATION (launch a URL)
# Linux 'open' or 'xdg-open' / OSX: 'open' / Win: 'start'
OPEN = xdg-open
###################################################
# DO NOT EDIT BELOW !
PLUGINNAME =$(shell basename $(CURDIR))
VERSION = `cat $(PLUGINNAME)/metadata.txt | grep version | sed 's/version=//'`
PY_FILES = $(filter-out ui_%.py, $(wildcard *.py) $(wildcard **/*.py))
EXTRAS = metadata.txt resources.qrc
UI_SOURCES=$(wildcard *.ui) $(wildcard **/*.ui)
UI_FILES=$(join $(dir $(UI_SOURCES)), $(notdir $(UI_SOURCES:%.ui=%.py)))
RC_SOURCES=$(wildcard *.qrc) $(wildcard **/*.qrc)
RC_FILES=$(join $(dir $(RC_SOURCES)), $(notdir $(RC_SOURCES:%.qrc=%_rc.py)))
LN_SOURCES=$(wildcard *.ts) $(wildcard **/*.ts)
LN_FILES=$(join $(dir $(LN_SOURCES)), $(notdir $(LN_SOURCES:%.ts=%.qm)))
GEN_FILES = ${UI_FILES} ${RC_FILES}
all: $(GEN_FILES)
$(UI_FILES): %.py: %.ui
PYTHONPATH=$(PYTHONPATH):/usr/share/qgis/python python3 -m qgis.PyQt.uic.pyuic --from-imports -o $@ $<
$(RC_FILES): %_rc.py: %.qrc
pyrcc5 -o $@ $<
$(LN_FILES): %.qm: %.ts
lrelease-qt5 $<
clean:
rm -f $(GEN_FILES) *.pyc
find $(CURDIR) -iname "*.pyc" -delete
compile: $(UI_FILES) $(RC_FILES) $(LN_FILES)
transup:
$(foreach lang,$(TRANSLATED_LANG),pylupdate4 -noobsolete $(UI_SOURCES) $(PY_FILES) -ts $(LN_DIR)/$(PLUGINNAME)_$(lang).ts;)
deploy: compile transup
mkdir -p $(QGISDIR)/python/plugins/$(PLUGINNAME)
cp -rvf * $(QGISDIR)/python/plugins/$(PLUGINNAME)/
rm -f $(QGISDIR)/python/plugins/$(PLUGINNAME)/$(PLUGINNAME)*.zip
# The dclean target removes compiled python files from plugin directory
dclean:
find $(QGISDIR)/python/plugins/$(PLUGINNAME) -iname "*.pyc" -delete
rm -f $(QGISDIR)/python/plugins/$(PLUGINNAME)/$(PLUGINNAME)*.zip
# The derase deletes deployed plugin
derase:
rm -Rf $(QGISDIR)/python/plugins/$(PLUGINNAME)
zip: clean deploy dclean
rm -f $(PLUGINNAME)-$(VERSION).zip
cd $(QGISDIR)/python/plugins; zip -9r $(CURDIR)/$(PLUGINNAME)-$(VERSION).zip $(PLUGINNAME)
release: zip
$(OPEN) http://plugins.qgis.org/plugins/$(PLUGINNAME)/version/add/ &