all: tclpkgs-src-current.tar.gz

tclpkgs-src-current.tar.gz: tclpkgs-src-current
	tar -zcf tclpkgs-src-current.tar.gz tclpkgs-src-current
	rm -rf tclpkgs-src-current

tclpkgs-src-current: platform build_all.sh create_teapot common.sh */build.sh */patches
	rm -rf tclpkgs-src-current
	mkdir tclpkgs-src-current
	cp -rp platform build_all.sh create_teapot common.sh certs.pem tclpkgs-src-current/
	for dir in */; do \
		if test ! -f "$$dir/build.sh"; then continue; fi; \
		mkdir "tclpkgs-src-current/$$dir"; \
		cp "$$dir/build.sh" "tclpkgs-src-current/$$dir"; \
		if test -d "$$dir/patches"; then cp -rp "$$dir/patches" "tclpkgs-src-current/$$dir"; fi; \
	done
	find tclpkgs-src-current -name '.svn' | xargs rm -rf

clean:
	rm -f tclpkgs-*.tar.*
	rm -rf tclpkgs-src-current
	./build_all.sh clean

distclean: clean
	./build_all.sh distclean

.PHONY: all clean distclean
