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

update makefiles

parent cd3c1f3d
No related branches found
No related tags found
No related merge requests found
......@@ -6,12 +6,16 @@
#############################################################################################
#############################################################################################
ifeq ($(GO),)
$(error $(ERRORMARKER) Go is not defined, check your Makefile if go.mk is included)
endif
GO_MOD_FILE := $(SOURCE_PATH)go.mod
ifeq ($(shell test -e $(GO_MOD_FILE) && echo -n yes),yes)
GO_CURRENT_MODULE := $(shell cat $(GO_MOD_FILE) | head -n1 | cut -d" " -f2)
# go install github.com/google/go-licenses@latest
EXECUTABLES = $(EXECUTABLES:-) go-licenses;
GO_CURRENT_MODULE := $(shell cat $(GO_MOD_FILE) | head -n1 | cut -d" " -f2)
# go install github.com/google/go-licenses@latest
EXECUTABLES = $(EXECUTABLES:-) go-licenses;
endif
.PHONY: go-fetch-licenses
......@@ -21,6 +25,6 @@ ifeq ($(GO_CURRENT_MODULE),)
$(QUIET) $(ECHOERRORMARKER) "no go.mod file found, skipping fetching licenses"
else
$(ECHOMARKER) "Fetch licenses"
$(QUIET) cd $(SOURCE_PATH); go-licenses save $(GO_CURRENT_MODULE) $(GO_LICENSES_IGNORE_PACKAGES) --force --save_path $(DOCUMENTATION_PATH)licenses/ ; cd -
$(QUIET) cd $(SOURCE_PATH); $(GO_LICENSES_BIN) save $(GO_CURRENT_MODULE) $(GO_LICENSES_IGNORE_PACKAGES) --force --save_path $(DOCUMENTATION_PATH)licenses/ ; cd -
endif
......@@ -20,7 +20,7 @@ node-build: $(NODE_MODULES_MODIFIED) $(NODE_PACKAGES)
$(QUIET) for p in $(NODE_PACKAGES); do \
$(JQ) '.version = "$(PROJECT_VERSION)"' $${p} | $(SPONGE) $${p}; \
done ; \
$(QUIET) $(NPM) --prefix $(NODE_ROOT_DIR) run build
$(NPM) --prefix $(NODE_ROOT_DIR) run build
#############################################################################################
#############################################################################################
##
## REQMAN-TARGETS
##
#############################################################################################
#############################################################################################
# @TODO not working, check if this is a bug in this definition!!!
ifeq ($(REQMAN_BIN),)
$(error "$(REQMAN_BIN) is not installed. Please check your makefile and include the reqman.mk")
endif
$(REQMAN_BIN):
$(QUIET) $(MKDIR) -p $(VENDOR_PATH)
$(QUIET) $(WGET) -O $(REQMAN_BIN) http://download.schukai.com/tools/reqman/reqman-$(shell uname -s | tr [:upper:] [:lower:])-$(shell echo `uname -m | sed s/aarch64/arm64/ | sed s/x86_64/amd64/`)
$(QUIET) $(CHMOD) u+x $(REQMAN_BIN)
$(PROJECT_ROOT)deployment/build/manual.html: $(DOCMAN_BIN)
$(REQMAN_BIN) print html --config $(PROJECT_ROOT)requirement/config.yaml
$(PROJECT_ROOT)deployment/build/manual.pdf: $(DOCMAN_BIN)
$(REQMAN_BIN) print pdf --config $(PROJECT_ROOT)requirement/config.yaml
.PHONY: build-req-pdf
## creating the requirement in pdf format
build-req-pdf: $(PROJECT_ROOT)deployment/build/requirement.pdf
.PHONY: build-req-html
## creating the requirement in html format
build-req-html: $(PROJECT_ROOT)deployment/build/requirement.html
.PHONY: build-req
## creating the requirement in pdf and html format
build-req: build-req-pdf build-req-html
......@@ -6,15 +6,24 @@
#############################################################################################
#############################################################################################
ifeq ($(GIT),)
$(error $(ERRORMARKER) Git is not defined, check your Makefile if git.mk is included)
endif
# @see .PHONY https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html#Phony-Targets
.PHONY: update-makefiles
ifeq ($(QUIET),)
_COPYVERBOSE = -v
endif
## update standard makefiles
update-makefiles:
$(ECHOMARKER) "update standard makefiles"
$(QUIET) $(eval TEMPD := $(shell mktemp -d))
$(QUIET) $(GIT) clone --depth=1 https://gitlab.schukai.com/schukai/utilities/makefile.git/ "$(TEMPD)" > /dev/null
$(QUIET) $(CP) -rv $(TEMPD)/makefiles/* $(MAKEFILE_IMPORT_PATH)
$(QUIET) $(CP) -rv $(TEMPD)/Makefile $(PROJECT_ROOT)Makefile.example
$(QUIET) $(GIT) clone --quiet --depth=1 https://gitlab.schukai.com/schukai/utilities/makefile.git/ "$(TEMPD)"
$(QUIET) $(CP) -r $(_COPYVERBOSE) $(TEMPD)/makefiles/* $(MAKEFILE_IMPORT_PATH)
$(QUIET) $(CP) -r $(_COPYVERBOSE) $(TEMPD)/Makefile $(PROJECT_ROOT)Makefile.example
$(QUIET) $(RM) -rf $(TEMPD)
......
......@@ -9,4 +9,5 @@
.PHONY: variables
## Print all variables
variables:
@$(foreach v, $(.VARIABLES), $(if $(filter file,$(origin $(v))), $(info $(INFO)$(v)$(RESET)=$($(v))$(RESET))))
\ No newline at end of file
$(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: 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: 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: 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)"
......@@ -28,15 +28,13 @@ RSYNC ?= rsync
XARGS ?= xargs
GREP ?= grep
MAKE ?= make
GIT ?= git
LN ?= ln
TOUCH ?= touch
TOUCH ?= touch
TEST ?= test
JQ ?= jq
JQ ?= jq
EXECUTABLES = $(EXECUTABLES:-) $(JQ) $(AWK) $(CP) $(KILL) $(MV) $(SED) $(FIND) $(SORT) $(TOUCH) $(WGET) $(CHMOD) $(RSYNC) $(XARGS) $(GREP) $(MAKE) $(GIT)
EXECUTABLES = $(EXECUTABLES:-) $(JQ) $(AWK) $(CP) $(KILL) $(MV) $(SED) $(FIND) $(SORT) $(TOUCH) $(WGET) $(CHMOD) $(RSYNC) $(XARGS) $(GREP) $(MAKE) $(LN)
\ No newline at end of file
......@@ -6,10 +6,8 @@
#############################################################################################
#############################################################################################
VERSION_BIN := version
EXECUTABLES = $(EXECUTABLES:-) $(VERSION_BIN)
RELEASE_FILE ?= $(PROJECT_ROOT)release.json
VERSION_BIN ?= $(VENDOR_PATH)version
RELEASE_FILE ?= $(PROJECT_ROOT)release.json
ifeq ("$(wildcard $(RELEASE_FILE))","")
$(shell echo '{"version":"0.1.0"}' > $(RELEASE_FILE))
......@@ -17,24 +15,3 @@ endif
PROJECT_VERSION ?= $(shell cat $(RELEASE_FILE) | jq -r .version)
PROJECT_BUILD_DATE ?= $(shell $(VERSION_BIN) date)
.PHONY: next-patch-version
## create next patch version
next-patch-version:
$(ECHOMARKER) "Creating next version"
$(QUIET) $(VERSION_BIN) patch --path $(RELEASE_FILE) --selector "version"
$(QUIET) $(eval PROJECT_VERSION := $(shell cat $(RELEASE_FILE) | jq -r .version))
.PHONY: next-minor-version
## create next minor version
next-minor-version:
$(ECHOMARKER) "Creating next minor version"
$(QUIET) $(VERSION_BIN) minor --path $(RELEASE_FILE) --selector "version"
$(QUIET) $(eval PROJECT_VERSION := $(shell cat $(RELEASE_FILE) | jq -r .version))
.PHONY: next-major-version
## create next major version
next-major-version:
$(ECHOMARKER) "Creating next minor version"
$(QUIET) $(VERSION_BIN) major --path $(RELEASE_FILE) --selector "version"
$(QUIET) $(eval PROJECT_VERSION := $(shell cat $(RELEASE_FILE) | jq -r .version))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment