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

chore: update makefiles

parent c588de0d
No related branches found
No related tags found
No related merge requests found
......@@ -17,8 +17,10 @@ endif
ifeq ($(GIT_CHGLOG_BIN),)
$(shell $(GO) install github.com/git-chglog/git-chglog/cmd/git-chglog@latest)
GIT_CHGLOG_BIN := $(shell command -v git-chglog 2> /dev/null)
endif
ifneq ($(shell test -d $(GIT_CHGLOG_CONFIG_DIR) && echo -n yes),yes)
$(shell mkdir -p $(GIT_CHGLOG_CONFIG_DIR))
endif
......@@ -135,4 +137,4 @@ $(GIT_CHGLOG_CONFIG_DIR)/CHANGELOG.tpl.md:
## location of CHANGELOG.md file
CHANGELOG_FILE ?= $(PROJECT_ROOT)CHANGELOG.md
EXECUTABLES = $(EXECUTABLES:-) $(GIT_CHGLOG_BIN)
\ No newline at end of file
EXECUTABLES = $(EXECUTABLES:-) $(GIT_CHGLOG_BIN)
#############################################################################################
#############################################################################################
##
## DIRECTORIES
##
#############################################################################################
#############################################################################################
APPLICATION_PATH ?= $(PROJECT_ROOT)
DEPLOYMENT_PATH ?= $(PROJECT_ROOT)
DEVELOPMENT_PATH ?= $(PROJECT_ROOT)
DOCUMENTATION_PATH ?= $(PROJECT_ROOT)
RESOURCE_PATH ?= $(APPLICATION_PATH)
SOURCE_PATH ?= $(APPLICATION_PATH)
## SCRIPTS_PATH IS DEPRECATED
SCRIPTS_PATH ?= $(DEVELOPMENT_PATH)script/
DEVELOPMENT_SCRIPTS_PATH ?= $(DEVELOPMENT_PATH)script/
BUILD_PATH ?= $(DEPLOYMENT_PATH)build/
VENDOR_PATH ?= $(DEPLOYMENT_PATH)vendor/
DEPLOYMENT_SCRIPTS_PATH ?= $(DEPLOYMENT_PATH)script/
LICENSE_PATH ?= $(PROJECT_ROOT)
PROJECT_DIRECTORIES := $(PROJECT_DIRECTORIES) \
$(APPLICATION_PATH) \
$(VENDOR_PATH) \
$(DEVELOPMENT_SCRIPTS_PATH) \
$(BUILD_PATH)
......@@ -14,3 +14,14 @@ EXECUTABLES = $(EXECUTABLES:-) $(GO);
ifeq ($(shell command -v $(GO) 2> /dev/null),)
$(error "go is not installed. Please install go <https://go.dev/doc/install>")
endif
GOPATH=$(shell go env GOPATH)
ifeq ($(GOPATH),)
DIRS := bin pkg src
GOPATH=$(DEPLOYMENT_PATH)/go/
$(shell mkdir -p $(GOPATH))
$(shell $(foreach entry,$(DIRS),mkdir -p "$(GOPATH)$(entry)";))
export PATH=$(PATH):$(GOPATH)/bin
endif
#############################################################################################
#############################################################################################
##
## README
##
#############################################################################################
#############################################################################################
define README_FILE_CONTENT
# $(COMPONENT_NAME)
$(COMPONENT_NAME) is ...
## Documentation
To check out docs and examples, visit ....
## Installation
```shell
go get $(shell git config --get remote.origin.url | sed -E 's/^\s*.*:\/\///g')
```
**Note:** This library uses [Go Modules](https://github.com/golang/go/wiki/Modules) to manage dependencies.
## Usage
## Contributing
Merge requests are welcome. For major changes, please open an issue first to discuss what
you would like to change. **Please make sure to update tests as appropriate.**
Versioning is done with [SemVer](https://semver.org/).
Changelog is generated with [git-chglog](https://github.com/git-chglog/git-chglog#git-chglog)
Commit messages should follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification.
Messages are started with a type, which is one of the following:
- **feat**: A new feature
- **fix**: A bug fix
- **doc**: Documentation only changes
- **refactor**: A code change that neither fixes a bug nor adds a feature
- **perf**: A code change that improves performance
- **test**: Adding missing or correcting existing tests
- **chore**: Other changes that don't modify src or test files
The footer would be used for a reference to an issue or a breaking change.
A commit that has a footer `BREAKING CHANGE:`, or appends a ! after the type/scope,
introduces a breaking API change (correlating with MAJOR in semantic versioning).
A BREAKING CHANGE can be part of commits of any type.
the following is an example of a commit message:
```text
feat: add 'extras' field
```
## Questions
For questions and commercial support, please contact [schukai GmbH](https://www.schukai.com/).
The issue list of this repo is exclusively for bug reports and feature requests.
## Issues
Please make sure to read the Issue Reporting Checklist before opening an
issue. Issues not conforming to the guidelines may be closed immediately.
## License
$(COPYRIGHT_TEXT)
$(COPYRIGHT_URL)
You can also purchase a commercial license.
endef
......@@ -18,9 +18,44 @@ To check out docs and examples, visit ....
## Installation
```shell
go get $(shell git config --get remote.origin.url | sed -E 's/^\s*.*:\/\///g')
```
**Note:** This library uses [Go Modules](https://github.com/golang/go/wiki/Modules) to manage dependencies.
## Usage
## Contributing
Merge requests are welcome. For major changes, please open an issue first to discuss what
you would like to change. **Please make sure to update tests as appropriate.**
Versioning is done with [SemVer](https://semver.org/).
Changelog is generated with [git-chglog](https://github.com/git-chglog/git-chglog#git-chglog)
Commit messages should follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification.
Messages are started with a type, which is one of the following:
- **feat**: A new feature
- **fix**: A bug fix
- **doc**: Documentation only changes
- **refactor**: A code change that neither fixes a bug nor adds a feature
- **perf**: A code change that improves performance
- **test**: Adding missing or correcting existing tests
- **chore**: Other changes that don't modify src or test files
The footer would be used for a reference to an issue or a breaking change.
A commit that has a footer `BREAKING CHANGE:`, or appends a ! after the type/scope,
introduces a breaking API change (correlating with MAJOR in semantic versioning).
A BREAKING CHANGE can be part of commits of any type.
the following is an example of a commit message:
```text
feat: add 'extras' field
```
## Questions
......
......@@ -11,16 +11,22 @@ ifeq ($(GO),)
endif
GO_MOD_FILE := $(SOURCE_PATH)go.mod
GO_LICENSES_BIN := $(shell command -v go-licenses)
ifeq ($(GO_LICENSES_BIN),)
$(shell $(GO) install github.com/google/go-licenses@latest)
GO_LICENSES_BIN := $(shell command -v go-licenses 2> /dev/null)
EXECUTABLES = $(EXECUTABLES:-) go-licenses;
endif
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;
endif
.PHONY: go-fetch-licenses
## Fetch licenses for all modules
go-fetch-licenses:
go-fetch-licenses:
ifeq ($(GO_CURRENT_MODULE),)
$(QUIET) $(ECHOERRORMARKER) "no go.mod file found, skipping fetching licenses"
else
......
#############################################################################################
#############################################################################################
##
## INIT-STANDARD
##
#############################################################################################
#############################################################################################
# @see .PHONY https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html#Phony-Targets
.PHONY: init-go-lib
# The default directories are defined in the
# directories-standard.mk file, but all other
# targets can define directories as well.
$(PROJECT_DIRECTORIES):
$(foreach path,$(PROJECT_DIRECTORIES),\
$(shell $(MKDIR) -p $(path)))
## init go lib project
init-go-lib: $(PROJECT_DIRECTORIES) $(PROJECT_ROOT).gitignore $(PROJECT_ROOT)README.md $(LICENSE_PATH)LICENSE
$(ECHOMARKER) "Run init-go-lib"
$(ECHO) "Done"
#############################################################################################
#############################################################################################
##
## LICENSE
##
#############################################################################################
#############################################################################################
export LICENSE_FILE_CONTENT
$(LICENSE_PATH)LICENSE:
$(QUIET) $(ECHO) "$$LICENSE_FILE_CONTENT" >> $@
#############################################################################################
#############################################################################################
##
## README
##
#############################################################################################
#############################################################################################
export README_FILE_CONTENT
$(PROJECT_ROOT)README.md:
$(QUIET) $(ECHO) "$$README_FILE_CONTENT" >> $@
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