PACKAGE=LPRngTool
VERSION=1.3.2
RELEASE=1
RPM=/usr/src/redhat/RPMS/i386/${PACKAGE}-${VERSION}-${RELEASE}.i386.rpm

all:
	make update
	make rpm
	make testu
	make dou

.PHONY: all rpm testi testu dou doU undo update clean checkit

rpm:	${RPM}

testi:
	rpm -i --test ${RPM}
testu:
	rpm -U --test ${RPM}
dou:
	rpm -U  ${RPM}
doU:
	rpm -U --force ${RPM}
undo:
	rpm -e --nodeps ${PACKAGE}
tell:
	rpm -q -l -p ${RPM}

${RPM}: LPRngTool.spec
	rpm -ba LPRngTool.spec

clean:
	rm -f *.bak *.tgz
	rm -rf /usr/src/redhat/BUILD/${PACKAGE}-*

update:
	perl -spi -e "\
		s|^\%define version.*|\%define version ${VERSION}|; \
		s|^\%define release.*|\%define release ${RELEASE}|; \
		" LPRngTool.spec

checkit: update
	# cd ../.. ; ./configure ${CONFIGURE_ARGS}; make all install
	make rpm
