forked from awilliams/linode-inventory
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (39 loc) · 1.26 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
BIN=linode-inventory
VERSION=0.1.0
README=README.md
LICENSE=LICENSE
EXAMPLE_INI=linode-inventory.ini.example
RELEASE_DIR=release
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOINSTALL=$(GOCMD) install
GOTEST=$(GOCMD) test
GODEP=$(GOCMD) get -d -v ./...
GOFMT=gofmt -w
default: build
build:
$(GODEP)
GOARCH=amd64 GOOS=linux $(GOBUILD) -o bin/linux-amd64/$(BIN)
GOARCH=386 GOOS=linux $(GOBUILD) -o bin/linux-386/$(BIN)
GOARCH=amd64 GOOS=darwin $(GOBUILD) -o bin/darwin-amd64/$(BIN)
package:
rm -rf $(RELEASE_DIR)/$(BIN)
mkdir $(RELEASE_DIR)/$(BIN)
cp $(README) $(RELEASE_DIR)/$(BIN)
cp $(LICENSE) $(RELEASE_DIR)/$(BIN)
cp $(EXAMPLE_INI) $(RELEASE_DIR)/$(BIN)/linode-inventory.example.ini
cp -f bin/linux-amd64/$(BIN) $(RELEASE_DIR)/$(BIN)/$(BIN)
tar -czf $(RELEASE_DIR)/$(BIN)-linux-amd64-v$(VERSION).tar.gz -C $(RELEASE_DIR) $(BIN)
cp -f bin/linux-386/$(BIN) $(RELEASE_DIR)/$(BIN)/$(BIN)
tar -czf $(RELEASE_DIR)/$(BIN)-linux-386-v$(VERSION).tar.gz -C $(RELEASE_DIR) $(BIN)
cp -f bin/darwin-amd64/$(BIN) $(RELEASE_DIR)/$(BIN)/$(BIN)
tar -czf $(RELEASE_DIR)/$(BIN)-darwin-amd64-v$(VERSION).tar.gz -C $(RELEASE_DIR) $(BIN)
rm -rf $(RELEASE_DIR)/$(BIN)
format:
$(GOFMT) ./**/*.go
clean:
$(GOCLEAN)
test:
$(GODEP) && $(GOTEST) -v ./...