Skip to content
Snippets Groups Projects
Verified Commit 43c402e1 authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

feat: first version

parent 0f9f19f1
Branches master
No related tags found
No related merge requests found
#############################################################################################
#############################################################################################
##
## VARIABLES-TARGETS
##
#############################################################################################
#############################################################################################
.PHONY: variables
## Print all variables
variables:
$(ECHOMARKER) "print all variables"
$(QUIET) $(foreach v, $(.VARIABLES), $(if $(filter file,$(origin $(v))), $(info $(INFO)$(v)$(RESET)=$($(v))$(RESET))))
\ No newline at end of file
#############################################################################################
#############################################################################################
##
## VARIABLES-TARGETS
##
#############################################################################################
#############################################################################################
ifeq ($(VERSION_BIN),)
$(error "$(VERSION_BIN) is not installed. Please check your makefile and include the version.mk")
endif
ifeq ($(GIT),)
$(error $(ERRORMARKER) Git is not defined, check your Makefile if git.mk is included)
endif
ifeq ($(GIT_CHGLOG_BIN),)
$(error $(ERRORMARKER) Chglog is not defined, check your Makefile if changelog.mk is included)
endif
$(VERSION_BIN):
$(QUIET) $(MKDIR) -p $(VENDOR_PATH)
$(QUIET) $(WGET) -O $(VERSION_BIN) http://download.schukai.com/tools/version/version-$(shell uname -s | tr [:upper:] [:lower:])-$(shell echo `uname -m | sed s/aarch64/arm64/ | sed s/x86_64/amd64/`)
$(QUIET) $(CHMOD) u+x $(VERSION_BIN)
.PHONY: next-patch-version
next-patch-version: check-clean-repo $(VERSION_BIN)
$(ECHOMARKER) "Creating next version"
$(QUIET) $(VERSION_BIN) patch --path $(RELEASE_FILE) --selector "version"
$(QUIET) $(GIT) add $(RELEASE_FILE) && $(GIT) commit -m "Bump version to $$(cat $(RELEASE_FILE) | jq -r .version)"
.PHONY: next-minor-version
next-minor-version: check-clean-repo $(VERSION_BIN)
$(ECHOMARKER) "Creating next minor version"
$(QUIET) $(VERSION_BIN) minor --path $(RELEASE_FILE) --selector "version"
$(QUIET) $(GIT) add $(RELEASE_FILE) && $(GIT) commit -m "Bump version to $$( cat $(RELEASE_FILE) | jq -r .version)"
.PHONY: next-major-version
next-major-version: check-clean-repo $(VERSION_BIN)
$(ECHOMARKER) "Creating next minor version"
$(QUIET) $(VERSION_BIN) major --path $(RELEASE_FILE) --selector "version"
$(QUIET) $(GIT) add $(RELEASE_FILE) && $(GIT) commit -m "Bump version to $$(cat $(RELEASE_FILE) | jq -r .version)"
.PHONY: check-clean-repo
check-clean-repo:
$(QUIET) $(GIT) diff-index --quiet HEAD || (echo "There are uncommitted changes after running make. Please commit or stash them before running make."; exit 1)
## tag repository with next patch version
tag-patch-version: $(GIT_CHGLOG_CONFIG_DIR)/config.yml $(GIT_CHGLOG_CONFIG_DIR)/CHANGELOG.tpl.md next-patch-version
$(ECHOMARKER) "Tagging patch version"
$(eval PROJECT_VERSION := $(shell cat $(RELEASE_FILE) | jq -r .version))
$(GIT_CHGLOG_BIN) --next-tag v$(PROJECT_VERSION) -o $(CHANGELOG_FILE)
$(QUIET) $(GIT) add $(CHANGELOG_FILE) && $(GIT) commit -m "Update changelog"
$(QUIET) $(GIT) tag -a v$(PROJECT_VERSION) -m "Version $(PROJECT_VERSION)"
## tag repository with next minor version
tag-minor-version: $(GIT_CHGLOG_CONFIG_DIR)/config.yml $(GIT_CHGLOG_CONFIG_DIR)/CHANGELOG.tpl.md next-minor-version
$(ECHOMARKER) "Tagging minor version"
$(eval PROJECT_VERSION := $(shell cat $(RELEASE_FILE) | jq -r .version))
$(GIT_CHGLOG_BIN) --next-tag v$(PROJECT_VERSION) -o $(CHANGELOG_FILE)
$(QUIET) $(GIT) add $(CHANGELOG_FILE) && $(GIT) commit -m "Update changelog"
$(QUIET) $(GIT) tag -a v$(PROJECT_VERSION) -m "Version $(PROJECT_VERSION)"
## tag repository with next major version
tag-major-version: $(GIT_CHGLOG_CONFIG_DIR)/config.yml $(GIT_CHGLOG_CONFIG_DIR)/CHANGELOG.tpl.md next-major-version
$(ECHOMARKER) "Tagging major version"
$(eval PROJECT_VERSION := $(shell cat $(RELEASE_FILE) | jq -r .version))
$(GIT_CHGLOG_BIN) --next-tag v$(PROJECT_VERSION) -o $(CHANGELOG_FILE)
$(QUIET) $(GIT) add $(CHANGELOG_FILE) && $(GIT) commit -m "Update changelog"
$(QUIET) $(GIT) tag -a v$(PROJECT_VERSION) -m "Version $(PROJECT_VERSION)"
#############################################################################################
#############################################################################################
##
## TERMINAL CHECK
##
#############################################################################################
#############################################################################################
# Executable Programs the Installed be have to
K := $(foreach exec,$(EXECUTABLES),\
$(if $(shell which $(exec)),some string,$(error "Missing $(exec) in PATH; please install")))
\ No newline at end of file
#############################################################################################
#############################################################################################
##
## COMMANDS
##
#############################################################################################
#############################################################################################
# Use bash instead of sh
## Sets the shell used
SHELL = bash
# path and binaries
AWK ?= awk
CP ?= cp
CD ?= cd
KILL ?= kill
MV ?= mv
RM ?= rm
MKDIR ?= mkdir
SED ?= sed
FIND ?= find
SORT ?= sort
TOUCH ?= touch
WGET ?= wget
CHMOD ?= chmod
RSYNC ?= rsync
XARGS ?= xargs
GREP ?= grep
MAKE ?= make
LN ?= ln
TOUCH ?= touch
TEST ?= test
JQ ?= jq
EXECUTABLES = $(EXECUTABLES:-) $(JQ) $(AWK) $(CP) $(KILL) $(MV) $(SED) $(FIND) $(SORT) $(TOUCH) $(WGET) $(CHMOD) $(RSYNC) $(XARGS) $(GREP) $(MAKE) $(LN)
\ No newline at end of file
#############################################################################################
#############################################################################################
##
## VERSIONS
##
#############################################################################################
#############################################################################################
VERSION_BIN ?= $(VENDOR_PATH)version
RELEASE_FILE ?= $(PROJECT_ROOT)release.json
ifeq ("$(wildcard $(RELEASE_FILE))","")
$(shell echo '{"version":"0.1.0"}' > $(RELEASE_FILE))
endif
PROJECT_VERSION ?= $(shell cat $(RELEASE_FILE) | jq -r .version)
PROJECT_BUILD_DATE ?= $(shell $(VERSION_BIN) date)
## Project directory in which the Makefiles should be located
MAKEFILE_IMPORT_PATH=$(PROJECT_ROOT)development/makefiles/
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment