eia-api-go/Makefile

31 lines
737 B
Makefile

# Variables
CLIENT_PKG := ./cmd/eia-client
CLIENT_GEN_FILE := ./api/eiaapi.gen.go
GO_FORMATTER := gofumpt
.PHONY: all generate build install clean
# Default target
all: generate build
# Generate code
generate:
go generate ./...
# Fix errors in generated code
sed -E -i '' 's/Total[[:space:]]+\*int/Total *string/g' $(CLIENT_GEN_FILE)
sed -E -i '' 's/Command[[:space:]]+\*\[\]string/Command *string/g' $(CLIENT_GEN_FILE)
# Pretty it up
$(GO_FORMATTER) -w $(CLIENT_GEN_FILE)
# Build the client command binary
build: generate
go build -o bin/eia-client $(CLIENT_PKG)
# Install the client command binary
install: generate
go install -v $(CLIENT_PKG)
# Clean up generated files and build artifacts
clean:
rm -rf bin/eia-client