Merge Tomato 1.26
[tomato.git] / release / src / router / www / Makefile
blobfd66bc5bc98e6d27363de8b2bc43630083e8b20a
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 "/^$$/d" \
34 -e "/^<!--$$/,/^-->$$/! { s,^\s\+, , }" $$F > $(INSTALLDIR)/www/$$F; \
35 done
36 # Only include the FTP pages if FTP Server is configured in.
37 ifneq ($(TCONFIG_FTP),y)
38 rm -f $(INSTALLDIR)/www/nas-ftp.asp
39 sed -i $(INSTALLDIR)/www/tomato.js -e "/FTP-BEGIN/,/FTP-END/d"
40 endif
41 # Only include the Samba pages if Samba is configured in.
42 ifneq ($(TCONFIG_SAMBASRV),y)
43 rm -f $(INSTALLDIR)/www/nas-samba.asp
44 sed -i $(INSTALLDIR)/www/tomato.js -e "/SAMBA-BEGIN/,/SAMBA-END/d"
45 endif
46 # Only include the CIFS pages if CIFS is configured in.
47 ifneq ($(TCONFIG_CIFS),y)
48 rm -f $(INSTALLDIR)/www/admin-cifs.asp
49 sed -i $(INSTALLDIR)/www/tomato.js -e "/CIFS-BEGIN/,/CIFS-END/d"
50 endif
51 # Only include the Zebra options if Zebra is configured in.
52 ifneq ($(TCONFIG_ZEBRA),y)
53 sed -i $(INSTALLDIR)/www/advanced-routing.asp -e "/ZEBRA-BEGIN/,/ZEBRA-END/d"
54 endif
55 sed -i "/ZEBRA-BEGIN/d" $(INSTALLDIR)/www/advanced-routing.asp
56 sed -i "/ZEBRA-END/d" $(INSTALLDIR)/www/advanced-routing.asp
58 # Only include extra themes if USB Extras are configured in.
59 ifneq ($(TCONFIG_USB_EXTRAS),y)
60 rm -f $(INSTALLDIR)/www/usbred.css
61 rm -f $(INSTALLDIR)/www/usbblue.css
62 rm -f $(INSTALLDIR)/www/tomatousb.png
63 rm -f $(INSTALLDIR)/www/tomatousb_bg.png
64 sed -i $(INSTALLDIR)/www/admin-access.asp -e "/THEMES-BEGIN/,/THEMES-END/d"
65 endif
66 sed -i "/THEMES-BEGIN/d" $(INSTALLDIR)/www/admin-access.asp
67 sed -i "/THEMES-END/d" $(INSTALLDIR)/www/admin-access.asp
68 # Only include NTFS settings if NTFS support is configured in.
69 ifneq ($(TCONFIG_NTFS),y)
70 sed -i $(INSTALLDIR)/www/nas-usb.asp -e "/NTFS-BEGIN/,/NTFS-END/d"
71 endif
72 sed -i "/NTFS-BEGIN/d" $(INSTALLDIR)/www/nas-usb.asp
73 sed -i "/NTFS-END/d" $(INSTALLDIR)/www/nas-usb.asp
75 # Only include the USB and NAS pages if USB Support is configured in.
76 ifneq ($(TCONFIG_USB),y)
77 rm -f $(INSTALLDIR)/www/nas-*.asp
78 sed -i $(INSTALLDIR)/www/tomato.js -e "/USB-BEGIN/,/USB-END/d"
79 sed -i $(INSTALLDIR)/www/admin-buttons.asp -e "/USB-BEGIN/,/USB-END/d"
80 endif
81 sed -i "/USB-BEGIN/d" $(INSTALLDIR)/www/admin-buttons.asp
82 sed -i "/USB-END/d" $(INSTALLDIR)/www/admin-buttons.asp
85 ifeq ($(TOMATO_EXPERIMENTAL),1)
86 cd $(INSTALLDIR)/www && \
87 for F in $(wildcard *.asp); do \
88 sed -e "s,<div class='title'>Tomato</div>,<div class='title'>Tomato <small><i>(beta)</i></small></div>," $$F > $$F.tmp; \
89 mv $$F.tmp $$F; \
90 done
91 endif
95 # make sure old and debugging crap is gone
96 @rm -f $(INSTALLDIR)/www/debug.js
97 @rm -f $(INSTALLDIR)/www/*-x.*
98 @rm -f $(INSTALLDIR)/www/*-old.*
99 @rm -f $(INSTALLDIR)/www/color.css
101 chmod 0644 $(INSTALLDIR)/www/*