rc: support for Broadcom EMF and IGMP snooping in K26 builds (except Mini/Lite)
[tomato.git] / release / src / router / www / Makefile
blob6260656578cd0b23fe80917aaff8c793f1c3f71c
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 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 # Only include IPv6 options if IPv6 is configured in.
104 ifneq ($(TCONFIG_IPV6),y)
105 sed -i $(INSTALLDIR)/www/tomato.js -e "/IPV6-BEGIN/,/IPV6-END/d"
106 sed -i $(INSTALLDIR)/www/basic-network.asp -e "/IPV6-BEGIN/,/IPV6-END/d"
107 endif
109 # Only include the USB and NAS pages if USB Support is configured in.
110 ifneq ($(TCONFIG_USB),y)
111 rm -f $(INSTALLDIR)/www/nas-*.*
112 sed -i $(INSTALLDIR)/www/tomato.js -e "/USB-BEGIN/,/USB-END/d"
113 sed -i $(INSTALLDIR)/www/admin-buttons.asp -e "/USB-BEGIN/,/USB-END/d"
114 sed -i $(INSTALLDIR)/www/admin-access.asp -e "/USB-BEGIN/,/USB-END/d"
115 sed -i $(INSTALLDIR)/www/about.asp -e "/USB-BEGIN/,/USB-END/d"
116 endif
119 ifeq ($(TOMATO_EXPERIMENTAL),1)
120 cd $(INSTALLDIR)/www && \
121 for F in $(wildcard *.asp); do \
122 sed -e "s,<div class='title'>Tomato</div>,<div class='title'>Tomato <small><i>(beta)</i></small></div>," $$F > $$F.tmp; \
123 mv $$F.tmp $$F; \
124 done
125 endif
129 # Only include the vpn pages if OpenVPN is compiled in
130 # Remove AES ciphers from the GUI if openssl doesn't have an AES directory
131 ifeq ($(TCONFIG_OPENVPN),y)
132 test -d ../openssl/crypto/aes || sed -i $(INSTALLDIR)/www/vpn.js -e "/AES-BEGIN/,/AES-END/d"
133 else
134 rm -f $(INSTALLDIR)/www/vpn*
135 sed -i $(INSTALLDIR)/www/tomato.js -e "/VPN-BEGIN/,/VPN-END/d"
136 sed -i $(INSTALLDIR)/www/about.asp -e "/VPN-BEGIN/,/VPN-END/d"
137 sed -i $(INSTALLDIR)/www/admin-access.asp -e "/VPN-BEGIN/,/VPN-END/d"
138 endif
141 # clean up
142 cd $(INSTALLDIR)/www && \
143 for F in $(wildcard *.asp *.js); do \
144 [ -f $(INSTALLDIR)/www/$$F ] && sed -i $$F \
145 -e "/LINUX26-BEGIN/d" -e "/LINUX26-END/d" \
146 -e "/USB-BEGIN/d" -e "/USB-END/d" \
147 -e "/NTFS-BEGIN/d" -e "/NTFS-END/d" \
148 -e "/SAMBA-BEGIN/d" -e "/SAMBA-END/d" \
149 -e "/FTP-BEGIN/d" -e "/FTP-END/d" \
150 -e "/MEDIA-SRV-BEGIN/d" -e "/MEDIA-SRV-END/d" \
151 -e "/THEMES-BEGIN/d" -e "/THEMES-END/d" \
152 -e "/JFFS2-BEGIN/d" -e "/JFFS2-END/d" \
153 -e "/CIFS-BEGIN/d" -e "/CIFS-END/d" \
154 -e "/ZEBRA-BEGIN/d" -e "/ZEBRA-END/d" \
155 -e "/EMF-BEGIN/d" -e "/EMF-END/d" \
156 -e "/VPN-BEGIN/d" -e "/VPN-END/d" \
157 -e "/AES-BEGIN/d" -e "/AES-END/d" \
158 -e "/IPV6-BEGIN/d" -e "/IPV6-END/d" \
159 || true; \
160 done
162 # make sure old and debugging crap is gone
163 @rm -f $(INSTALLDIR)/www/debug.js
164 @rm -f $(INSTALLDIR)/www/*-x.*
165 @rm -f $(INSTALLDIR)/www/*-old.*
166 @rm -f $(INSTALLDIR)/www/color.css
168 chmod 0644 $(INSTALLDIR)/www/*
170 # remove C-style comments from java files. All "control" comments have been processed by now.
171 for F in $(wildcard *.js *.jsx); do \
172 [ -f $(INSTALLDIR)/www/$$F ] && $(TOP)/www/remcoms2.sh $(INSTALLDIR)/www/$$F c; \
173 done