BINARY_NAME=tienda-flores
IMAGE_NAME=mamavia.duckdns.org/paco/tienda-flores:latest

.PHONY: all fmt fmt-check test build build-amd64 build-arm64 clean

all: fmt test build

fmt:
	gofmt -w .

fmt-check:
	@test -z "$$(gofmt -l .)" || (echo "Unformatted files:" && gofmt -l . && exit 1)

test:
	go test -v ./...

build:
	CGO_ENABLED=0 go build -ldflags='-s -w' -o $(BINARY_NAME) ./cmd/tienda

build-amd64:
	CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags='-s -w' -o $(BINARY_NAME)-amd64 ./cmd/tienda

build-arm64:
	CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags='-s -w' -o $(BINARY_NAME)-arm64 ./cmd/tienda

clean:
	rm -f $(BINARY_NAME) $(BINARY_NAME)-amd64 $(BINARY_NAME)-arm64 ca-certificates.crt
