forked from goplus/gop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
62 lines (45 loc) · 1.73 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
NAME := gop
RELEASE_VERSION := `git describe --tags`
BUILD_ROOT_DIR := build-dir
.PHONY: clean all
all: build
clean:
rm -rf $(BUILD_ROOT_DIR)/*
rm -f bin/*
build:
go run cmd/make.go -install
dist:
$(MAKE) clean
mkdir -p bin/
go build -o $(BUILD_ROOT_DIR)/install cmd/make.go
$(MAKE) build-all
build-all: darwin-amd64.zip darwin-arm64.zip linux-386.zip linux-amd64.zip \
linux-armv7.zip windows-386.zip windows-amd64.zip windows-armv7.zip windows-arm64.zip
build-dist:
$(BUILD_ROOT_DIR)/install -install
%.zip: %
@echo "Building $(NAME)-$(RELEASE_VERSION)-$@"
@mkdir -p bin/
@rm -rf bin/*
$(BUILD_ROOT_DIR)/install -install
@rm -f $(BUILD_ROOT_DIR)/$(NAME)-$(RELEASE_VERSION)-$@
zip -r $(BUILD_ROOT_DIR)/$(NAME)-$(RELEASE_VERSION)-$@ . -x ".*" -x "*/.*" -x "$(BUILD_ROOT_DIR)/*"
@echo "$(NAME)-$(RELEASE_VERSION)-$@ Done"
darwin-amd64:
$(MAKE) GOARCH=amd64 GOOS=darwin BUILD_DIR=$(BUILD_ROOT_DIR)/$@/bin build-dist
darwin-arm64:
$(MAKE) GOARCH=arm64 GOOS=darwin BUILD_DIR=$(BUILD_ROOT_DIR)/$@/bin build-dist
linux-386:
$(MAKE) GOARCH=386 GOOS=linux BUILD_DIR=$(BUILD_ROOT_DIR)/$@/bin build-dist
linux-amd64:
$(MAKE) GOARCH=amd64 GOOS=linux BUILD_DIR=$(BUILD_ROOT_DIR)/$@/bin build-dist
linux-armv7:
$(MAKE) GOARCH=arm GOOS=linux GOARM=7 BUILD_DIR=$(BUILD_ROOT_DIR)/$@/bin build-dist
windows-386:
$(MAKE) GOARCH=386 GOOS=windows EXE_SUFFIX=.exe BUILD_DIR=$(BUILD_ROOT_DIR)/$@/bin build-dist
windows-amd64:
$(MAKE) GOARCH=amd64 GOOS=windows EXE_SUFFIX=.exe BUILD_DIR=$(BUILD_ROOT_DIR)/$@/bin build-dist
windows-armv7:
$(MAKE) GOARCH=arm GOOS=windows EXE_SUFFIX=.exe GOARM=7 BUILD_DIR=$(BUILD_ROOT_DIR)/$@/bin build-dist
windows-arm64:
$(MAKE) GOARCH=arm64 GOOS=windows EXE_SUFFIX=.exe BUILD_DIR=$(BUILD_ROOT_DIR)/$@/bin build-dist