Makefile 1.1 KB
Newer Older
S
shirong 已提交
1
PROJECT_DIR := $(shell cd ../..; pwd)
H
hustliyilin 已提交
2 3 4 5 6 7 8 9 10 11 12 13
RPMBUILD_DIR := $(shell mktemp -u /tmp/rpmbuild.XXXX)
RELEASE_TARBALL_URL := https://github.com/alibaba/inclavare-containers/archive/v$(INCLAVARE_CONTAINERS_VERSION).tar.gz
RELEASE_TARBALL_FILE := $(RPMBUILD_DIR)/SOURCES/v$(INCLAVARE_CONTAINERS_VERSION).tar.gz
RELEASE_TARBALL_EXIST := $(shell if [ -f $(RELEASE_TARBALL_FILE) ]; then echo "y"; else echo "n"; fi;)

release-tarball:
ifneq ($(RELEASE_TARBALL_EXIST), y)
	@mkdir -p $(RPMBUILD_DIR)/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
	@wget -P $(RPMBUILD_DIR)/SOURCES $(RELEASE_TARBALL_URL)
endif

rpm: release-tarball
14
	@rpmbuild -D "_topdir $(RPMBUILD_DIR)" -ba rpm/shim-rune.spec
S
shirong 已提交
15 16 17
	@cp $(RPMBUILD_DIR)/RPMS/x86_64/*.rpm $(PROJECT_DIR)
	@rm -rf $(RPMBUILD_DIR)
	@echo "the rpms of shim-rune located in $(PROJECT_DIR)"
H
hustliyilin 已提交
18

H
haosanzi 已提交
19 20 21 22 23 24 25 26 27 28 29 30 31 32
deb:
	@cd deb && ./build.sh
	@echo "the debs of shim-rune located in $(PROJECT_DIR)"

package:
ifeq (/etc/debian_version, $(wildcard /etc/debian_version))
	make deb
else ifeq (/etc/redhat-release, $(wildcard /etc/redhat-release))
	make rpm
else
	@echo "error! don't support generating packages on this system"
endif

.PHONY: release-tarball rpm deb package