all: 
	@echo usage: make [536] 
	@echo or [clean] or 
	@echo or [install]

clean:
	cd coredrv; make clean
	rm -f *.o *.ko

install:
	rm -f /etc/hamregistry.bin
	bash Intel536_inst

uninstall:
	echo Uninstalling on system V boot like only.
	rm -f /etc/init.d/536ep_boot
	rm -f /etc/hamregistry.bin
	rm -f /etc/init.d/Intel536_boot
	rmmod Intel536

check:
	@bash config_check

config_sync:
	mv /lib/modules/`uname -r`/build/include/linux/version.h version.bak
	mv /lib/modules/`uname -r`/build/include/linux/autoconf.h autoconf.bak
	cp /boot/vmlinuz.version.h /lib/modules/`uname -r`/build/include/linux/version.h
	cp /boot/vmlinuz.autoconf.h /lib/modules/`uname -r`/build/include/linux/autoconf.h

536: check
	uname -r|grep "2.6" && \
	cd coredrv && make 536core_26 && \
	cp Intel536.ko .. && cd .. && \
	strip --strip-debug Intel536.ko && \
	exit; \
	ls Intel536.ko >/dev/null 2>&1 ||  uname -r | grep "2.6" && echo "Failed to build driver" && exit; \
	if [ $(KERNEL_SOURCE_PATH) ]; then \
	cd coredrv; make TARGET=TARGET_SELAH KERNEL_SOURCE_PATH=$(KERNEL_SOURCE_PATH) "PSTN_DEF=-DTARGET_SELAH -DTARGET_LINUX -DLINUX" 536core; \
	else \
	cd coredrv; make TARGET=TARGET_SELAH KERNEL_INCLUDES=/lib/modules/`uname -r`/build/include \
       "PSTN_DEF=-DTARGET_SELAH -DTARGET_LINUX -DLINUX" 536core; \
        fi ; \
	cp Intel536.o .. ; \
	if [ -a /boot/vmlinuz.version.h ]; then \
        cp /boot/vmlinuz.version.h /lib/modules/`uname -r`/build/include/linux/version.h;\
        fi
