PACKAGE = 'ixpci'
VERSION = '0.8.2'

all: modules libary example

modules:
	cd driver/;\
	make

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 driver/Makefile ]; then	\
        $(MAKE) -C driver/ distclean;		\
        fi	
	@if [ -e lib/Makefile ]; then        \
        $(MAKE) -C lib clean;           \
        $(MAKE) -C lib distclean;           \
        fi

release:
	rm -f lib/src/pcidio.c lib/src/pci180x.c lib/src/pcilanner.c

	rm -f lib/src/pisocan.c

	rm -f lib/src/pisocpm.c include/communication.h include/cpmglobal.h include/masterinfo.h include/threadfun.h
	
	rm -f lib/src/pisodnm.c include/dnmglobal.h include/dnmmaster_info.h include/dnmthreadfun.h include/connection_object.h include/internal_func.h include/maptable.h

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