forked from macdylan/SMFix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
56 lines (43 loc) · 1.28 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
PROJNAME = smfix
ifeq "$(GITHUB_REF_NAME)" ""
VERSION := -X 'main.Version=$(shell git rev-parse --short HEAD)'
else
VERSION := -X 'main.Version=$(GITHUB_REF_NAME)'
endif
FLAGS = -ldflags="-w -s $(VERSION)"
CMD = go build -trimpath $(FLAGS)
DIST = dist/
SRC = $(shell ls *.go | grep -v _test.go)
darwin-arm64: $(SRC)
GOOS=darwin GOARCH=arm64 \
$(CMD) -o $(DIST)$(PROJNAME)-$@ $^
darwin-amd64: $(SRC)
GOOS=darwin GOARCH=amd64 \
$(CMD) -o $(DIST)$(PROJNAME)-$@ $^
linux-amd64: $(SRC)
GOOS=linux GOARCH=amd64 \
$(CMD) -o $(DIST)$(PROJNAME)-$@ $^
linux-arm7: $(SRC)
GOOS=linux GOARCH=arm GOARM=7 \
$(CMD) -o $(DIST)$(PROJNAME)-$@ $^
linux-arm6: $(SRC)
GOOS=linux GOARCH=arm GOARM=6 \
$(CMD) -o $(DIST)$(PROJNAME)-$@ $^
win64: $(SRC)
GOOS=windows GOARCH=amd64 \
$(CMD) -o $(DIST)$(PROJNAME)[email protected] $^
win32: $(SRC)
GOOS=windows GOARCH=386 \
$(CMD) -o $(DIST)$(PROJNAME)[email protected] $^
dep: # Get the dependencies
go mod download
all: dep darwin-arm64 darwin-amd64 linux-amd64 linux-arm7 linux-arm6 win64 win32
@true
all-zip: all
for p in darwin-arm64 darwin-amd64 linux-amd64 linux-arm7 linux-arm6 win64 win32; do \
zip -j $(DIST)$(PROJNAME)-$$p.zip $(DIST)$(PROJNAME)-$$p* README.md LICENSE; \
done
clean:
rm -f $(DIST)$(PROJNAME)-*
test:
go test -v $(SRC) smfix_test.go