Skip to content

Instantly share code, notes, and snippets.

@srbry
Created October 2, 2018 08:11
Show Gist options
  • Save srbry/6cc26135013370b6ae09b1d4ee8fa948 to your computer and use it in GitHub Desktop.
Save srbry/6cc26135013370b6ae09b1d4ee8fa948 to your computer and use it in GitHub Desktop.
Golang lambda compilation makefile
help:
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
functions := $(shell find functions -name \*main.go | awk -F'/' '{print $$2}')
build: ## Build golang binaries
@dep ensure
@for function in $(functions) ; do \
env GOOS=linux go build -ldflags="-s -w" -o bin/$$function functions/$$function/main.go ; \
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment