-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
48 lines (36 loc) · 1.44 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
version := 0.0.3
packageNameNix := rexport-linux-amd64-$(version).tar.gz
packageNameMac := rexport-darwin-amd64-$(version).tar.gz
packageNameWindows := rexport-windows-amd64-$(version).tar.gz
build_dir := output
build_dir_linux := output-linux
build_dir_mac := output-mac
build_dir_windows := output-windows
build: format configure build-linux build-mac build-windows
dev: format configure build-linux test
devd: format configure build-linux test-delete
format:
go fmt ./...
configure:
mkdir -p $(build_dir)
mkdir -p $(build_dir_linux)
mkdir -p $(build_dir_mac)
mkdir -p $(build_dir_windows)
build-linux:
env GOOS=linux GOARCH=amd64 go build -o ./$(build_dir_linux)/rexport -ldflags "-X main.version=$(version)"
@cd ./$(build_dir_linux) && tar zcf ../$(build_dir)/$(packageNameNix) .
build-mac:
env GOOS=darwin GOARCH=amd64 go build -o ./$(build_dir_mac)/rexport -ldflags "-X main.version=$(version)"
@cd ./$(build_dir_mac) && tar zcf ../$(build_dir)/$(packageNameMac) .
build-windows:
env GOOS=windows GOARCH=amd64 go build -o ./$(build_dir_windows)/rexport.exe -ldflags "-X main.version=$(version)"
@cd ./$(build_dir_windows) && tar zcf ../$(build_dir)/$(packageNameWindows) .
clean:
rm -rf $(build_dir)
rm -rf $(build_dir_linux)
rm -rf $(build_dir_mac)
rm -rf $(build_dir_windows)
test:
./output-linux/rexport -config sample-config.yml
test-delete:
./output-linux/rexport -config sample-config.yml -delete-new-volumes