# Make file for diff/simple_nas/neutral
#-----------------------------------------------------
TOPDIR  :=  $(shell /bin/pwd)
TOPDIR  :=  $(TOPDIR)/../../..
#-----------------------------------------------------

.PHONY:  link-files

all: link-files
#====================================================================
# 1. Copy constant.h to include/
	@if cmp -s constant.h $(TOPDIR)/include/constant.h      ;   \
        then                                                        \
            echo "Same constant.h"                              ;   \
        else                                                        \
            echo "Copying constant.h to $(TOPDIR)/include ..."  ;   \
            cp -f constant.h $(TOPDIR)/include/constant.h       ;   \
        fi
#====================================================================
# 2. Copy html-src to thttpd-2.23beta1/html-src
	mkdir -p $(TOPDIR)/thttpd-2.23beta1/html-src
	cp -af ./html-src/html* $(TOPDIR)/thttpd-2.23beta1/html-src/
	cp -af ./html-src/thumb* $(TOPDIR)/thttpd-2.23beta1/html-src/

install:
	@make rami

rami:
# Copy everything in source/ramdisk to realy ramdisk
	cp ramdisk/* $(TOPDIR)/../ramdisk/ -rf
# Delete CVS/ dir 
	find $(TOPDIR)/../ramdisk -name CVS -type d | xargs rm -rf

link-files:
	if [ ! -e ramdisk/home/httpd/html/SHARE ] ; then  \
		cd ramdisk/home/httpd/html ; ln -sf /harddisk/ SHARE ; ln -sf /etc/device.xml device.xml; cd -; \
        fi
	cd ramdisk/home/httpd/html/Down/ ; ln -sf download.cgi download_ui.cgi;ln -sf download.cgi download_job.cgi; ln -sf download.cgi download_status.cgi; ln -sf ../heading.JPG heading.JPG; ln -sf ../title.gif title.gif; cd - ; 
#	cd ramdisk/home/httpd/html/Down/.help ; ln -sf ../../index.cgi help.cgi; cd - ;
	cd ramdisk/home/httpd/html/Files/ ; ln -sf ../heading.JPG heading.JPG; ln -sf ../title.gif title.gif; cd - ;
#	cd ramdisk/home/httpd/html/Files/.help ; ln -sf ../../index.cgi help.cgi; cd - ;
	cd ramdisk/home/httpd/html/Photo ;ln -sf /etc/photo_album Files; ln -s /etc/background.mp3 background.mp3 ;ln -sf photo.cgi photo_upload.cgi; cd - ;
	cd ramdisk/home/httpd/html/Management ; ln -sf /etc/.htpasswd .htpasswd ; ln -sf ../std.css std.css; ln -sf utility.cgi mode.cgi; ln -sf /etc/config.bin config.bin; cd - ;
	cd ramdisk/home/httpd/html ; ln -sf index.cgi lang.cgi; cd - ;

            
