-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
70 lines (53 loc) · 2.16 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
TOPDIR=.
include $(TOPDIR)/Makefile.common.includes
export VERSION=$(Version)
BINPATH=bin$(SLASH)
SRCFiles=$(wildcard *$(SLASH)*.go *.go)
COVERAGE=cov.out
BINNAME=bratstandoff-to-json
UTFILE=Ofilename
setup: go_get
srcFile:
echo "SRCFiles ... $(SRCFiles)"
go_get: go.mod
echo "Setting up go modules"
$(GO) get -v
all: setup test productionbuild
productionbuild: productionbuildWindows productionbuildLinux productionbuildMac productionbuildMacM1
productionbuildWindows:
$(eval BIN_OS:=$(GOOSWIN))
$(eval ARCH_OS=$(GOARCHx64))
$(eval OUTEXT=$(WINEXT))
$(eval OUTBIN=$(BINNAME).$(VERSION).$(BIN_OS).$(ARCH_OS)$(OUTEXT))
@echo "building binary for $(BIN_OS) and $(ARCH_OS)"
CGO_ENABLED=0 GOOS=$(BIN_OS) GOARCH=$(ARCH_OS) $(GO) build -v -tags "production" -ldflags="-s -w -X 'main.Version=$(VERSION)'" -o $(BINPATH)$(OUTBIN)
productionbuildMac:
$(eval BIN_OS=$(GOOSMAC))
$(eval ARCH_OS=$(GOARCHx64))
$(eval OUTEXT=$(MACEXT))
$(eval OUTBIN=$(BINNAME).$(VERSION).$(BIN_OS).$(ARCH_OS)$(OUTEXT))
@echo "building binary for $(BIN_OS) and $(ARCH_OS)"
CGO_ENABLED=0 GOOS=$(BIN_OS) GOARCH=$(ARCH_OS) $(GO) build -v -tags "production" -ldflags="-s -w -X 'main.Version=$(VERSION)'" -o $(BINPATH)$(OUTBIN)
productionbuildMacM1:
$(eval BIN_OS=$(GOOSMAC))
$(eval ARCH_OS=$(GOARCHM1))
$(eval OUTEXT=$(MACEXT))
$(eval OUTBIN=$(BINNAME).$(VERSION).$(BIN_OS).$(ARCH_OS)$(OUTEXT))
@echo "building binary for $(BIN_OS) and $(ARCH_OS)"
CGO_ENABLED=0 GOOS=$(BIN_OS) GOARCH=$(ARCH_OS) $(GO) build -v -tags "production" -ldflags="-s -w -X 'main.Version=$(VERSION)'" -o $(BINPATH)$(OUTBIN)
productionbuildLinux:
$(eval BIN_OS=$(GOOSLINUX))
$(eval ARCH_OS=$(GOARCHx64))
$(eval OUTEXT=$(LINEXT))
$(eval OUTBIN=$(BINNAME).$(VERSION).$(BIN_OS).$(ARCH_OS)$(OUTEXT))
@echo "building binary for $(BIN_OS) and $(ARCH_OS)"
CGO_ENABLED=0 GOOS=$(BIN_OS) GOARCH=$(ARCH_OS) $(GO) build -v -tags "production" -ldflags="-s -w -X 'main.Version=$(VERSION)'" -o $(BINPATH)$(OUTBIN)
test: unittest
unittest: $(COVERAGE)
$(COVERAGE): $(SRCFiles)
echo "initiating test..."
$(GO) test -p 1 -tags "development" -coverprofile=$(COVERAGE) .$(SLASH)...
clean:
@-$(RM) $(COVERAGE)
@-$(RM) $(UTFILE)
@-$(RM) $(BINPATH)