-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
26 lines (18 loc) · 703 Bytes
/
Copy pathMakefile
File metadata and controls
26 lines (18 loc) · 703 Bytes
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
OS_ARCHS := linux-amd64 linux-386 windows-amd64 windows-386 darwin-amd64
SRCS := $(wildcard *.go)
VER := $(shell grep -Eo 'VERSION = `(.*)`' main.go | cut -d'`' -f2)
TGTS := $(foreach os_arch,$(OS_ARCHS),bin/saver-$(os_arch))
BUILD := $(shell echo `whoami`@`hostname -s` on `date`)
LDFLAGS := -ldflags='-X "main.build=$(BUILD)"'
.PHONY: clean dev test
all: $(TGTS) bin/checksums.md5
test: $(TGTS)
clean:
@rm -f bin/*
dev: $(SRCS)
GOOS=linux GOARCH=amd64 go build $(LDFLAGS) -o saver-$@-$(VER) .
$(TGTS): $(SRCS)
GOOS=$(word 2,$(subst -, ,$@)) GOARCH=$(word 3,$(subst -, ,$@)) go build $(LDFLAGS) -o $@-$(VER) .
$(SRCS):
bin/checksums.md5:
cd bin && md5sum * > checksums.md5