
KERNEL_DIR:=/lib/modules/$(shell uname -r)/build
SUBLEVEL:=$(shell echo $(KERNEL_DIR) | cut -d. -f3 | cut -d. -f1 | cut -d-  -f1)
# support begins at SUBLEVEL 20
after20:=$(shell if [ "$(SUBLEVEL)" -gt 20 ] ;then echo OK; fi)

ifdef after20
all: 
	$(MAKE) -C kmodule/ modules
	$(MAKE) -C modem/ all
#	$(MAKE) -C utils/ ptytosock

install:
	$(MAKE) -C kmodule/ install
	$(MAKE) -C modem/ install

else
20less:
	@echo "$(SUBLEVEL)"
	@echo "$(after20)"
	@echo "The martian_dev.ko driver and the complementary helper martian_helper are for use with kernels after 2.6.20. Use the martian-20080407.tar.gz for earlier kernels."
 
endif

clean:
	$(MAKE) -C kmodule/ clean
	$(MAKE) -C modem/ clean
