dbmate/Makefile
2018-01-22 21:49:12 -08:00

36 lines
674 B
Makefile

DC := docker-compose
BUILD_FLAGS := -ldflags '-s'
PACKAGES := ./cmd/... ./pkg/...
.PHONY: all
all: install test lint build
.PHONY: install
install:
go install -v $(PACKAGES)
.PHONY: test
test:
go test -v $(PACKAGES)
.PHONY: lint
lint:
golint -set_exit_status $(PACKAGES)
go vet $(PACKAGES)
errcheck $(PACKAGES)
.PHONY: clean
clean:
rm -rf dist
.PHONY: build
build: clean
GOARCH=amd64 go build $(BUILD_FLAGS) -o dist/dbmate-linux-amd64 ./cmd/dbmate
# musl target does not support sqlite
GOARCH=amd64 CGO_ENABLED=0 go build $(BUILD_FLAGS) -o dist/dbmate-linux-musl-amd64 ./cmd/dbmate
.PHONY: docker
docker:
$(DC) pull
$(DC) build
$(DC) run --rm dbmate make