16 lines
390 B
Makefile
16 lines
390 B
Makefile
targets := $(patsubst cmd/%,%,$(wildcard cmd/*))
|
|
input := $(wildcard hbot/* go.mod go.sum)
|
|
all: $(targets)
|
|
define gobuild
|
|
$(1): $$(wildcard cmd/$(1)/*.go) $$(input)
|
|
CGO_ENABLED=0 go build -buildmode=pie -v -o $(1) ./cmd/$(1)
|
|
endef
|
|
$(foreach target,$(targets),$(eval $(call gobuild,$(target))))
|
|
clean:
|
|
rm -f $(targets)
|
|
fmt:
|
|
go fmt ./...
|
|
test:
|
|
go test -v ./...
|
|
.PHONY: all clean fmt test
|