# for package making
VERSION = 1.5rc2
SUBDIRS = command addons examples
CLEANUPS = command/lkstutils.spec
LKCDDIR = lkcd-addon/lkcdutils
TARGETS = $(SUBDIRS) lkcd-addon hooks LICENSE linux24.patch Makefile \
          Install howto.txt changelog extra-patch
PKGNAME = lkst-$(VERSION)

package: dist

dist: distclean adjustver
	mkdir $(PKGNAME)
	cp -a $(TARGETS) $(PKGNAME)
	rm -rf `find $(PKGNAME) -name CVS -a -type d`
	tar czvf $(PKGNAME).tar.gz $(PKGNAME)
	rm -rf $(PKGNAME)

distclean: lkcdclean
	for dir in $(SUBDIRS) ; do \
		( cd $$dir ; \
			[ -f Makefile ] && make distclean ; cd .. ); \
	done
	rm -rf $(CLEANUPS)

lkcdclean: 
	( cd $(LKCDDIR); make clean; )

adjustver:
	cat command/cmd.conf | sed /^LKSTVER/s/.*/LKSTVER=$(VERSION)/ > temp.conf
	mv temp.conf command/cmd.conf
