VERS_MAJOR := 0 VERS_MINOR := 3 VERSION := $(VERS_MAJOR).$(VERS_MINOR) NEW_MINOR := $$(( $(VERS_MINOR) + 1 )) NEW_MAJOR := $$(( $(VERS_MAJOR) + 1 )) output: output/sendmail: output go build -o output/sendmail -ldflags "-X main.version=$(VERSION)" ./... build: output/sendmail bumpvers-minor: sed -i"" "s/VERS_MINOR := $(VERS_MINOR)/VERS_MINOR := $(NEW_MINOR)/" Makefile git add Makefile git commit -m "Bump version $(VERSION) -> $(VERS_MAJOR).$(NEW_MINOR)" git tag $(VERS_MAJOR).$(NEW_MINOR) bumpvers-major: sed -i"" "s/VERS_MAJOR := $(VERS_MAJOR)/VERS_MAJOR := $$(( $(VERS_MAJOR) + 1 ))/" Makefile git add Makefile git commit -m "Bump version $(VERSION) -> $(NEW_MAJOR).$(VERS_MINOR)" git tag $(NEW_MAJOR).$(VERS_MINOR) release-min: make bumpvers-minor make build release-maj: make bumpvers-major make build PHONY: bumpvers-minor bumpvers-major release-min release-maj