-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Tronje Krop <[email protected]>
- Loading branch information
Showing
12 changed files
with
142 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ export GOPATH ?= $(shell $(GO) env GOPATH) | |
export GOBIN ?= $(GOPATH)/bin | ||
|
||
# Setup go-make version to use desired build and config scripts. | ||
GOMAKE_DEP ?= github.com/tkrop/[email protected].100 | ||
GOMAKE_DEP ?= github.com/tkrop/[email protected].101 | ||
INSTALL_FLAGS ?= -mod=readonly -buildvcs=auto | ||
# Request targets from go-make targets target. | ||
TARGETS := $(shell command -v $(GOBIN)/go-make >/dev/null || \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.0.100 | ||
0.0.101 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ export GOPATH ?= $(shell $(GO) env GOPATH) | |
export GOBIN ?= $(GOPATH)/bin | ||
|
||
# Setup go-make version to use desired build and config scripts. | ||
GOMAKE_DEP ?= github.com/tkrop/[email protected].100 | ||
GOMAKE_DEP ?= github.com/tkrop/[email protected].101 | ||
INSTALL_FLAGS ?= -mod=readonly -buildvcs=auto | ||
# Request targets from go-make targets target. | ||
TARGETS := $(shell command -v $(GOBIN)/go-make >/dev/null || \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,14 +24,15 @@ COLOR-target := 1;96 | |
|
||
# Finding: \$\(call *[ce]*msg | ||
ts = $(shell date '+%F %T.%3N') | ||
eq = $(if $(and $(findstring x$(1),x$(2)),$(findstring x$(2),x$(1))),$(3),$(4)) | ||
xifeq = $(if $(and $(findstring x$(1),x$(2)),$(findstring x$(2),x$(1))),$(3),$(4)) | ||
msg = $(strip \033[$(COLOR-$(1))m$(2)\033[0m $(3)) | ||
cmsg = $(ts) $(call msg,$(1),$(1):,$(2)) | ||
emsg = $(if $(2),echo -e "$(ts) $(call msg,$(1),$(1):,$(2))" > /dev/stderr) | ||
dmsg = $(if $(findstring --trace,$(MAKEFLAGS)),$(call emsg,$(1),$(2)),echo -n) | ||
|
||
escape = $(subst $$,\$$,$(subst ",\",$(subst \",\\",$(1)))) | ||
cerror = $(if $(1),$(error $(shell $(call emsg,error,$(1))))) | ||
cinfo = $(shell $(call emsg,info,$(1))) | ||
cdebug = $(shell $(call dmsg,debug,$(1))) | ||
|
||
# Check whether bash version is higher or equal version 3.2 to be compatible. | ||
|
@@ -40,9 +41,15 @@ ifneq ($(shell echo $${BASH_VERSION} | grep -E -v "^([4-9]+|3\.2)"),) | |
endif | ||
# Check whether bash is running in minmal compatibility mode for testing. | ||
ifdef BASH_COMPAT | ||
$(shell $(call emsg,info,bash compatibility mode set [$(BASH_COMPAT)])) | ||
$(call cdebug,bash compatibility mode set [$(BASH_COMPAT)]) | ||
endif | ||
|
||
path-setup = $(shell \ | ||
if [ "$(1)" == "opt" ]; then \ | ||
XPATH="$(shell brew --prefix)/$(1)/$(2)/libexec/gnubin"; \ | ||
else XPATH="$(shell brew --prefix)/$(1)"; fi; \ | ||
test ! -e "$${XPATH}/$(3)" && brew install $(1) >&2; \ | ||
echo -n "$${XPATH}:$(4)") | ||
# System depdendent helper functions. | ||
ifeq ("$(shell uname)","Linux") | ||
uname-all := uname --all | ||
|
@@ -52,11 +59,20 @@ else ifeq ($(shell uname),Darwin) | |
uname-all := uname -a | ||
rm-verbose-force := rm -vf | ||
rm-verbose-force-recursive := rm -vrf | ||
export PATH := $(call path-setup,opt,coreutils,ls,$(PATH)) | ||
export PATH := $(call path-setup,opt,findutils,find,$(PATH)) | ||
export PATH := $(call path-setup,opt,gawk,awk,$(PATH)) | ||
export PATH := $(call path-setup,opt,make,make,$(PATH)) | ||
ifneq ($(shell echo $${BASH_VERSION} | grep -E -v "^([5-9]+)"),) | ||
export PATH := $(call path-setup,bin,bash,bash,$(PATH)) | ||
endif | ||
else | ||
$(call cerror,unsupported operating system [$(shell $(uname-all))]) | ||
endif | ||
# Log execution environment for debugging. | ||
$(call cdebug,$(shell $(uname-all))) | ||
$(call cdebug,using BASH [$${0} - $${BASH_VERSION}]) | ||
$(call cdebug,using PATH [$(shell echo -n "$${PATH}")]) | ||
|
||
# Helper function to find and remove source files. | ||
find-all = find $(1) ! -path "./run/*" ! -path "./build/*" \( $(2) \) 2>/dev/null | \ | ||
|
@@ -99,7 +115,7 @@ else | |
BUILD_VERSION ?= $(VERSION) | ||
endif | ||
|
||
mod-readonly = $(call eq,$(IMAGE_VERSION),snapshot,,-mod=readonly) | ||
mod-readonly = $(call xifeq,$(IMAGE_VERSION),snapshot,,-mod=readonly) | ||
|
||
# Setup default variables for building, linking, and installing. | ||
LDFLAGS ?= | ||
|
@@ -175,6 +191,11 @@ go-install-module = \ | |
$(call go-install,$(call go-pkg,$(TOOLS_GO),module,^$(1)$$,,$(2))) | ||
go-install = \ | ||
$(GO) install $(INSTALL_FLAGS) "$(1)" | ||
# Function to determine whether to filter go-make targets. | ||
go-make-filter = $(call xifeq,$(shell if [ ! -f "$(GOBIN)/go-make" ]; then \ | ||
echo "(devel)"; else $(GO) version -m "$(GOBIN)/go-make" | \ | ||
grep -E "^\s*(mod|dep)\s*github.com/tkrop/go-make" | cut -f 4; fi), \ | ||
(devel),%-go-make,) | ||
|
||
# Function for determining the actual version of a go package from downloading. | ||
VERSION_REGEX := 's/.*"Path":\s*"([^"]*)".*"Version":\s*"([^"]*)".*/\1@\2/g' | ||
|
@@ -224,7 +245,7 @@ go-pkg = $(shell awk -v mode="$(2)" -v filter="$(3)" \ | |
|
||
|
||
# Setup go-make to use desired build and config scripts. | ||
GOMAKE_DEP := github.com/tkrop/[email protected].100 | ||
GOMAKE_DEP := github.com/tkrop/[email protected].101 | ||
GOMAKE_MAKEFILE := $(realpath $(firstword $(MAKEFILE_LIST))) | ||
GOMAKE_MAKEFILES := $(GOMAKE_MAKEFILE) \ | ||
$(wildcard Makefile.vars) $(wildcard Makefile.ext) | ||
|
@@ -460,12 +481,9 @@ CMDARGS ?= $(shell awk '{ split("$(CMDWORDS)",seps); \ | |
ARGS ?= | ||
ifdef CMDARGS | ||
ARGS := $(strip $(CMDARGS) $(ARGS)) | ||
$(shell if [ -n "$(ARGS)" ]; then \ | ||
$(call emsg,info,captured arguments [$(ARGS)]); \ | ||
fi) | ||
$(eval $(subst :,\:,$(CMDARGS))::;@:) | ||
endif | ||
|
||
$(call cinfo,make $(filter-out $(ARGS),$(MAKECMDGOALS)) [$(ARGS)]) | ||
|
||
# Optimized generation of mocks. | ||
gen-mocks = \ | ||
|
@@ -524,22 +542,29 @@ TARGETS_UNINSTALL_GO := $(addprefix uninstall-, $(COMMANDS_GO)) | |
TARGETS_UNINSTALL_SH := $(addprefix uninstall-, $(COMMANDS_SH)) | ||
TARGETS_UNINSTALL_NPM := $(addprefix uninstall-, $(TOOLS_NPM:-cli=)) | ||
TARGETS_UNINSTALL_CODACY := $(addprefix uninstall-codacy-, $(CODACY_BINARIES)) | ||
TARGETS_UNINSTALL_ALL := $(TARGETS_UNINSTALL) $(TARGETS_UNINSTALL_GO) \ | ||
$(TARGETS_UNINSTALL_SH) $(TARGETS_UNINSTALL_NPM) $(TARGETS_UNINSTALL_CODACY) | ||
# TARGETS_UNINSTALL_ALL := $(TARGETS_UNINSTALL) $(TARGETS_UNINSTALL_GO) \ | ||
# $(TARGETS_UNINSTALL_SH) $(TARGETS_UNINSTALL_NPM) $(TARGETS_UNINSTALL_CODACY) | ||
TARGETS_UNINSTALL_ALL := $(filter-out $(go-make-filter), \ | ||
$(TARGETS_UNINSTALL) $(TARGETS_UNINSTALL_GO) $(TARGETS_UNINSTALL_SH) \ | ||
$(TARGETS_UNINSTALL_NPM) $(TARGETS_UNINSTALL_CODACY)) | ||
TARGETS_RUN := $(addprefix run-, $(COMMANDS)) | ||
TARGETS_RUN_GO := $(addprefix run-go-, $(COMMANDS)) | ||
TARGETS_RUN_IMAGE := $(addprefix run-image-, $(COMMANDS)) | ||
TARGETS_RUN_CLEAN := $(addprefix run-clean-, $(COMMANDS) db aws) | ||
TARGETS_CLEAN_ALL := clean-init $(TARGETS_CLEAN) clean-run $(TARGETS_UNINSTALL_ALL) | ||
TARGETS_CLEAN_RUN := $(addprefix clean-run-, $(COMMANDS) db aws) | ||
TARGETS_UPDATE_GO := $(addprefix update-,$(sort $(COMMANDS_GO) go-make)) | ||
TARGETS_UPDATE_GO := $(addprefix update-,$(COMMANDS_GO)) | ||
TARGETS_UPDATE_MAKE := $(addprefix update/,$(UPDATE_MAKE)) | ||
TARGETS_UPDATE_MAKE? := $(addsuffix ?,$(TARGETS_UPDATE_MAKE)) | ||
TARGETS_UPDATE_ALL := update-go update-deps update-tools update-make | ||
TARGETS_UPDATE_ALL? := update-go? update-deps? update-make? | ||
TARGETS_UPDATE? := $(filter $(addsuffix ?,$(TARGETS_UPDATE)), \ | ||
$(TARGETS_UPDATE_ALL?) $(TARGETS_UPDATE_MAKE?)) | ||
|
||
$(call cdebug,using TARGETS_UNINSTALL_GO [$(TARGETS_UNINSTALL_GO)]) | ||
$(call cdebug,using FILTER [$(filter-out $(go-make-filter),$(TARGETS_UNINSTALL_GO))]) | ||
$(call cdebug,using TARGETS_UNINSTALL_ALL [$(TARGETS_UNINSTALL_ALL)]) | ||
|
||
## Standard: default targets to test, lint, and build. | ||
|
||
#@ executes the default targets. | ||
|
@@ -810,12 +835,10 @@ go.mod: | |
#@ initialize git pre-commit and commit-message hooks. | ||
init-hooks:: $(GITHOOKS:%=.git/hooks/%) | ||
git-hooks-commit-msg = echo -ne '\#!/bin/sh\n\n\ | ||
echo "make git-verify message $${1}" > /dev/stderr;\n\ | ||
command -v $(GOBIN)/go-make >/dev/null || \\\n\ | ||
GOBIN=$(GOBIN) $(GO) install $(INSTALL_FLAGS) $(GOMAKE_DEP) && \\\n\ | ||
$(GOBIN)/go-make git-verify message $${1};\n' | sed 's/^ *//g' | ||
git-hooks-pre-commit = echo -ne '\#!/bin/sh\n\n\ | ||
echo "make commit" > /dev/stderr;\n\ | ||
command -v $(GOBIN)/go-make >/dev/null || \\\n\ | ||
GOBIN=$(GOBIN) $(GO) install $(INSTALL_FLAGS) $(GOMAKE_DEP) && \\\n\ | ||
$(GOBIN)/go-make commit;\n' | sed 's/^ *//g' | ||
|
@@ -1084,7 +1107,7 @@ test-cdp: | |
${CDP_IMAGE} /bin/bash $(ARGS); | ||
|
||
#@ execute a kind of self-test running the main targets. | ||
test-self:: update-all? update-all clean-all all-clean install-all | ||
test-self:: clean-all all-clean clean-all install-all update-all? update-all | ||
@$(call emsg,success,test-self finished successfully!); | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[1;93mwarning:[0m please customize variables in go-make/run/Makefile.vars | ||
[1;96minfo:[0m captured arguments [message ../internal/make/fixtures/git-verify/msg-failed.in] | ||
[1;96minfo:[0m make git-verify [message ../internal/make/fixtures/git-verify/msg-failed.in] | ||
[1;91merror:[0m commit type missing [title=feat(wrong): all is somehow wrong (org#1)] | ||
[1;91merror:[0m issue missing [titel=feat(wrong): all is somehow wrong (org#1)] | ||
[1;91merror:[0m signed-off-by not the author [sign=Signed-off-by: Alice Doe <[email protected]>; author=John Doe <[email protected]>] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[1;93mwarning:[0m please customize variables in go-make/run/Makefile.vars | ||
[1;96minfo:[0m captured arguments [message ../internal/make/fixtures/git-verify/msg-okay.in] | ||
[1;96minfo:[0m make git-verify [message ../internal/make/fixtures/git-verify/msg-okay.in] | ||
[1;92msuccess:[0m git-verify message ../internal/make/fixtures/git-verify/msg-okay.in [errors=0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
[1;93mwarning:[0m please customize variables in go-make/run/Makefile.vars | ||
[1;96minfo:[0m captured arguments [cat] | ||
[1;96minfo:[0m make call [cat] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[1;93mwarning:[0m please customize variables in go-make/run/Makefile.vars | ||
[1;96minfo:[0m captured arguments [param] | ||
[1;96minfo:[0m make show-targets [param] | ||
[1;96minfo:[0m updating targets [go-make/config/run/targets] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters