############################################################################################# ############################################################################################# ## ## GET LICENSES ## ############################################################################################# ############################################################################################# ifeq ($(GO),) $(error $(ERRORMARKER) Go is not defined, check your Makefile if go.mk is included) 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) endif .PHONY: go-fetch-licenses ## Fetch licenses for all modules go-fetch-licenses: ifeq ($(GO_CURRENT_MODULE),) $(QUIET) $(ECHOERRORMARKER) "no go.mod file found, skipping fetching licenses" else $(ECHOMARKER) "Fetch licenses" $(QUIET) cd $(SOURCE_PATH); $(GO_LICENSES_BIN) save $(GO_CURRENT_MODULE) $(GO_LICENSES_IGNORE_PACKAGES) --force --save_path $(DOCUMENTATION_PATH)licenses/ ; cd - endif