forked from Vistara-Labs/vimana
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (41 loc) · 1.33 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
48
49
50
BINARY_NAME=vimana
# Version and build time information
VERSION=v0.0.12
BUILD_TIME=$(shell date +%FT%T%z)
# Flags passed to `go build`
LDFLAGS=-ldflags "-X vimana.Version=${VERSION} -X vimana.BuildTime=${BUILD_TIME}"
# Default command when simply typing `make`
all: build
# Compiles the binary for mac
build:
@echo "Building for Mac..."
mkdir -p ${BINARY_NAME}-darwin-arm64
GOOS=darwin GOARCH=arm64 go build ${LDFLAGS} -o ${BINARY_NAME}-darwin-arm64 -v ./...
mkdir -p ${HOME}/.vimana
cp config.toml ${HOME}/.vimana/config.toml
# Cleans our project: deletes binaries
clean:
@echo "Cleaning..."
go clean
rm -f ${BINARY_NAME}
# Runs tests
test:
@echo "Testing..."
go test -v ./...
# Installs our project: copies binaries to $GOPATH/bin
install:
@echo "Installing..."
go install ${LDFLAGS} ./...
mkdir -p ${HOME}/.vimana
cp config.toml ${HOME}/.vimana/config.toml
# Cross compilation
build-linux:
@echo "Building for Linux..."
mkdir -p ${BINARY_NAME}-linux-amd64
GOOS=linux GOARCH=amd64 go build ${LDFLAGS} -o ${BINARY_NAME}-linux-amd64 -v ./...
mkdir -p ${BINARY_NAME}-linux-arm64
GOOS=linux GOARCH=arm64 go build ${LDFLAGS} -o ${BINARY_NAME}-linux-arm64 -v ./...
mkdir -p ${HOME}/.vimana
cp config.toml ${HOME}/.vimana/config.toml
.PHONY: all build clean test install build-linux
# tar -czvf vimana_bins21.tar.gz vimana-linux-amd64/