diff --git a/.gitignore b/.gitignore index 8a56c67a..3c6a8ea2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .debbuild .deps +.rpmbuild .version .version.date Makefile diff --git a/packaging/rpm.mk b/packaging/rpm.mk new file mode 100644 index 00000000..cb70c141 --- /dev/null +++ b/packaging/rpm.mk @@ -0,0 +1,40 @@ +RPMBUILD = .rpmbuild + +CORE_VERSION = $(shell cat .version 2> /dev/null) + +.PHONY: all +all: clean .version build + +.PHONY: clean +clean: + rm -rf $(RPMBUILD) + +.PHONY: build +build: dist + for d in SOURCES SPECS; do mkdir -p $(RPMBUILD)/$$d; done + cp -afv core-$(CORE_VERSION).tar.gz $(RPMBUILD)/SOURCES + cp -afv packaging/rpm/core.spec $(RPMBUILD)/SPECS + rpmbuild -bb --clean $(RPMBUILD)/SPECS/core.spec \ + --define "_topdir $$PWD/.rpmbuild" + @printf "\nRPM packages saved in $(RPMBUILD)/RPMS\n\n" + +.PHONY: dist +dist: Makefile + $(MAKE) dist + +Makefile: configure + ./configure --prefix=/usr --exec-prefix=/usr + +configure: bootstrap.sh + ./bootstrap.sh + +bootstrap.sh: + @printf "\nERROR: make must be called from the top-level directory:\n" + @printf " make -f packaging/$(lastword $(MAKEFILE_LIST))\n\n" + @false + +.version: Makefile + $(MAKE) $@ + +$(RPMBUILD): + mkdir -p $@