dbmate/Makefile

48 lines
1 KiB
Makefile
Raw Normal View History

LDFLAGS := -ldflags '-s'
2015-11-25 10:57:58 -08:00
.PHONY: all
all: test lint build
2015-11-25 10:57:58 -08:00
.PHONY: test
test:
go test -v ./...
2015-11-25 10:57:58 -08:00
.PHONY: lint
2015-11-25 10:57:58 -08:00
lint:
golangci-lint run
2015-11-25 10:57:58 -08:00
.PHONY: wait
wait:
dist/dbmate-linux-amd64 -e MYSQL_URL wait
dist/dbmate-linux-amd64 -e POSTGRESQL_URL wait
.PHONY: clean
clean:
rm -rf dist
2015-12-01 17:36:23 -08:00
.PHONY: build
build: clean build-linux build-macos build-windows
ls -lh dist
.PHONY: build-linux
build-linux:
GOOS=linux GOARCH=amd64 CGO_ENABLED=1 \
go build $(LDFLAGS) -o dist/dbmate-linux-amd64 .
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \
go build $(LDFLAGS) -o dist/dbmate-linux-musl-amd64 .
.PHONY: build-macos
build-macos:
GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 CC=o64-clang CXX=o64-clang++ \
go build $(LDFLAGS) -o dist/dbmate-macos-amd64 .
.PHONY: build-windows
build-windows:
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc-posix CXX=x86_64-w64-mingw32-g++-posix \
go build $(LDFLAGS) -o dist/dbmate-windows-amd64.exe .
.PHONY: docker
docker:
docker-compose build
docker-compose run --rm dbmate make