Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions modules/licenses/01_mod.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

###################### Generate LICENSES files ######################

# _module_dir is the directory containing this Makefile, used to retrieve the path of the licenses.tmpl file
_module_dir := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))

# Create a go.work file so that go-licenses can discover the LICENSE file of the
# other modules in the repo.
#
Expand All @@ -30,11 +33,11 @@ generate-go-licenses: #
shared_generate_targets += generate-go-licenses

define licenses_target
$1/LICENSES: $1/go.mod $(licenses_go_work) $(dir $(lastword $(MAKEFILE_LIST)))/licenses.tmpl | $(NEEDS_GO-LICENSES)
$1/LICENSES: $1/go.mod $(licenses_go_work) $(_module_dir)/licenses.tmpl | $(NEEDS_GO-LICENSES)
cd $$(dir $$@) && \
GOWORK=$(abspath $(licenses_go_work)) \
GOOS=linux GOARCH=amd64 \
$(GO-LICENSES) report --ignore "$$(license_ignore)" --template $(dir $(lastword $(MAKEFILE_LIST)))/licenses.tmpl ./... > LICENSES
$(GO-LICENSES) report --ignore "$$(license_ignore)" --template $(_module_dir)/licenses.tmpl ./... > LICENSES

generate-go-licenses: $1/LICENSES
# The /LICENSE targets make sure these files exist.
Expand Down
Loading