github.com/noironetworks/cilium-net@v1.6.12/contrib/packaging/rpm/Makefile (about)

     1  include ../../../Makefile.defs
     2  
     3  VERSION := $(shell git tag -l --sort=-v:refname | sed 's/v\([^-].*\)/\1/g' | head -1)
     4  RELEASE := $(shell git describe --long --tags | sed 's/\([^-].*\)-\([0-9]*\)-\(g.*\)/\2/g')
     5  BUILDDIR := "$(CURDIR)/cilium-$(VERSION)"
     6  BASEDIR := "$(CURDIR)/../../../"
     7  BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
     8  COMMIT := $(shell git rev-parse HEAD)
     9  SHORTCOMMIT := $(shell git rev-parse HEAD | cut -c1-7)
    10  
    11  build: clean
    12  	mkdir -p output
    13  	echo "export VERSION=$(VERSION) RELEASE=$(RELEASE) COMMIT=$(COMMIT) SHORTCOMMIT=$(SHORTCOMMIT)" > env
    14  	(cd $(BASEDIR) && git bundle create $(CURDIR)/version_$(VERSION) $(BRANCH) --tags)
    15  	(cd $(CURDIR) && git clone $(CURDIR)/version_$(VERSION) cilium -b $(BRANCH))
    16  	(cd $(CURDIR)/cilium/envoy && make BINDIR=$$PWD install)
    17  	tar -c cilium --transform s/cilium/cilium-$(COMMIT)/ | gzip -9 &> cilium-$(SHORTCOMMIT).tar.gz
    18  	docker build -t cilium:cilium-bin-rpm-$(VERSION) $(CURDIR)
    19  	docker run --rm -v $(CURDIR)/output:/output cilium:cilium-bin-rpm-$(VERSION)
    20  	echo -e "\nCilium version $(VERSION) packages are located here:\n$(CURDIR)/output/\n"
    21  
    22  clean:
    23  	@$(ECHO_CLEAN)
    24  	$(QUIET)rm -rf env cilium output version_* cilium-*.tar.gz
    25  
    26  .PHONY: force build clean
    27  force :;