VER=1.0.0
TMP=.

all: comment
	cd src20; make; cd ..

comment:
	@echo
	@echo Building gkrellsun for GKrellM version 2.2.x
	@echo 
	@echo NOTE: GKrellM 2.2.x is for GTK+ 2.4.x versions.
	@echo 

install: comment
	cd src20; make install; cd ..

distclean: clean

clean:
	cd src20; make clean; cd ..
	rm -f gkrellsun*.zip gkrellsun*.tar.gz

dist:
ifeq ($(VER),)
	@echo You must specify a version VER
else
	rm -rf $(TMP)/gkrellsun-$(VER)
	rm -f gkrellsun-$(VER).tar.gz
	rm -f gkrellsun-$(VER).zip
	mkdir $(TMP)/gkrellsun-$(VER)
	tar cf - --files-from MANIFEST | (cd $(TMP)/gkrellsun-$(VER); tar xf -)
	cd $(TMP) && tar cf - gkrellsun-$(VER) | gzip > gkrellsun-$(VER).tar.gz
	cd $(TMP) && zip -rpD gkrellsun-$(VER).zip gkrellsun-$(VER)
	rm -rf $(TMP)/gkrellsun-$(VER)

	@echo
	@echo "gkrellsun-$(VER).tar.gz/.zip files are located in $(TMP)"
	@echo
endif

oldzip:
ifeq ($(ZIPVER),)
	@echo You must specify ZIPVER for the zip target
else
	rm -rf /tmp/gkrellsun-$(ZIPVER)
	rm -f /tmp/tar.exclude
	rm -f /tmp/gkrellsun-$(ZIPVER).tar.gz
	rm -f /tmp/gkrellsun-$(ZIPVER).zip
	mkdir /tmp/gkrellsun-$(ZIPVER)
	touch /tmp/tar.exclude
	find . -print  | grep /CVS$$ | cut -c3- >> /tmp/tar.exclude
	find . -print  | grep /CVS/ | cut -c3- >> /tmp/tar.exclude
	find . -print  | grep .classes | cut -c3- >> /tmp/tar.exclude
	find . -print  | grep /debian | cut -c3- >> /tmp/tar.exclude
	find . -type f -name "*~"  | cut -c3- >> /tmp/tar.exclude
	find . -type f -name "*.o"  | cut -c3- >> /tmp/tar.exclude
	find . -type f -name "*.so"  | cut -c3- >> /tmp/tar.exclude
	find . -type f -name "#*"  | cut -c3- >> /tmp/tar.exclude
	find . -type f -name "suninfo"  | cut -c3- >> /tmp/tar.exclude
	tar cf - * --exclude-from /tmp/tar.exclude | (cd /tmp/gkrellsun-$(ZIPVER); tar xf -)
	cd /tmp && tar cf - gkrellsun-$(ZIPVER) | gzip > gkrellsun-$(ZIPVER).tar.gz
	cd /tmp && zip -rpD gkrellsun-$(ZIPVER).zip gkrellsun-$(ZIPVER)
	rm -f tar.exclude
endif
