Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
This commit is contained in:
Angira Kekteeva 2022-10-16 19:14:02 +04:00 committed by Alex Vanin
parent b1c5cb0ad8
commit e42fbbbe9f
2 changed files with 17 additions and 3 deletions

View file

@ -45,6 +45,7 @@ dep:
@CGO_ENABLED=0 \ @CGO_ENABLED=0 \
go mod tidy -v && echo OK go mod tidy -v && echo OK
# Run `make %` in Golang container, for more information run `make help.docker/%`
docker/%: docker/%:
$(if $(filter $*,all $(BINS)), \ $(if $(filter $*,all $(BINS)), \
@echo "=> Running 'make $*' in clean Docker environment" && \ @echo "=> Running 'make $*' in clean Docker environment" && \
@ -111,16 +112,18 @@ docker/lint:
version: version:
@echo $(VERSION) @echo $(VERSION)
# Clean up # Clean up files
clean: clean:
rm -rf .cache rm -rf .cache
rm -rf $(BINDIR) rm -rf $(BINDIR)
# Generate code from .proto files
protoc: protoc:
# Protoc generate
@for f in `find . -type f -name '*.proto' -not -path './vendor/*'`; do \ @for f in `find . -type f -name '*.proto' -not -path './vendor/*'`; do \
echo "⇒ Processing $$f "; \ echo "⇒ Processing $$f "; \
protoc \ protoc \
--go_out=paths=source_relative:. $$f; \ --go_out=paths=source_relative:. $$f; \
done done
rm -rf vendor rm -rf vendor
include help.mk

13
help.mk
View file

@ -8,4 +8,15 @@ help:
@echo '' @echo ''
@echo ' Targets:' @echo ' Targets:'
@echo '' @echo ''
@awk '/^#/{ comment = substr($$0,3) } comment && /^[a-zA-Z][a-zA-Z0-9_-]+ ?:/{ print " ", $$1, comment }' $(MAKEFILE_LIST) | column -t -s ':' | grep -v 'IGNORE' | sort | uniq @awk '/^#/{ comment = substr($$0,3) } comment && /^[a-zA-Z][a-zA-Z0-9.%_/-]+ ?:/{ print " ", $$1, comment }' $(MAKEFILE_LIST) | column -t -s ':' | grep -v 'IGNORE' | sort | uniq
# Show help for docker/% IGNORE
help.docker/%:
$(eval TARGETS:=$(notdir all lint) ${BINS})
@echo ' Usage:'
@echo ''
@echo ' make docker/% -- Run `make %` in Golang container'
@echo ''
@echo ' Supported docker targets:'
@echo ''
@$(foreach bin, $(TARGETS), echo ' ' $(bin);)