# Makefile

CC := cc

include ./config.mk

install:
	@echo "========= Install RT2400 device driver and utility ========="
	@if [ "$(SOURCE_PLATFORM)" = "" ] ; then \
		echo "Sorry! Please run 'make config' first!" ; \
		echo " " ; \
		exit 1 ; \
	fi
	@cd $(SOURCE_PLATFORM) && make install
	@if [ ! -f /etc/sysconfig/network-scripts/ifcfg-ra0 ]; then \
		echo "Create 'ifcfg-ra0' in /etc/sysconfig/network-scripts/"; \
		cp ./script/ifcfg-ra0 /etc/sysconfig/network-scripts/ ; \
	fi
	@if ! grep 'ra0' /etc/modules.conf ; then \
		echo "append 'alias ra0 rt2400' to /etc/modules.conf"; \
		echo "alias ra0 rt2400" >> /etc/modules.conf ; \
	fi	
	@./script/setupui
	@echo "Install done!"
	@echo "============================================================"
	@echo ""
	
uninstall:
	@echo "========= Uninstall RT2400 device driver and utility ========="	
	@if [ "$(SOURCE_PLATFORM)" = "" ] ; then \
		exit 1 ; \
	fi
	@cd $(SOURCE_PLATFORM) && make uninstall	
	@./script/clearui
	@/sbin/ifconfig ra0 down
	@/sbin/rmmod rt2400
	@echo "done"    
	@echo "=============================================================="
	
config:
	@touch config.mk
	@./Configure

