Merge branch 'tomato-ND-usbmod-base' into tomato-ND-USBmod
[tomato.git] / release / src / router / www / Makefile
blobbed3966f8ab11cea43bdda064f1a4f0926fdfb21
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 -> nv().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
38 # Only include the FTP pages if FTP Server is configured in.
39 ifneq ($(TCONFIG_FTP),y)
40 rm -f $(INSTALLDIR)/www/nas-ftp.asp
41 sed -i $(INSTALLDIR)/www/tomato.js -e "/FTP-BEGIN/,/FTP-END/d"
42 endif
43 # Only include the Samba pages if Samba is configured in.
44 ifneq ($(TCONFIG_SAMBASRV),y)
45 rm -f $(INSTALLDIR)/www/nas-samba.asp
46 sed -i $(INSTALLDIR)/www/tomato.js -e "/SAMBA-BEGIN/,/SAMBA-END/d"
47 endif
48 # Only include the CIFS pages if CIFS is configured in.
49 ifneq ($(TCONFIG_CIFS),y)
50 rm -f $(INSTALLDIR)/www/admin-cifs.asp
51 sed -i $(INSTALLDIR)/www/tomato.js -e "/CIFS-BEGIN/,/CIFS-END/d"
52 endif
53 # Only include the Zebra options if Zebra is configured in.
54 ifneq ($(TCONFIG_ZEBRA),y)
55 sed -i $(INSTALLDIR)/www/advanced-routing.asp -e "/ZEBRA-BEGIN/,/ZEBRA-END/d"
56 endif
57 sed -i "/ZEBRA-BEGIN/d" $(INSTALLDIR)/www/advanced-routing.asp
58 sed -i "/ZEBRA-END/d" $(INSTALLDIR)/www/advanced-routing.asp
60 # Only include extra themes if USB Extras are configured in.
61 ifneq ($(TCONFIG_USB_EXTRAS),y)
62 rm -f $(INSTALLDIR)/www/usbred.css
63 rm -f $(INSTALLDIR)/www/usbblue.css
64 rm -f $(INSTALLDIR)/www/tomatousb.png
65 rm -f $(INSTALLDIR)/www/tomatousb_bg.png
66 sed -i $(INSTALLDIR)/www/admin-access.asp -e "/THEMES-BEGIN/,/THEMES-END/d"
67 endif
68 sed -i "/THEMES-BEGIN/d" $(INSTALLDIR)/www/admin-access.asp
69 sed -i "/THEMES-END/d" $(INSTALLDIR)/www/admin-access.asp
70 # Only include NTFS settings if NTFS support is configured in.
71 ifneq ($(TCONFIG_NTFS),y)
72 sed -i $(INSTALLDIR)/www/nas-usb.asp -e "/NTFS-BEGIN/,/NTFS-END/d"
73 endif
74 sed -i "/NTFS-BEGIN/d" $(INSTALLDIR)/www/nas-usb.asp
75 sed -i "/NTFS-END/d" $(INSTALLDIR)/www/nas-usb.asp
77 # Only include the USB and NAS pages if USB Support is configured in.
78 ifneq ($(TCONFIG_USB),y)
79 rm -f $(INSTALLDIR)/www/nas-*.asp
80 sed -i $(INSTALLDIR)/www/tomato.js -e "/USB-BEGIN/,/USB-END/d"
81 sed -i $(INSTALLDIR)/www/admin-buttons.asp -e "/USB-BEGIN/,/USB-END/d"
82 endif
83 sed -i "/USB-BEGIN/d" $(INSTALLDIR)/www/admin-buttons.asp
84 sed -i "/USB-END/d" $(INSTALLDIR)/www/admin-buttons.asp
86 # make sure old and debugging crap is gone
87 @rm -f $(INSTALLDIR)/www/debug.js
88 @rm -f $(INSTALLDIR)/www/*-x.*
89 @rm -f $(INSTALLDIR)/www/*-old.*
90 @rm -f $(INSTALLDIR)/www/color.css
92 chmod 0644 $(INSTALLDIR)/www/*
94 # remove C-style comments from java files. All "control" comments have been processed by now.
95 for F in $(wildcard *.js *.jsx); do \
96 $(TOP)/www/remcoms2.sh $(INSTALLDIR)/www/$$F c; \
97 done