forked from CZ-NIC/foris
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
90 lines (68 loc) · 2.53 KB
/
Makefile
File metadata and controls
90 lines (68 loc) · 2.53 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
# Foris - web administration interface for OpenWrt based on NETCONF
# Copyright (C) 2013 CZ.NIC, z.s.p.o. <http://www.nic.cz>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
BRAND ?= turris
COMPILED_CSS = $(wildcard foris/static/css/*)
COMPILED_L10N = $(wildcard foris/locale/*/LC_MESSAGES/*.mo)
JS_FILES = $(filter-out %.min.js $(wildcard foris/static/js/contrib/*),$(wildcard \
foris/static/js/*.js \
foris/static/js/**/*.js \
))
JS_MINIFIED = $(JS_FILES:.js=.min.js)
PRE_TPL_FILES = $(wildcard \
foris/templates/*.pre.tpl \
foris/templates/**/*.pre.tpl \
)
TPL_FILES = $(PRE_TPL_FILES:.pre.tpl=.tpl)
JS_MINIFIER = slimit -m
SASS_COMPILER = compass compile -s compressed -e production
all: branding sass js localization tpl
# target: js - Create minified JS files using slimit JS compressor.
js: $(JS_FILES) $(JS_MINIFIED)
# target: tpl - Do preprocessing of .pre.tpl files.
tpl: $(PRE_TPL_FILES) $(TPL_FILES)
# target: branding - Copy assets for a specified device to its location.
branding:
@echo "-- Preparing branding for '$(BRAND)'"
@[ -d branding/$(BRAND) ] || (echo "Directory with '$(BRAND)' branding does not exist" && exit 1)
@cp -fr branding/$(BRAND)/. foris/static/
@echo
# target: sass - Compile SASS files to CSS files using SASS/Compass compiler.
sass:
@cd foris/static/; \
echo '-- Running compass $<';\
$(SASS_COMPILER)
@echo
# target: localization - Create .mo files from .po fiels in locale directory
localization:
@echo "-- Compiling localization files"
@tools/compilemessages.sh foris
@echo "Done."
@echo
%.tpl: %.pre.tpl
@echo '-- Preprocessing template $<'
tools/preprocess_template.sh $< > $@
@echo
%.min.js: %.js
@echo '-- Minifying $<'
$(JS_MINIFIER) $< > $@
@echo
# target: clean - Remove all compiled CSS, JS and localization files.
clean:
rm -rf $(COMPILED_CSS) $(COMPILED_L10N) $(JS_MINIFIED) $(TPL_FILES)
# target: help - Show this help.
help:
@egrep "^# target:" Makefile
.PHONY: all branding sass js localization tpl