Added SDHC support with GUI
[tomato.git] / release / src / router / www / Makefile
blob874a325a9daf02231a1d39e7ccc2c7d57c3f72f4
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 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 endif
47 # Only include the CIFS pages if CIFS is configured in.
48 ifneq ($(TCONFIG_CIFS),y)
49 rm -f $(INSTALLDIR)/www/admin-cifs.asp
50 sed -i $(INSTALLDIR)/www/tomato.js -e "/CIFS-BEGIN/,/CIFS-END/d"
51 sed -i $(INSTALLDIR)/www/admin-bwm.asp -e "/CIFS-BEGIN/,/CIFS-END/d"
52 sed -i $(INSTALLDIR)/www/nas-media.asp -e "/CIFS-BEGIN/,/CIFS-END/d"
53 endif
55 # Only include the JFFS pages if JFFS is configured in.
56 ifneq ($(TCONFIG_JFFS2),y)
57 rm -f $(INSTALLDIR)/www/admin-jffs2.asp
58 sed -i $(INSTALLDIR)/www/tomato.js -e "/JFFS2-BEGIN/,/JFFS2-END/d"
59 sed -i $(INSTALLDIR)/www/admin-bwm.asp -e "/JFFS2-BEGIN/,/JFFS2-END/d"
60 sed -i $(INSTALLDIR)/www/admin-upgrade.asp -e "/JFFS2-BEGIN/,/JFFS2-END/d"
61 sed -i $(INSTALLDIR)/www/nas-media.asp -e "/JFFS2-BEGIN/,/JFFS2-END/d"
62 endif
64 # Only include the Zebra options if Zebra is configured in.
65 ifneq ($(TCONFIG_ZEBRA),y)
66 sed -i $(INSTALLDIR)/www/advanced-routing.asp -e "/ZEBRA-BEGIN/,/ZEBRA-END/d"
67 endif
69 # Only include EMF options if EMF is configured in.
70 ifneq ($(TCONFIG_EMF),y)
71 sed -i $(INSTALLDIR)/www/advanced-routing.asp -e "/EMF-BEGIN/,/EMF-END/d"
72 endif
74 # Only include extra themes if USB Extras are configured in.
75 # ifneq ($(TCONFIG_USB_EXTRAS),y)
76 # rm -f $(INSTALLDIR)/www/usbred.css
77 # rm -f $(INSTALLDIR)/www/usbblue.css
78 # rm -f $(INSTALLDIR)/www/tomatousb.png
79 # rm -f $(INSTALLDIR)/www/tomatousb_bg.png
80 # sed -i $(INSTALLDIR)/www/admin-access.asp -e "/THEMES-BEGIN/,/THEMES-END/d"
81 # endif
83 # Only include NTFS settings if NTFS support is configured in.
84 ifneq ($(TCONFIG_NTFS),y)
85 sed -i $(INSTALLDIR)/www/nas-usb.asp -e "/NTFS-BEGIN/,/NTFS-END/d"
86 endif
87 # Only include the FTP pages if FTP Server is configured in.
88 ifneq ($(TCONFIG_FTP),y)
89 rm -f $(INSTALLDIR)/www/nas-ftp.asp
90 sed -i $(INSTALLDIR)/www/tomato.js -e "/FTP-BEGIN/,/FTP-END/d"
91 endif
92 # Only include the Samba pages if Samba is configured in.
93 ifneq ($(TCONFIG_SAMBASRV),y)
94 rm -f $(INSTALLDIR)/www/nas-samba.asp
95 sed -i $(INSTALLDIR)/www/tomato.js -e "/SAMBA-BEGIN/,/SAMBA-END/d"
96 endif
97 # Only include the Media Server pages if Media Server is configured in.
98 ifneq ($(TCONFIG_MEDIA_SERVER),y)
99 rm -f $(INSTALLDIR)/www/nas-media.asp
100 sed -i $(INSTALLDIR)/www/tomato.js -e "/MEDIA-SRV-BEGIN/,/MEDIA-SRV-END/d"
101 endif
103 # Victek for RAF verion
104 # Only include Captive Portal menu option and pages when configured.
105 ifneq ($(TCONFIG_NOCAT),y)
106 rm -f $(INSTALLDIR)/www/new-splashd.asp
107 rm -f $(INSTALLDIR)/www/splash.html
108 sed -i $(INSTALLDIR)/www/tomato.js -e "/NOCAT-BEGIN/,/NOCAT-END/d"
109 endif
111 # Only include IPv6 options if IPv6 is configured in.
112 ifneq ($(TCONFIG_IPV6),y)
113 cd $(INSTALLDIR)/www && \
114 for F in $(wildcard *.asp *.js *.jsx); do \
115 [ -f $(INSTALLDIR)/www/$$F ] && sed -i $$F \
116 -e "/IPV6-BEGIN/,/IPV6-END/d" \
117 || true; \
118 done
119 rm -f $(INSTALLDIR)/www/basic-ipv6.asp
120 endif
122 # Only include the Transmission binary path select if Transmission binaries is configured in.
123 ifneq ($(TCONFIG_BBT),y)
124 sed -i $(INSTALLDIR)/www/nas-bittorrent.asp -e "/BBT-BEGIN/,/BBT-END/d"
125 sed -i $(INSTALLDIR)/www/about.asp -e "/BBT-BEGIN/,/BBT-END/d"
126 endif
128 # Only include the Transmission pages if Transmission is configured in.
129 ifneq ($(TCONFIG_BT),y)
130 rm -f $(INSTALLDIR)/www/nas-bittorrent.asp
131 sed -i $(INSTALLDIR)/www/tomato.js -e "/BT-BEGIN/,/BT-END/d"
132 sed -i $(INSTALLDIR)/www/about.asp -e "/BT-BEGIN/,/BT-END/d"
133 endif
136 # Only include the USB and NAS pages if USB Support is configured in.
137 ifneq ($(TCONFIG_USB),y)
138 rm -f $(INSTALLDIR)/www/nas-*.*
139 sed -i $(INSTALLDIR)/www/tomato.js -e "/USB-BEGIN/,/USB-END/d"
140 sed -i $(INSTALLDIR)/www/admin-buttons.asp -e "/USB-BEGIN/,/USB-END/d"
141 sed -i $(INSTALLDIR)/www/admin-access.asp -e "/USB-BEGIN/,/USB-END/d"
142 sed -i $(INSTALLDIR)/www/about.asp -e "/USB-BEGIN/,/USB-END/d"
143 endif
145 # Only include CTF option if CTF module exists
146 ## test -d $(SRCBASE)/ctf/linux ||
147 sed -i $(INSTALLDIR)/www/advanced-misc.asp -e "/CTF-BEGIN/,/CTF-END/d"
151 ifeq ($(TOMATO_EXPERIMENTAL),1)
152 cd $(INSTALLDIR)/www && \
153 for F in $(wildcard *.asp); do \
154 sed -e "s,<div class='title'>Tomato</div>,<div class='title'>Tomato <small><i>(beta)</i></small></div>," $$F > $$F.tmp; \
155 mv $$F.tmp $$F; \
156 done
157 endif
159 cd $(INSTALLDIR)/www && \
160 for F in $(wildcard *.asp); do \
161 sed -e "s,<div class='version'>Version <% version(); %></div>,<div class='version'>Version <% version(); %> RAF by shibby</div>," $$F > $$F.tmp; \
162 mv $$F.tmp $$F; \
163 done
166 # Only include the vpn pages if OpenVPN is compiled in
167 # Remove AES ciphers from the GUI if openssl doesn't have an AES directory
168 ifeq ($(TCONFIG_OPENVPN),y)
169 test -d ../openssl/crypto/aes || sed -i $(INSTALLDIR)/www/vpn.js -e "/AES-BEGIN/,/AES-END/d"
170 else
171 rm -f $(INSTALLDIR)/www/vpn*
172 sed -i $(INSTALLDIR)/www/tomato.js -e "/VPN-BEGIN/,/VPN-END/d"
173 sed -i $(INSTALLDIR)/www/about.asp -e "/VPN-BEGIN/,/VPN-END/d"
174 sed -i $(INSTALLDIR)/www/admin-access.asp -e "/VPN-BEGIN/,/VPN-END/d"
175 endif
177 # Only include the nfs pages if NFS is compiled in
178 ifneq ($(TCONFIG_NFS),y)
179 rm -f $(INSTALLDIR)/www/admin-nfs.asp
180 sed -i $(INSTALLDIR)/www/tomato.js -e "/NFS-BEGIN/,/NFS-END/d"
181 sed -i $(INSTALLDIR)/www/about.asp -e "/NFS-BEGIN/,/NFS-END/d"
182 endif
184 # Only include the snmp pages if SNMP is compiled in
185 ifneq ($(TCONFIG_SNMP),y)
186 rm -f $(INSTALLDIR)/www/admin-snmp.asp
187 sed -i $(INSTALLDIR)/www/tomato.js -e "/SNMP-BEGIN/,/SNMP-END/d"
188 sed -i $(INSTALLDIR)/www/about.asp -e "/SNMP-BEGIN/,/SNMP-END/d"
189 endif
191 # Only include the mmc pages if SDHC is compiled in
192 ifneq ($(TCONFIG_SDHC),y)
193 rm -f $(INSTALLDIR)/www/admin-sdhc.asp
194 sed -i $(INSTALLDIR)/www/tomato.asp -e "/SDHC-BEGIN/,/SDHC-END/d"
195 sed -i $(INSTALLDIR)/www/about.asp -e "/SDHC-BEGIN/,/SDHC-END/d"
196 endif
198 # clean up
199 cd $(INSTALLDIR)/www && \
200 for F in $(wildcard *.asp *.js *.jsx *.html); do \
201 [ -f $(INSTALLDIR)/www/$$F ] && sed -i $$F \
202 -e "/LINUX26-BEGIN/d" -e "/LINUX26-END/d" \
203 -e "/USB-BEGIN/d" -e "/USB-END/d" \
204 -e "/NTFS-BEGIN/d" -e "/NTFS-END/d" \
205 -e "/SAMBA-BEGIN/d" -e "/SAMBA-END/d" \
206 -e "/FTP-BEGIN/d" -e "/FTP-END/d" \
207 -e "/MEDIA-SRV-BEGIN/d" -e "/MEDIA-SRV-END/d" \
208 -e "/THEMES-BEGIN/d" -e "/THEMES-END/d" \
209 -e "/JFFS2-BEGIN/d" -e "/JFFS2-END/d" \
210 -e "/CIFS-BEGIN/d" -e "/CIFS-END/d" \
211 -e "/ZEBRA-BEGIN/d" -e "/ZEBRA-END/d" \
212 -e "/EMF-BEGIN/d" -e "/EMF-END/d" \
213 -e "/VPN-BEGIN/d" -e "/VPN-END/d" \
214 -e "/AES-BEGIN/d" -e "/AES-END/d" \
215 -e "/IPV6-BEGIN/d" -e "/IPV6-END/d" \
216 -e "/CTF-BEGIN/d" -e "/CTF-END/d" \
217 -e "/BBT-BEGIN/d" -e "/BBT-END/d" \
218 -e "/BT-BEGIN/d" -e "/BT-END/d" \
219 -e "/NFS-BEGIN/d" -e "/NFS-END/d" \
220 -e "/NOCAT-BEGIN/d" -e "/NOCAT-END/d"\
221 -e "/SNMP-BEGIN/d" -e "/SNMP-END/d"\
222 -e "/SDHC-BEGIN/d" -e "/SDHC-END/d"\
223 || true; \
224 done
226 # make sure old and debugging crap is gone
227 @rm -f $(INSTALLDIR)/www/debug.js
228 @rm -f $(INSTALLDIR)/www/*-x.*
229 @rm -f $(INSTALLDIR)/www/*-old.*
230 @rm -f $(INSTALLDIR)/www/color.css
232 chmod 0644 $(INSTALLDIR)/www/*
234 # remove C-style comments from java files. All "control" comments have been processed by now.
235 for F in $(wildcard *.js *.jsx); do \
236 [ -f $(INSTALLDIR)/www/$$F ] && $(TOP)/www/remcoms2.sh $(INSTALLDIR)/www/$$F c; \
237 done