forked from amacneil/dbmate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
47 lines (37 loc) · 1.02 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
LDFLAGS := -ldflags '-s'
.PHONY: all
all: test lint build
.PHONY: test
test:
go test -v ./...
.PHONY: lint
lint:
golangci-lint run
.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
.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