-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile
55 lines (44 loc) · 1.41 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
SOURCE = $(wildcard *.go)
TAG ?= $(shell git describe --tags)
GOBUILD = go build -ldflags '-w'
ALL = \
$(foreach arch,x64 x32,\
$(foreach suffix,linux osx windows,\
build/gosync-$(suffix)-$(arch))) \
$(foreach arch,arm arm64,\
build/gosync-linux-$(arch))
all: test build
build: clean module test $(ALL)
# cram is a python app, so 'easy_install/pip install cram' to run tests
test:
echo "No tests"
#cram tests/*.test
clean:
rm -f $(ALL)
module:
go mod vendor
# os is determined as thus: if variable of suffix exists, it's taken, if not, then
# suffix itself is taken
osx = darwin
build/gosync-%-x64: $(SOURCE)
@mkdir -p $(@D)
CGO_ENABLED=0 GOOS=$(firstword $($*) $*) GOARCH=amd64 $(GOBUILD) -o $@
build/gosync-%-x32: $(SOURCE)
@mkdir -p $(@D)
CGO_ENABLED=0 GOOS=$(firstword $($*) $*) GOARCH=386 $(GOBUILD) -o $@
build/gosync-linux-arm: $(SOURCE)
@mkdir -p $(@D)
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 $(GOBUILD) -o $@
build/gosync-linux-arm64: $(SOURCE)
@mkdir -p $(@D)
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $(GOBUILD) -o $@
release: build
github-release release -u webdevops -r go-sync -t "$(TAG)" -n "$(TAG)" --description "$(TAG)"
@for x in $(ALL); do \
echo "Uploading $$x" && \
github-release upload -u webdevops \
-r go-sync \
-t $(TAG) \
-f "$$x" \
-n "$$(basename $$x)"; \
done