-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
62 lines (48 loc) · 1.66 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
SOURCE = $(wildcard *.go)
TAG ?= $(shell git describe --tags)
GOBUILD = go build -ldflags '-w'
ALL = \
$(foreach arch,64 32,\
$(foreach suffix,linux osx,\
build/go-syslogd-$(arch)-$(suffix))) \
$(foreach arch,arm arm64,\
build/go-syslogd-$(arch)-linux)
all: test build
docker:
docker build . -t webdevops/go-syslogd
docker-dev:
docker build -f Dockerfile.develop . -t webdevops/go-syslogd:develop
docker-run-dev: docker-dev
docker run -ti --rm -w "$$(pwd)" -v "$$(pwd):$$(pwd):ro" --name go-syslogd webdevops/go-syslogd:develop sh
build: clean 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)
# os is determined as thus: if variable of suffix exists, it's taken, if not, then
# suffix itself is taken
osx = darwin
build/go-syslogd-64-%: $(SOURCE)
@mkdir -p $(@D)
CGO_ENABLED=0 GOOS=$(firstword $($*) $*) GOARCH=amd64 $(GOBUILD) -o $@
build/go-syslogd-32-%: $(SOURCE)
@mkdir -p $(@D)
CGO_ENABLED=0 GOOS=$(firstword $($*) $*) GOARCH=386 $(GOBUILD) -o $@
build/go-syslogd-arm-linux: $(SOURCE)
@mkdir -p $(@D)
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 $(GOBUILD) -o $@
build/go-syslogd-arm64-linux: $(SOURCE)
@mkdir -p $(@D)
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $(GOBUILD) -o $@
release: build
github-release release -u webdevops -r go-syslogd -t "$(TAG)" -n "$(TAG)" --description "$(TAG)"
@for x in $(ALL); do \
echo "Uploading $$x" && \
github-release upload -u webdevops \
-r go-syslogd \
-t $(TAG) \
-f "$$x" \
-n "$$(basename $$x)"; \
done