Project

General

Profile

Bug #2853 » Makefile.webui

Volker Schmidt, 2015-05-18 23:35

 
1
#
2
#  Tvheadend WEBUI interface
3
#  Copyright (C) 2015 Jaroslav Kysela
4
#
5
#  This program is free software: you can redistribute it and/or modify
6
#  it under the terms of the GNU General Public License as published by
7
#  the Free Software Foundation, either version 3 of the License, or
8
#  (at your option) any later version.
9
#
10
#  This program is distributed in the hope that it will be useful,
11
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
#  GNU General Public License for more details.
14
#
15
#  You should have received a copy of the GNU General Public License
16
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
#
18

    
19
#
20
# Configuration
21
#
22

    
23
IAM=$(lastword $(MAKEFILE_LIST))
24
WEBDIR ?= src/webui
25
ROOTPATH = static
26

    
27
ifneq ($(WEBUI),)
28

    
29
TOPDIR=$(dir $(IAM))
30
include $(TOPDIR)/.config.mk
31
EXTJSPATH = $(ROOTPATH)/extjs
32
CSS_PY = PYTHONIOENCODING=utf-8 $(PYTHON) support/css.py
33
RUN_JS = PYTHONIOENCODING=utf-8 $(PYTHON) vendor/rjsmin-1.0.10/rjsmin.py
34
RUN_CSS = PYTHONIOENCODING=utf-8 $(PYTHON) vendor/rcssmin-1.0.5/rcssmin.py
35
GZIP += -n
36

    
37
ifeq ($(WEBUI),std)
38
DEBUG =
39
else
40
DEBUG = -debug
41
endif
42

    
43
JAVASCRIPT =
44
JAVASCRIPT2 =
45
JAVASCRIPT_TV =
46
CSS =
47
CSS_TV =
48

    
49
#
50
# base extjs files
51
#
52

    
53
JAVASCRIPT += $(EXTJSPATH)/adapter/ext/ext-base$(DEBUG).js
54
JAVASCRIPT += $(EXTJSPATH)/ext-all$(DEBUG).js
55

    
56
#
57
# CSS
58
#
59

    
60
CSS += $(EXTJSPATH)/resources/css/ext-all-notheme.css
61
CSS += $(EXTJSPATH)/resources/css/xtheme-blue.css
62
CSS += $(ROOTPATH)/livegrid/resources/css/ext-ux-livegrid.css
63
CSS += $(EXTJSPATH)/examples/ux/gridfilters/css/GridFilters.css
64
CSS += $(EXTJSPATH)/examples/ux/gridfilters/css/RangeMenu.css
65
CSS += static/xcheckbox/xcheckbox.css
66
CSS += static/app/ext.css
67

    
68
#
69
# extjs extensions
70
#
71

    
72
JAVASCRIPT += $(ROOTPATH)/app/extensions.js
73
JAVASCRIPT += $(ROOTPATH)/livegrid/livegrid-all.js
74
JAVASCRIPT += $(ROOTPATH)/lovcombo/lovcombo-all.js
75
JAVASCRIPT += $(ROOTPATH)/multiselect/multiselect.js
76
JAVASCRIPT += $(ROOTPATH)/multiselect/ddview.js
77
JAVASCRIPT += $(ROOTPATH)/xcheckbox/xcheckbox.js
78
JAVASCRIPT += $(ROOTPATH)/checkcolumn/CheckColumn.js
79
JAVASCRIPT += $(EXTJSPATH)/examples/ux/gridfilters/GridFilters.js
80
JAVASCRIPT += $(EXTJSPATH)/examples/ux/gridfilters/filter/Filter.js
81
JAVASCRIPT += $(EXTJSPATH)/examples/ux/gridfilters/filter/BooleanFilter.js
82
JAVASCRIPT += $(EXTJSPATH)/examples/ux/gridfilters/filter/DateFilter.js
83
JAVASCRIPT += $(EXTJSPATH)/examples/ux/gridfilters/filter/ListFilter.js
84
JAVASCRIPT += $(EXTJSPATH)/examples/ux/gridfilters/filter/NumericFilter.js
85
JAVASCRIPT += $(EXTJSPATH)/examples/ux/gridfilters/filter/StringFilter.js
86
JAVASCRIPT += $(EXTJSPATH)/examples/ux/gridfilters/menu/ListMenu.js
87
JAVASCRIPT += $(EXTJSPATH)/examples/ux/gridfilters/menu/RangeMenu.js
88

    
89
#
90
# app itself
91
#
92

    
93
JAVASCRIPT += $(ROOTPATH)/app/namespace.js
94
JAVASCRIPT += $(ROOTPATH)/smoothie.js
95
JAVASCRIPT += $(ROOTPATH)/app/comet.js
96
JAVASCRIPT += $(ROOTPATH)/app/tableeditor.js
97
JAVASCRIPT += $(ROOTPATH)/app/cteditor.js
98
JAVASCRIPT += $(ROOTPATH)/app/acleditor.js
99

    
100
CACLIENT-$(CONFIG_CWC) = yes
101
CACLIENT-$(CONFIG_CAPMT) = yes
102

    
103
ifeq ($(CACLIENT-yes), yes)
104
JAVASCRIPT += $(ROOTPATH)/app/caclient.js
105
endif
106

    
107
JAVASCRIPT += $(ROOTPATH)/app/tvadapters.js
108
JAVASCRIPT += $(ROOTPATH)/app/idnode.js
109
JAVASCRIPT += $(ROOTPATH)/app/esfilter.js
110
ifeq ($(CONFIG_MPEGTS), yes)
111
JAVASCRIPT += $(ROOTPATH)/app/mpegts.js
112
endif
113
ifeq ($(CONFIG_TIMESHIFT), yes)
114
JAVASCRIPT += $(ROOTPATH)/app/timeshift.js
115
endif
116
JAVASCRIPT += $(ROOTPATH)/app/chconf.js
117
JAVASCRIPT += $(ROOTPATH)/app/epg.js
118
JAVASCRIPT += $(ROOTPATH)/app/dvr.js
119
JAVASCRIPT += $(ROOTPATH)/app/epggrab.js
120
JAVASCRIPT += $(ROOTPATH)/app/config.js
121
JAVASCRIPT += $(ROOTPATH)/app/tvhlog.js
122
JAVASCRIPT += $(ROOTPATH)/app/status.js
123
JAVASCRIPT += $(ROOTPATH)/tv.js
124
JAVASCRIPT += $(ROOTPATH)/app/servicemapper.js
125

    
126
JAVASCRIPT += $(ROOTPATH)/app/tvheadend.js
127

    
128
#
129
# tv
130
#
131

    
132
CSS_TV += $(ROOTPATH)/tv.css
133
JAVASCRIPT_TV += $(EXTJSPATH)/adapter/ext/ext-base$(DEBUG).js
134
JAVASCRIPT_TV += $(EXTJSPATH)/ext-all$(DEBUG).js
135
JAVASCRIPT_TV += $(ROOTPATH)/tv.js
136

    
137
#
138
# real source paths
139
#
140

    
141
JAVASCRIPT_SRC = $(foreach f,$(JAVASCRIPT),$(WEBDIR)/$(f))
142
CSS_SRC = $(foreach f,$(CSS),$(WEBDIR)/$(f))
143
JAVASCRIPT_TV_SRC = $(foreach f,$(JAVASCRIPT_TV),$(WEBDIR)/$(f))
144
CSS_TV_SRC = $(foreach f,$(CSS_TV),$(WEBDIR)/$(f))
145

    
146
endif # WEBUI defined
147

    
148
ifndef V
149
VV = @
150
endif
151

    
152
define GO_JS
153
	$(VV)$(CSS_PY) --in="$^" utf-check
154
	$(VV)cat $^ > [email protected]
155
	$(VV)$(RUN_JS) < [email protected] > [email protected]
156
	@stat --printf="%-35n %7s\n" $@.tmp $@.tmp2
157
	@$(GZIP) -c [email protected] > [email protected]
158
	@rm [email protected]
159
	@mv [email protected] $@
160
	@stat --printf="%-35n %7s\n" $@
161
endef
162

    
163
define GO_CSS
164
	$(VV)$(CSS_PY) --in="$^" utf-check
165
	$(VV)$(CSS_PY) --in="$^" > $@.tmp
166
	$(VV)$(RUN_CSS) < [email protected] > [email protected]
167
	@stat --printf="%-35n %7s\n" $@.tmp $@.tmp2
168
	@$(GZIP) -c [email protected] > [email protected]
169
	@rm [email protected]
170
	@mv [email protected] $@
171
	@stat --printf="%-35n %7s\n" $@
172
endef
173

    
174
all:
175
	$(MAKE) -f $(IAM) WEBUI=std   compile-std
176
	$(MAKE) -f $(IAM) WEBUI=debug compile-debug
177

    
178
$(WEBDIR)/extjs-std.c: $(JAVASCRIPT_SRC) $(CSS_SRC)
179
	$(VV)printf 'extjs_lcss(hq, "static/tvh.css.gz");\n' > $@
180
	$(VV)printf 'extjs_load(hq, "static/tvh.js.gz");\n' >> $@
181

    
182
$(WEBDIR)/extjs-debug.c: $(JAVASCRIPT_SRC) $(CSS_SRC)
183
	$(VV)printf '$(foreach f,$(CSS),extjs_lcss(hq, "$(f)");\r\n)' > $@
184
	$(VV)printf '$(foreach f,$(JAVASCRIPT),extjs_load(hq, "$(f)");\r\n)' >> $@
185

    
186
$(WEBDIR)/extjs-tv-std.c: $(JAVASCRIPT_TV_SRC) $(CSS_TV_SRC)
187
	$(VV)printf 'extjs_lcss(hq, "static/tvh-tv.css.gz");' > $@
188
	$(VV)printf 'extjs_load(hq, "static/tvh-tv.js.gz");' >> $@
189

    
190
$(WEBDIR)/extjs-tv-debug.c: $(JAVASCRIPT_TV_SRC) $(CSS_TV_SRC)
191
	$(VV)printf '$(foreach f,$(CSS_TV),extjs_lcss(hq, "$(f)");\r\n)' > $@
192
	$(VV)printf '$(foreach f,$(JAVASCRIPT_TV),extjs_load(hq, "$(f)");\r\n)' >> $@
193

    
194
$(WEBDIR)/$(ROOTPATH)/tvh.js.gz: $(JAVASCRIPT_SRC)
195
	$(call GO_JS)
196

    
197
$(WEBDIR)/$(ROOTPATH)/tvh.css.gz: $(CSS_SRC)
198
	$(call GO_CSS)
199

    
200
$(WEBDIR)/$(ROOTPATH)/tvh-tv.js.gz: $(JAVASCRIPT_TV_SRC)
201
	$(call GO_JS)
202

    
203
$(WEBDIR)/$(ROOTPATH)/tvh-tv.css.gz: $(CSS_TV_SRC)
204
	$(call GO_CSS)
205

    
206
.PHONY: compile-std
207
compile-std: $(WEBDIR)/$(ROOTPATH)/tvh.js.gz $(WEBDIR)/$(ROOTPATH)/tvh.css.gz \
208
             $(WEBDIR)/$(ROOTPATH)/tvh-tv.js.gz $(WEBDIR)/$(ROOTPATH)/tvh-tv.css.gz \
209
             $(WEBDIR)/extjs-std.c $(WEBDIR)/extjs-tv-std.c
210
	@echo "WEBUI std finished"
211
	
212
.PHONY: compile-debug
213
compile-debug: $(WEBDIR)/extjs-debug.c $(WEBDIR)/extjs-tv-debug.c
214
	@echo "WEBUI debug finished"
215

    
216
.PHONY:
217
clean:
218
	rm -f $(foreach f,tvh.js tvh.css tvh-tv.js tvh-tv.css,\
219
		$(WEBDIR)/$(ROOTPATH)/$(f).gz \
220
		$(WEBDIR)/$(ROOTPATH)/$(f).tmp \
221
		$(WEBDIR)/$(ROOTPATH)/$(f).tmp2) \
222
              $(WEBDIR)/extjs-std.c $(WEBDIR)/extjs-tv-std.c \
223
              $(WEBDIR)/extjs-debug.c $(WEBDIR)/extjs-tv-debug.c
(3-3/4)