VERSION=`cat version`
VERSION_CVS=`cat version | sed 's/\./_/'`
APP=dracut-flashcache
RELEASE=1

# $@ is the target:
# $? out of date dependencies
# $< is the source file

# $(OBJS:.o=.c) converts data.o io.o main.o into data.c io.c main.c

$(APP).spec: $(APP).spec.in version
	echo "# Do not edit this file. Edit $(APP).spec.in" > $@
	echo "%define ver $(VERSION)" >> $@
	echo "%define rel $(RELEASE)" >> $@
	cat $(APP).spec.in >> $@

rtag:
	cvs rtag v$(VERSION_CVS) $(APP)

tarball: $(APP).spec 
	if [ -L ../$(APP)-$(VERSION) ] ; then rm ../$(APP)-$(VERSION) ; fi
	ln -s $(APP) ../$(APP)-$(VERSION)
	tar -chzf ../$(APP)-$(VERSION).tgz -C ../ --exclude CVS --exclude \*.swp $(APP)-$(VERSION)
	if [ -L ../$(APP)-$(VERSION) ] ; then rm ../$(APP)-$(VERSION) ; fi

rpm: tarball
	rpmbuild -ta ../$(APP)-$(VERSION).tgz

