LINUX_KSRC_MODULE = /lib/modules/$(shell uname -r)/kernel/drivers/net/wireless/
RTL8187B_DIR = $(shell pwd)
KVER  = $(shell uname -r)
KSRC = /lib/modules/$(KVER)/build
HAL_SUB_DIR = rtl8187


all: 
ifeq ($(shell uname -r|cut -d. -f1,2), 2.4)
	@make -C $(RTL8187B_DIR)/ieee80211
	@make -C $(RTL8187B_DIR)/rtl8187 
else	
	@make -C $(KSRC) SUBDIRS=$(RTL8187B_DIR)/ieee80211 modules 
	@cp $(RTL8187B_DIR)/ieee80211/Module.symvers $(RTL8187B_DIR)/rtl8187 
	@make -C $(KSRC) SUBDIRS=$(RTL8187B_DIR)/rtl8187 modules 
endif
install:
	#@grep rtl8187.ko /lib/modules/$(shell uname -r)/modules.dep && rm -fr $(LINUX_KSRC_MODULE)/rtl8187.ko 
	@cp $(RTL8187B_DIR)/RadioPower.sh /etc/acpi/events/
	@make -C ieee80211/ install
	@make -C rtl8187/ install
uninstall:
	@make -C ieee80211/ uninstall
	@make -C rtl8187/ uninstall
clean:
	@make -C rtl8187/ clean
	@make -C ieee80211/ clean
