Skip to content
Snippets Groups Projects
Select Git revision
  • 6078722a1f97bf4886b9d1bcffec563e27708b8d
  • master default protected
  • 1.31
  • 4.37.2
  • 4.37.1
  • 4.37.0
  • 4.36.0
  • 4.35.0
  • 4.34.1
  • 4.34.0
  • 4.33.1
  • 4.33.0
  • 4.32.2
  • 4.32.1
  • 4.32.0
  • 4.31.0
  • 4.30.1
  • 4.30.0
  • 4.29.1
  • 4.29.0
  • 4.28.0
  • 4.27.0
  • 4.26.0
23 results

target-go-fetch-licenses.mk

Blame
  • target-go-fetch-licenses.mk 1.30 KiB
    #############################################################################################
    #############################################################################################
    ##
    ## 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) $(PKG_LIST) --force --save_path $(DOCUMENTATION_PATH)licenses/ ; cd -
    endif