My Go project has the following structure:
myproject/
handlers/
user/
main.go
books/
main.go
which are a bunch of AWS Lambdas. In my make file I have the following target:
HANDLERS=$(addsuffix main,$(wildcard handlers/*/))
$(HANDLERS): handlers/%/main: *.go handlers/%/main.go
cd ./$(dir $@) && GOOS=linux go build -gcflags="${GCFLAGS}" -o /tmp/main
.PHONY: bins
bins: $(HANDLERS)
so my goal is when I execute make bins
then it creates the the following directory structure:
bins/
user/
main
books/
main
how can I modify my Makefile
to accomplish that? Right now I'm getting the following error:
make: *** No rule to make target `*.go', needed by `handlers/user/main'. Stop.