Makefile 891 B

12345678910111213141516171819202122232425262728293031323334
  1. VERS_MAJOR := 0
  2. VERS_MINOR := 3
  3. VERSION := $(VERS_MAJOR).$(VERS_MINOR)
  4. NEW_MINOR := $$(( $(VERS_MINOR) + 1 ))
  5. NEW_MAJOR := $$(( $(VERS_MAJOR) + 1 ))
  6. output:
  7. output/sendmail: output
  8. go build -o output/sendmail -ldflags "-X main.version=$(VERSION)" ./...
  9. build: output/sendmail
  10. bumpvers-minor:
  11. sed -i"" "s/VERS_MINOR := $(VERS_MINOR)/VERS_MINOR := $(NEW_MINOR)/" Makefile
  12. git add Makefile
  13. git commit -m "Bump version $(VERSION) -> $(VERS_MAJOR).$(NEW_MINOR)"
  14. git tag $(VERS_MAJOR).$(NEW_MINOR)
  15. bumpvers-major:
  16. sed -i"" "s/VERS_MAJOR := $(VERS_MAJOR)/VERS_MAJOR := $$(( $(VERS_MAJOR) + 1 ))/" Makefile
  17. git add Makefile
  18. git commit -m "Bump version $(VERSION) -> $(NEW_MAJOR).$(VERS_MINOR)"
  19. git tag $(NEW_MAJOR).$(VERS_MINOR)
  20. release-min:
  21. make bumpvers-minor
  22. make build
  23. release-maj:
  24. make bumpvers-major
  25. make build
  26. PHONY: bumpvers-minor bumpvers-major release-min release-maj