###########################################################################
# File level history, record changes for this file here.
#
# v 0.0.0 10 Aug 2011 by Golden Wang
#   Give support to linux kernel 2.6.x
################################################################
PACKAGE = 'ixisa'
VERSION = '0.17.0'

all: modules libary example tool

modules:
	cd driver/;\
	make
tool:
	@if [ -e utility/Makefile ]; then      \
	cd utility/;                           \
	make;                                   \
	fi

example:
	@if [ -e examples/Makefile ]; then      \
	cd examples/;				\
	make;					\
	fi

libary:
	@if [ -e lib/Makefile ]; then           \
	cd lib/;				\
	make;					\
	fi

clean:
	$(MAKE) -C driver/ clean
	@if [ -e examples/Makefile ]; then      \
	$(MAKE) -C examples/ clean;		\
	fi
	@if [ -e lib/Makefile ]; then		\
	$(MAKE) -C lib/ clean;			\
	fi

distclean:
	@if [ -e examples/Makefile ]; then	\
	$(MAKE) -C examples/ distclean;		\
	fi
	@if [ -e utility/Makefile ]; then       \
	$(MAKE) -C utility/ distclean;              \
	fi
	@if [ -e lib/Makefile ]; then		\
	$(MAKE) -C lib/ distclean;		\
	rm -f lib/*.a;				\
	rm -f lib/*.so lib/*.so.*;		\
	fi
	@if [ -e driver/Makefile ]; then	\
        $(MAKE) -C driver/ distclean;		\
        fi	

package:
	cd .. && rm -f $(PACKAGE)-$(VERSION) last && ln -s `basename $(CURDIR)` $(PACKAGE)-$(VERSION) && ln -s $(PACKAGE)-$(VERSION) last
	./mkdist omega $(PACKAGE) $(VERSION)
	rm -f ../$(PACKAGE)-$(VERSION)*.tar.gz
	$(MAKE) distclean
	cd .. && tar -cf - $(PACKAGE)-$(VERSION)/. | gzip --best -c > $(PACKAGE)-$(VERSION).tar.gz
