Skip to content

Commit

Permalink
chore: minor improvements to makefile/help
Browse files Browse the repository at this point in the history
  • Loading branch information
boyvinall committed Jan 2, 2024
1 parent b7a9c80 commit 90ef6b8
Showing 1 changed file with 24 additions and 28 deletions.
52 changes: 24 additions & 28 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ define PROMPT
@echo
endef

.PHONY: help # Show help
help:
@echo
@echo "Usage: make [target...]"
@echo
@grep -E '^(.PHONY|#####)' Makefile | \
sed \
-e 's/\.PHONY: \(.*\) # \(.*\)/ \1\t\2/' \
-e 's/^#####* \(.*\) #*$$/\n\1:\n/' | \
expand -t25

############# Application targets #############

GRPC_PROTO=\
Expand Down Expand Up @@ -44,30 +55,18 @@ generate: \
$(call PROMPT,$@)
protoc --go_out=paths=source_relative:. $<

.PHONY: clean # Delete build artifacts
.PHONY: clean # Delete build/generated artifacts
clean:
$(call PROMPT,$@)
rm -rf bin
rm -rf pkg/boomer/*.pb.go
rm -rf test/*.png

.PHONY: purge # More aggressive clean .. delete anything not in git
purge:
purge: clean
$(call PROMPT,$@)
git clean -fdx

############# Tooling targets #############

.PHONY: download-dependencies # Download go dependencies
download-dependencies:
$(call PROMPT,$@)
go mod download -x

.PHONY: install-tools # Install required build tools
install-tools: download-dependencies
$(call PROMPT,$@)
@cat tools.go | grep _ | awk -F'"' '{print $$2}' | xargs -tI % go install %

############# Stack targets #############

.PHONY: start # Start the docker-compose stack
Expand All @@ -85,22 +84,19 @@ run-client:
$(call PROMPT,$@)
go run ./cmd/boomer-cli/main.go

############# Stack targets #############

.PHONY: browser-tests # Run browser tests
.PHONY: browser-tests # Run browser tests against the stack
browser-tests:
$(call PROMPT,$@)
cd test && go run main.go

#############
############# Tooling targets #############

.PHONY: help # Show help
help:
@echo
@echo "Usage: make [target...]"
@echo
@grep -E '^(.PHONY|#####)' Makefile | \
sed \
-e 's/\.PHONY: \(.*\) # \(.*\)/ \1\t\2/' \
-e 's/^#####.*$$//' | \
expand -t25
.PHONY: download-dependencies # Download go dependencies
download-dependencies:
$(call PROMPT,$@)
go mod download -x

.PHONY: install-tools # Install required build tools
install-tools: download-dependencies
$(call PROMPT,$@)
@cat tools.go | grep _ | awk -F'"' '{print $$2}' | xargs -tI % go install %

0 comments on commit 90ef6b8

Please sign in to comment.