GUI: Allow users to decide which NTFS driver they want to use cd ..
[tomato.git] / release / src-rt-6.x.4708 / router / www / Makefile
blob0da91fa56e5e9d4938e8c8eb1efe9b9c1493de4c
2 include ../common.mak
4 all:
6 clean:
8 install:
9 rm -rf $(INSTALLDIR)/www
10 mkdir -p $(INSTALLDIR)/www
12 cp *.gif *.png *.ico *.html *.php robots.txt $(INSTALLDIR)/www
14 # squish some of the files by trimming whitespace...
16 for F in $(wildcard *.js *.jsx); do \
17 sed '/^\/\*\s*$$/,/\*\//! { s/^\s\+//; s/\s\+$$//; /^\/\/ --\+\s*/d; /^$$/d }' < $$F > $(INSTALLDIR)/www/$$F; \
18 done
20 for F in $(wildcard *.css); do \
21 sed '/^\/\*\s*$$/,/\*\//! { s/\s\+/ /g; s/^\s\+//; s/\s\+$$//; /^$$/d }' < $$F > $(INSTALLDIR)/www/$$F; \
22 done
24 # remove "debug.js" references, convert color.css, remove comments
25 # in between REMOVE-BEGIN and REMOVE-END, and compress whitespace
27 for F in $(wildcard *.asp *.svg); do \
28 sed -e "/REMOVE-BEGIN/,/REMOVE-END/d" \
29 -e "s,<script[^>]\+debug\.js[^>]\+></script>,," \
30 -e "s,<link[^>]\+href='color\.css'>,<% css(); %>," \
31 -e "s,color\.css,<% nv('web_css'); %>\.css," \
32 -e "s,<!-- / / / -->,," \
33 -e "s,\x0d,," \
34 -e "s,^\s\+,," \
35 -e "/^$$/d" \
36 -e "/^<!--$$/,/^-->$$/! { s,^\s\+, , }" $$F > $(INSTALLDIR)/www/$$F; \
37 done
39 # Only include Linux 2.6 options if building for Linux 2.6.
40 ifneq ($(CONFIG_LINUX26),y)
41 cd $(INSTALLDIR)/www && \
42 for F in $(wildcard *.asp *.js); do \
43 sed -i $$F -e "/LINUX26-BEGIN/,/LINUX26-END/d"; \
44 done
45 # But remove some K24 options if building for Linux 2.6.
46 else
47 cd $(INSTALLDIR)/www && \
48 for F in $(wildcard *.asp *.js); do \
49 sed -i $$F -e "/LINUX24-BEGIN/,/LINUX24-END/d"; \
50 done
51 endif
53 # Only include the CIFS pages if CIFS is configured in.
54 ifneq ($(TCONFIG_CIFS),y)
55 rm -f $(INSTALLDIR)/www/admin-cifs.asp
56 sed -i $(INSTALLDIR)/www/tomato.js -e "/CIFS-BEGIN/,/CIFS-END/d"
57 sed -i $(INSTALLDIR)/www/admin-bwm.asp -e "/CIFS-BEGIN/,/CIFS-END/d"
58 sed -i $(INSTALLDIR)/www/nas-media.asp -e "/CIFS-BEGIN/,/CIFS-END/d"
59 endif
61 # Only include the JFFS pages if JFFS is configured in.
62 ifneq ($(TCONFIG_JFFS2),y)
63 rm -f $(INSTALLDIR)/www/admin-jffs2.asp
64 sed -i $(INSTALLDIR)/www/tomato.js -e "/JFFS2-BEGIN/,/JFFS2-END/d"
65 sed -i $(INSTALLDIR)/www/admin-bwm.asp -e "/JFFS2-BEGIN/,/JFFS2-END/d"
66 sed -i $(INSTALLDIR)/www/admin-upgrade.asp -e "/JFFS2-BEGIN/,/JFFS2-END/d"
67 sed -i $(INSTALLDIR)/www/nas-media.asp -e "/JFFS2-BEGIN/,/JFFS2-END/d"
68 endif
70 # Only include the Zebra options if Zebra is configured in.
71 ifneq ($(TCONFIG_ZEBRA),y)
72 sed -i $(INSTALLDIR)/www/advanced-routing.asp -e "/ZEBRA-BEGIN/,/ZEBRA-END/d"
73 endif
75 # Only include EMF options if EMF is configured in.
76 ifneq ($(TCONFIG_EMF),y)
77 sed -i $(INSTALLDIR)/www/advanced-routing.asp -e "/EMF-BEGIN/,/EMF-END/d"
78 endif
80 # Only include sd/mmc card support if MICROSD is configured in.
81 ifneq ($(TCONFIG_MICROSD),y)
82 sed -i $(INSTALLDIR)/www/nas-usb.asp -e "/MICROSD-BEGIN/,/MICROSD-END/d"
83 endif
85 # Only include NTFS settings if NTFS support is configured in.
86 ifneq ($(TCONFIG_NTFS),y)
87 sed -i $(INSTALLDIR)/www/nas-usb.asp -e "/NTFS-BEGIN/,/NTFS-END/d"
88 endif
90 # Only include Paragon NTFS settings if Paragon is configured in.
91 ifneq ($(TCONFIG_UFSDA),y)
92 ifneq ($(TCONFIG_UFSDN),y)
93 sed -i $(INSTALLDIR)/www/nas-usb.asp -e "/PARAGON-BEGIN/,/PARAGON-END/d"
94 endif
95 endif
97 # Only include Tuxera NTFS settings if Tuxera is configured in.
98 ifneq ($(TCONFIG_TUXERA),y)
99 sed -i $(INSTALLDIR)/www/nas-usb.asp -e "/TUXERA-BEGIN/,/TUXERA-END/d"
100 endif
102 # Only include the FTP pages if FTP Server is configured in.
103 ifneq ($(TCONFIG_FTP),y)
104 rm -f $(INSTALLDIR)/www/nas-ftp.asp
105 sed -i $(INSTALLDIR)/www/tomato.js -e "/FTP-BEGIN/,/FTP-END/d"
106 endif
107 # Only include the Samba pages if Samba is configured in.
108 ifneq ($(TCONFIG_SAMBASRV),y)
109 rm -f $(INSTALLDIR)/www/nas-samba.asp
110 sed -i $(INSTALLDIR)/www/tomato.js -e "/SAMBA-BEGIN/,/SAMBA-END/d"
111 endif
112 # Only include the Media Server pages if Media Server is configured in.
113 ifneq ($(TCONFIG_MEDIA_SERVER),y)
114 rm -f $(INSTALLDIR)/www/nas-media.asp
115 sed -i $(INSTALLDIR)/www/tomato.js -e "/MEDIA-SRV-BEGIN/,/MEDIA-SRV-END/d"
116 endif
118 # Victek for RAF verion
119 # Only include Captive Portal menu option and pages when configured.
120 ifneq ($(TCONFIG_NOCAT),y)
121 rm -f $(INSTALLDIR)/www/splashd.asp
122 rm -f $(INSTALLDIR)/www/splash.html
123 rm -f $(INSTALLDIR)/www/style.css
124 sed -i $(INSTALLDIR)/www/tomato.js -e "/NOCAT-BEGIN/,/NOCAT-END/d"
125 sed -i $(INSTALLDIR)/www/about.asp -e "/NOCAT-BEGIN/,/NOCAT-END/d"
126 endif
128 # Clean up NGinX files if not needed
129 ifneq ($(TCONFIG_NGINX),y)
130 rm -f $(INSTALLDIR)/www/web-nginx.asp
131 rm -f $(INSTALLDIR)/www/web-mysql.asp
132 rm -f $(INSTALLDIR)/www/index.html
133 rm -f $(INSTALLDIR)/www/phpinfo.php
134 rm -f $(INSTALLDIR)/www/adminer.php
135 sed -i $(INSTALLDIR)/www/tomato.js -e "/NGINX-BEGIN/,/NGINX-END/d"
136 sed -i $(INSTALLDIR)/www/about.asp -e "/NGINX-BEGIN/,/NGINX-END/d"
137 endif
140 # Only include HFS/HFS+ option and pages when configured.
141 ifneq ($(TCONFIG_HFS),y)
142 sed -i $(INSTALLDIR)/www/nas-usb.asp -e "/HFS-BEGIN/,/HFS-END/d"
143 sed -i $(INSTALLDIR)/www/about.asp -e "/HFS-BEGIN/,/HFS-END/d"
144 endif
146 # Only include IPv6 options if IPv6 is configured in.
147 ifneq ($(TCONFIG_IPV6),y)
148 cd $(INSTALLDIR)/www && \
149 for F in $(wildcard *.asp *.js *.jsx); do \
150 [ -f $(INSTALLDIR)/www/$$F ] && sed -i $$F \
151 -e "/IPV6-BEGIN/,/IPV6-END/d" \
152 || true; \
153 done
154 rm -f $(INSTALLDIR)/www/basic-ipv6.asp
155 endif
157 # Only include the Transmission binary path select if Transmission binaries is configured in.
158 ifneq ($(TCONFIG_BBT),y)
159 sed -i $(INSTALLDIR)/www/nas-bittorrent.asp -e "/BBT-BEGIN/,/BBT-END/d"
160 sed -i $(INSTALLDIR)/www/about.asp -e "/BBT-BEGIN/,/BBT-END/d"
161 endif
163 # Only include the Transmission pages if Transmission is configured in.
164 ifneq ($(TCONFIG_BT),y)
165 rm -f $(INSTALLDIR)/www/nas-bittorrent.asp
166 sed -i $(INSTALLDIR)/www/tomato.js -e "/BT-BEGIN/,/BT-END/d"
167 sed -i $(INSTALLDIR)/www/about.asp -e "/BT-BEGIN/,/BT-END/d"
168 endif
170 # Only include the UPS pages if apcupsd is configured in.
171 ifneq ($(TCONFIG_UPS),y)
172 rm -f $(INSTALLDIR)/www/nas-ups.asp
173 sed -i $(INSTALLDIR)/www/tomato.js -e "/UPS-BEGIN/,/UPS-END/d"
174 sed -i $(INSTALLDIR)/www/about.asp -e "/UPS-BEGIN/,/UPS-END/d"
175 endif
177 # Only include the TOR pages if tor project is configured in.
178 ifneq ($(TCONFIG_TOR),y)
179 rm -f $(INSTALLDIR)/www/advanced-tor.asp
180 sed -i $(INSTALLDIR)/www/tomato.js -e "/TOR-BEGIN/,/TOR-END/d"
181 sed -i $(INSTALLDIR)/www/about.asp -e "/TOR-BEGIN/,/TOR-END/d"
182 endif
186 # Only include the USB and NAS pages if USB Support is configured in.
187 ifneq ($(TCONFIG_USB),y)
188 rm -f $(INSTALLDIR)/www/nas-*.*
189 sed -i $(INSTALLDIR)/www/tomato.js -e "/USB-BEGIN/,/USB-END/d"
190 sed -i $(INSTALLDIR)/www/admin-buttons.asp -e "/USB-BEGIN/,/USB-END/d"
191 sed -i $(INSTALLDIR)/www/admin-access.asp -e "/USB-BEGIN/,/USB-END/d"
192 sed -i $(INSTALLDIR)/www/about.asp -e "/USB-BEGIN/,/USB-END/d"
193 endif
195 # Only include the USB and NAS pages if REMOVE_USBAPP is NOT configured in.
196 ifeq ($(TCONFIG_REMOVE_USBAPP),y)
197 rm -f $(INSTALLDIR)/www/nas-*.*
198 sed -i $(INSTALLDIR)/www/tomato.js -e "/USB-BEGIN/,/USB-END/d"
199 sed -i $(INSTALLDIR)/www/admin-buttons.asp -e "/USB-BEGIN/,/USB-END/d"
200 sed -i $(INSTALLDIR)/www/admin-access.asp -e "/USB-BEGIN/,/USB-END/d"
201 endif
203 ## Only include CTF option if CTF module exists
204 # test -d $(SRCBASE)/ctf/linux || sed -i $(INSTALLDIR)/www/advanced-misc.asp -e "/CTF-BEGIN/,/CTF-END/d"
206 # Only include the CTF configuration if CTF is configured in.
207 ifneq ($(TCONFIG_CTF),y)
208 sed -i $(INSTALLDIR)/www/advanced-misc.asp -e "/CTF-BEGIN/,/CTF-END/d"
209 endif
211 ifeq ($(TOMATO_EXPERIMENTAL),1)
212 cd $(INSTALLDIR)/www && \
213 for F in $(wildcard *.asp); do \
214 sed -e "s,<div class='title'>Tomato</div>,<div class='title'>Tomato <small><i>(beta)</i></small></div>," $$F > $$F.tmp; \
215 mv $$F.tmp $$F; \
216 done
217 endif
219 cd $(INSTALLDIR)/www && \
220 for F in $(wildcard *.asp); do \
221 sed -e "s,<div class='version'>Version <% version(); %></div>,<div class='version'>Version <% version(); %> by shibby</div>," $$F > $$F.tmp; \
222 mv $$F.tmp $$F; \
223 done
226 # Only include the vpn pages if OpenVPN is compiled in
227 # Remove AES ciphers from the GUI if openssl doesn't have an AES directory
228 ifeq ($(TCONFIG_OPENVPN),y)
229 test -d ../openssl/crypto/aes || sed -i $(INSTALLDIR)/www/vpn.js -e "/AES-BEGIN/,/AES-END/d"
230 sed -i $(INSTALLDIR)/www/tomato.js -e "/ VPN-BEGIN/d" -e "/ VPN-END/d"
231 sed -i $(INSTALLDIR)/www/admin-access.asp -e "/ VPN-BEGIN/d" -e "/ VPN-END/d"
232 sed -i $(INSTALLDIR)/www/about.asp -e "/ VPN-BEGIN/d" -e "/ VPN-END/d"
233 else
234 rm -f $(INSTALLDIR)/www/vpn-server.asp
235 rm -f $(INSTALLDIR)/www/vpn-client.asp
236 rm -f $(INSTALLDIR)/www/vpn.js
237 sed -i $(INSTALLDIR)/www/tomato.js -e "/ OPENVPN-BEGIN/,/ OPENVPN-END/d"
238 sed -i $(INSTALLDIR)/www/about.asp -e "/ OPENVPN-BEGIN/,/ OPENVPN-END/d"
239 endif
241 # Only include the PPTPD pages if PPTPD is compiled in
242 ifeq ($(TCONFIG_PPTPD),y)
243 sed -i $(INSTALLDIR)/www/tomato.js -e "/ VPN-BEGIN/d" -e "/ VPN-END/d"
244 sed -i $(INSTALLDIR)/www/admin-access.asp -e "/ VPN-BEGIN/d" -e "/ VPN-END/d"
245 sed -i $(INSTALLDIR)/www/about.asp -e "/ VPN-BEGIN/d" -e "/ VPN-END/d"
246 else
247 rm -f $(INSTALLDIR)/www/vpn-pptp-server.asp
248 rm -f $(INSTALLDIR)/www/vpn-pptp-online.asp
249 rm -f $(INSTALLDIR)/www/vpn-pptp.asp
250 sed -i $(INSTALLDIR)/www/tomato.js -e "/ PPTPD-BEGIN/,/ PPTPD-END/d"
251 sed -i $(INSTALLDIR)/www/about.asp -e "/ PPTPD-BEGIN/,/ PPTPD-END/d"
252 endif
254 # Only include the nfs pages if NFS is compiled in
255 ifneq ($(TCONFIG_NFS),y)
256 rm -f $(INSTALLDIR)/www/admin-nfs.asp
257 sed -i $(INSTALLDIR)/www/tomato.js -e "/NFS-BEGIN/,/NFS-END/d"
258 sed -i $(INSTALLDIR)/www/about.asp -e "/NFS-BEGIN/,/NFS-END/d"
259 endif
261 # Only include the snmp pages if SNMP is compiled in
262 ifneq ($(TCONFIG_SNMP),y)
263 rm -f $(INSTALLDIR)/www/admin-snmp.asp
264 sed -i $(INSTALLDIR)/www/tomato.js -e "/SNMP-BEGIN/,/SNMP-END/d"
265 sed -i $(INSTALLDIR)/www/about.asp -e "/SNMP-BEGIN/,/SNMP-END/d"
266 endif
268 # Only include the mmc pages if SDHC is compiled in
269 ifneq ($(TCONFIG_SDHC),y)
270 rm -f $(INSTALLDIR)/www/admin-sdhc.asp
271 sed -i $(INSTALLDIR)/www/tomato.js -e "/SDHC-BEGIN/,/SDHC-END/d"
272 sed -i $(INSTALLDIR)/www/about.asp -e "/SDHC-BEGIN/,/SDHC-END/d"
273 endif
275 # Only include the dnssec option if is compiled in
276 ifneq ($(TCONFIG_DNSSEC),y)
277 sed -i $(INSTALLDIR)/www/basic-network.asp -e "/DNSSEC-BEGIN/,/DNSSEC-END/d"
278 sed -i $(INSTALLDIR)/www/about.asp -e "/DNSSEC-BEGIN/,/DNSSEC-END/d"
279 endif
281 # Only include the Tinc page if it is compiled in
282 ifneq ($(TCONFIG_TINC),y)
283 rm -f $(INSTALLDIR)/www/vpn-tinc.asp
284 sed -i $(INSTALLDIR)/www/tomato.js -e "/TINC-BEGIN/,/TINC-END/d"
285 sed -i $(INSTALLDIR)/www/about.asp -e "/TINC-BEGIN/,/TINC-END/d"
286 endif
288 # Only include the dnscrypt option if is compiled in
289 ifeq ($(TCONFIG_DNSCRYPT),y)
290 $(TOP)/www/dnscrypt-helper.sh $(INSTALLDIR)/../rom/rom/etc/dnscrypt-resolvers.csv $(INSTALLDIR)/www/basic-network.asp
291 else
292 sed -i $(INSTALLDIR)/www/basic-network.asp -e "/DNSCRYPT-BEGIN/,/DNSCRYPT-END/d"
293 sed -i $(INSTALLDIR)/www/about.asp -e "/DNSCRYPT-BEGIN/,/DNSCRYPT-END/d"
294 endif
296 # clean up
297 cd $(INSTALLDIR)/www && \
298 for F in $(wildcard *.asp *.js *.jsx *.html); do \
299 [ -f $(INSTALLDIR)/www/$$F ] && sed -i $$F \
300 -e "/LINUX26-BEGIN/d" -e "/LINUX26-END/d" \
301 -e "/LINUX24-BEGIN/d" -e "/LINUX24-END/d" \
302 -e "/USB-BEGIN/d" -e "/USB-END/d" \
303 -e "/EXTRAS-BEGIN/d" -e "/EXTRAS-END/d" \
304 -e "/NTFS-BEGIN/d" -e "/NTFS-END/d" \
305 -e "/SAMBA-BEGIN/d" -e "/SAMBA-END/d" \
306 -e "/FTP-BEGIN/d" -e "/FTP-END/d" \
307 -e "/MEDIA-SRV-BEGIN/d" -e "/MEDIA-SRV-END/d" \
308 -e "/JFFS2-BEGIN/d" -e "/JFFS2-END/d" \
309 -e "/CIFS-BEGIN/d" -e "/CIFS-END/d" \
310 -e "/ZEBRA-BEGIN/d" -e "/ZEBRA-END/d" \
311 -e "/EMF-BEGIN/d" -e "/EMF-END/d" \
312 -e "/OPENVPN-BEGIN/d" -e "/OPENVPN-END/d" \
313 -e "/AES-BEGIN/d" -e "/AES-END/d" \
314 -e "/PPTPD-BEGIN/d" -e "/PPTPD-END/d"\
315 -e "/VPN-BEGIN/,/VPN-END/d" \
316 -e "/IPV6-BEGIN/d" -e "/IPV6-END/d" \
317 -e "/CTF-BEGIN/d" -e "/CTF-END/d" \
318 -e "/BBT-BEGIN/d" -e "/BBT-END/d" \
319 -e "/BT-BEGIN/d" -e "/BT-END/d" \
320 -e "/NFS-BEGIN/d" -e "/NFS-END/d" \
321 -e "/NOCAT-BEGIN/d" -e "/NOCAT-END/d"\
322 -e "/NGINX-BEGIN/d" -e "/NGINX-END/d"\
323 -e "/SNMP-BEGIN/d" -e "/SNMP-END/d"\
324 -e "/SDHC-BEGIN/d" -e "/SDHC-END/d"\
325 -e "/HFS-BEGIN/d" -e "/HFS-END/d"\
326 -e "/DNSCRYPT-BEGIN/d" -e "/DNSCRYPT-END/d"\
327 -e "/DNSSEC-BEGIN/d" -e "/DNSSEC-END/d"\
328 -e "/TOR-BEGIN/d" -e "/TOR-END/d"\
329 -e "/TINC-BEGIN/d" -e "/TINC-END/d"\
330 -e "/PARAGON-BEGIN/d" -e "/PARAGON-END/d"\
331 -e "/TUXERA-BEGIN/d" -e "/TUXERA-END/d"\
332 -e "/MICROSD-BEGIN/d" -e "/MICROSD-END/d"\
333 || true; \
334 done
336 # make sure old and debugging crap is gone
337 @rm -f $(INSTALLDIR)/www/debug.js
338 @rm -f $(INSTALLDIR)/www/*-x.*
339 @rm -f $(INSTALLDIR)/www/*-old.*
340 @rm -f $(INSTALLDIR)/www/color.css
342 chmod 0644 $(INSTALLDIR)/www/*
344 # remove C-style comments from java files. All "control" comments have been processed by now.
345 for F in $(wildcard *.js *.jsx); do \
346 [ -f $(INSTALLDIR)/www/$$F ] && $(TOP)/www/remcoms2.sh $(INSTALLDIR)/www/$$F c; \
347 done