Merge branch 'tomato-ND-usbmod-vpn' into tomato-ND-USBmod
[tomato.git] / release / src / router / www / Makefile
blob2b0d3406ef33605286a2085986737a3477fc333d
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 *.{js,jsx}; do \
17 sed '/^\/\*\s*$$/,/\*\//! { s/^\s\+//; s/\s\+$$//; /^\/\/ --\+\s*/d; /^$$/d }' < $$F > $(INSTALLDIR)/www/$$F; \
18 done
20 for F in *.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 -> nv().css, remove comments
25 # in between REMOVE-BEGIN and REMOVE-END, and compress whitespace
27 for F in *.{asp,svg}; do \
28 sed -e "/REMOVE-BEGIN/,/REMOVE-END/d" \
29 -e "s,<script[^>]\+debug\.js[^>]\+></script>,," \
30 -e "s,color\.css,<% nv('web_css'); %>\.css," \
31 -e "s,<!-- / / / -->,," \
32 -e "s,\x0d,," \
33 -e "s,^\s\+,," \
34 -e "/^$$/d" \
35 -e "/^<!--$$/,/^-->$$/! { s,^\s\+, , }" $$F > $(INSTALLDIR)/www/$$F; \
36 done
37 # Only include the FTP pages if FTP Server is configured in.
38 ifneq ($(TCONFIG_FTP),y)
39 rm -f $(INSTALLDIR)/www/nas-ftp.asp
40 sed -i $(INSTALLDIR)/www/tomato.js -e "/FTP-BEGIN/,/FTP-END/d"
41 endif
42 # Only include the Samba pages if Samba is configured in.
43 ifneq ($(TCONFIG_SAMBASRV),y)
44 rm -f $(INSTALLDIR)/www/nas-samba.asp
45 sed -i $(INSTALLDIR)/www/tomato.js -e "/SAMBA-BEGIN/,/SAMBA-END/d"
46 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 endif
52 # Only include extra themes if USB Extras are configured in.
53 ifneq ($(TCONFIG_USB_EXTRAS),y)
54 rm -f $(INSTALLDIR)/www/usbred.css
55 rm -f $(INSTALLDIR)/www/usbblue.css
56 rm -f $(INSTALLDIR)/www/tomatousb.png
57 rm -f $(INSTALLDIR)/www/tomatousb_bg.png
58 sed -i $(INSTALLDIR)/www/admin-access.asp -e "/THEMES-BEGIN/,/THEMES-END/d"
59 endif
61 # Only include the vpn pages in the navigation if OpenVPN is compiled in
62 ifneq ($(TCONFIG_OPENVPN),y)
63 sed -i $(INSTALLDIR)/www/tomato.js -e "/VPN-BEGIN/,/VPN-END/d"
64 rm -f $(INSTALLDIR)/www/vpn.js
65 rm -f $(INSTALLDIR)/www/vpn-client.asp
66 rm -f $(INSTALLDIR)/www/vpn-server.asp
67 endif
69 # make sure old and debugging crap is gone
70 @rm -f $(INSTALLDIR)/debug.js
71 @rm -f $(INSTALLDIR)/www/*-x.*
72 @rm -f $(INSTALLDIR)/www/*-old.*
73 @rm -f $(INSTALLDIR)/www/color.css
75 chmod 0644 $(INSTALLDIR)/www/*
77 # remove C-style comments from java files. All "control" comments have been processed by now.
78 for F in *.{js,jsx}; do \
79 $(TOP)/www/remcoms2.sh $(INSTALLDIR)/www/$$F c; \
80 done