forked from sozi-projects/Sozi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
133 lines (96 loc) · 3.77 KB
/
Makefile
File metadata and controls
133 lines (96 loc) · 3.77 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# The version number is obtained from the current date and time
VERSION := $(shell date +%y.%m-%d%H%M%S)
TIMESTAMP := release/timestamp-$(VERSION)
# All source files of the Inkscape extensions
EDITOR_SRC := \
$(wildcard editors/inkscape/*.py) \
$(wildcard editors/inkscape/*.inx) \
$(wildcard editors/inkscape/sozi/*.*)
# The translation files for the Inkscape extensions
EDITOR_PO := $(wildcard editors/inkscape/sozi/lang/*/sozi.po)
# The translatable source files of the Inkscape extensions
GETTEXT_SRC := \
$(wildcard editors/inkscape/*.py) \
$(wildcard editors/inkscape/sozi/*.py) \
editors/inkscape/sozi/ui.glade
# The list of Javascript source files in the player and Sozi extras
PLAYER_JS := $(shell ./tools/utilities/depend.py player/js/sozi.js)
EXTRAS_JS := $(wildcard player/js/extras/*.js)
# The license files
LICENSES := $(wildcard doc/*license.txt)
# The list of files in the installation tree
TARGET := \
$(subst editors/inkscape/,,$(EDITOR_SRC)) \
$(patsubst editors/inkscape/sozi/lang/%/sozi.po,sozi/lang/%/LC_MESSAGES/sozi.mo,$(EDITOR_PO)) \
$(addprefix sozi/,sozi.js sozi.css $(notdir $(EXTRAS_JS) $(LICENSES)))
# The list of files in the release tree
TARGET_RELEASE := $(addprefix release/, $(TARGET))
# The path of the installation folder for the current user
INSTALL_DIR := $(HOME)/.config/inkscape/extensions
# The release bundle
ZIP := release/sozi-release-$(VERSION).zip
# The minifier commands for Javascript and CSS
MINIFY_OPT += --compress
MINIFY_OPT += --mangle
#MINIFY_JS := cat
MINIFY_JS := ./node_modules/uglify-js/bin/uglifyjs
MINIFY_CSS := cat
# The Javascript linter command
LINT := ./node_modules/autolint/bin/autolint
# The message compiler command
MSGFMT := /usr/lib/python2.7/Tools/i18n/msgfmt.py
# The documentation generator command and options
JSDOC_OPT += --private
JSDOC_OPT += --recurse
# JSDOC_OPT += --template jsdoc-templates
JSDOC_OPT += --destination web/api
JSDOC := ./node_modules/jsdoc/jsdoc
.PHONY: all verify install tools doc clean
# Default rule: create a zip archive for installation
all: $(ZIP)
# Verify Javascript source files of the player
verify: $(PLAYER_JS) $(EXTRAS_JS)
$(LINT) --once
# Install Sozi
install: $(TARGET_RELEASE)
cd release ; cp --parents $(TARGET) $(INSTALL_DIR)
# Install the tools needed to build Sozi
tools:
npm install uglify-js
npm install autolint
npm install git://github.com/jsdoc3/jsdoc.git
# Generate API documentation
doc: $(PLAYER_JS) $(EXTRAS_JS)
$(JSDOC) $(JSDOC_OPT) player/js
# Generate a template file for translation
pot: $(GETTEXT_SRC)
xgettext --package-name=Sozi --package-version=$(VERSION) --output=editors/inkscape/sozi/lang/sozi.pot $^
# Create a zip archive for installation
$(ZIP): $(TARGET_RELEASE)
cd release ; zip $(notdir $@) $(TARGET)
# Concatenate and minify the Javascript source files of the player
release/sozi/sozi.js: $(PLAYER_JS)
$(MINIFY_JS) $^ $(MINIFY_OPT) > $@
# Minify a CSS stylesheet of the player
release/sozi/%.css: player/css/%.css
$(MINIFY_CSS) $^ > $@
# Minify a Javascript source file from Sozi-extras
release/sozi/%.js: player/js/extras/%.js
$(MINIFY_JS) $^ $(MINIFY_OPT) > $@
# Compile a translation file for a given language
release/sozi/lang/%/LC_MESSAGES/sozi.mo: editors/inkscape/sozi/lang/%/sozi.po
mkdir -p $(dir $@) ; $(MSGFMT) -o $@ $<
# Fill the version number in the Inkscape extensions
release/sozi/version.py: $(TIMESTAMP)
mkdir -p $(dir $@) ; sed "s/@SOZI_VERSION@/$(VERSION)/g" editors/inkscape/sozi/version.py > $@
$(TIMESTAMP):
touch $@
# Copy a file from the Inkscape extensions
release/%: editors/inkscape/%
mkdir -p $(dir $@) ; cp $< $@
# Copy a file from the documents folder
release/sozi/%: doc/%
mkdir -p $(dir $@) ; cp $< $@
# Remove all temporary files from the release folder
clean:
rm -f $(TARGET_RELEASE) release/timestamp-*