Files
go-grip/Makefile

51 lines
1.5 KiB
Makefile
Raw Permalink Normal View History

2024-12-26 15:59:55 +01:00
.PHONY: all run format emojiscraper build vendor test compile format lint clean
2024-10-09 22:03:53 +02:00
# If the first argument is "run"...
ifeq (run,$(firstword $(MAKECMDGOALS)))
# use the rest as arguments for "run"
RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
# ...and turn them into do-nothing targets
$(eval $(RUN_ARGS):;@:)
endif
2024-10-09 22:03:53 +02:00
GOCMD=go
LDFLAGS="-s -w ${LDFLAGS_OPT}"
2024-12-26 15:59:55 +01:00
all: vendor build format lint ## Format, lint and build
2024-10-09 22:03:53 +02:00
2024-10-31 18:36:41 +01:00
run: ## Run
go run -tags debug main.go $(RUN_ARGS)
emojiscraper: ## Run emojiscraper
go run -tags debug main.go emojiscraper defaults/static/emojis pkg/emoji_map.go
2024-10-31 18:36:41 +01:00
2024-10-09 22:03:53 +02:00
build: ## Build
go build -tags debug -o bin/go-grip main.go
2024-10-09 22:03:53 +02:00
2024-12-26 15:59:55 +01:00
vendor: ## Vendor
go mod vendor
2024-10-09 22:03:53 +02:00
test: ## Test
${GOCMD} test ./...
compile: ## Compile for every OS and Platform
echo "Compiling for every OS and Platform"
GOOS=darwin GOARCH=amd64 go build -o bin/go-grip-darwin-amd64 main.go
GOOS=darwin GOARCH=arm64 go build -o bin/go-grip-darwin-arm64 main.go
GOOS=linux GOARCH=amd64 go build -o bin/go-grip-linux-amd64 main.go
GOOS=linux GOARCH=arm64 go build -o bin/go-grip-linux-arm64 main.go
2024-12-23 17:04:21 +01:00
GOOS=windows GOARCH=amd64 go build -o bin/go-grip-windows-amd64.exe main.go
GOOS=windows GOARCH=arm64 go build -o bin/go-grip-windows-arm64.exe main.go
2024-10-09 22:03:53 +02:00
format: ## Format code
${GOCMD} fmt ./...
lint: ## Run linter
golangci-lint run
clean: ## Cleanup build dir
rm -r bin/
help: ## Display this help screen
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'