AVAIL_CMDS:=$(shell find . -mindepth 1 -name 'main.go' | cut -d '/' -f 2) default: clean $(patsubst %,.bin/%,$(AVAIL_CMDS)) clean: rm -rf .bin .bin/%: export CGO_ENABLED=0 .bin/%: cd $* && go build \ -trimpath \ -ldflags "-s -w -X main.version=$(shell git describe --tags --always || echo dev)" \ -o $(CURDIR)/.bin/$*