-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
43 lines (33 loc) · 1.49 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
NAME=$(lastword $(subst /, ,$(abspath .)))
VERSION=$(shell git.exe describe --tags 2>nul || echo v0.0.0)
GOOPT=-ldflags "-s -w -X main.version=$(VERSION)"
ifeq ($(OS),Windows_NT)
SHELL=CMD.EXE
SET=SET
else
SET=export
endif
all:
go fmt $(foreach X,$(wildcard internal/*),&& cd $(X) && go fmt && cd ../..)
$(SET) "CGO_ENABLED=0" && go build $(GOOPT)
_package:
go fmt
$(SET) "CGO_ENABLED=0" && go build $(GOOPT)
zip $(NAME)-$(VERSION)-$(GOOS)-$(GOARCH).zip $(NAME)$(EXT)
package:
$(SET) "GOOS=linux" && $(SET) "GOARCH=386" && $(MAKE) _package EXT=
$(SET) "GOOS=linux" && $(SET) "GOARCH=amd64" && $(MAKE) _package EXT=
$(SET) "GOOS=windows" && $(SET) "GOARCH=386" && $(MAKE) _package EXT=.exe
$(SET) "GOOS=windows" && $(SET) "GOARCH=amd64" && $(MAKE) _package EXT=.exe
manifest:
make-scoop-manifest *-windows-*.zip > $(NAME).json
test:
$(SET) "GOFILE=const.go" && $(SET) "GOLINE=3" && $(SET) "GOPACKAGE=dos" && cd example && "../go-importconst" -d
test-lowercamel:
$(SET) "GOFILE=const.go" && $(SET) "GOLINE=3" && $(SET) "GOPACKAGE=dos" && cd example && "../go-importconst" -d -lowercamel
test-uppercamel:
$(SET) "GOFILE=const.go" && $(SET) "GOLINE=3" && $(SET) "GOPACKAGE=dos" && cd example && "../go-importconst" -d -uppercamel
test-underscore:
$(SET) "GOFILE=const.go" && $(SET) "GOLINE=3" && $(SET) "GOPACKAGE=dos" && cd example && "../go-importconst" -d -prefix _
test2:
$(SET) "GOFILE=const.go" && $(SET) "GOLINE=3" && $(SET) "GOPACKAGE=dos" && cd example2 && "../go-importconst" -d