-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathMakefile
49 lines (35 loc) · 1.2 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
SRC=*.go cmd/terminal-to-html/*.go
BINARY=terminal-to-html
BUILDCMD=CGO_ENABLED=0 go build -trimpath -o $@ ./cmd/terminal-to-html
VERSION=$(shell cat version.go | grep baseVersion | head -n1 | cut -d \" -f 2)
all: test $(BINARY)
bench:
go test -bench . -benchmem
test:
go test
clean:
rm -f $(BINARY)
rm -rf dist bin
cmd/terminal-to-html/_bindata.go: assets/terminal.css
go-bindata -o cmd/terminal-to-html/bindata.go -nomemcopy assets
$(BINARY): $(SRC)
$(BUILDCMD)
version:
@echo $(VERSION)
# Cross-compiling
GZ_ARCH := linux-amd64 linux-i386 linux-armel linux-arm64 darwin-amd64 darwin-arm64
ZIP_ARCH := windows-i386 windows-amd64
GZ_TARGETS := $(foreach target,$(GZ_ARCH), dist/$(BINARY)-$(VERSION)-$(target).gz)
ZIP_TARGETS := $(foreach target,$(ZIP_ARCH), dist/$(BINARY)-$(VERSION)-$(target).zip)
dist: $(GZ_TARGETS) $(ZIP_TARGETS)
dist/%.gz: bin/%
@[ -d dist ] || mkdir dist
gzip -c $< > $@
dist/%.zip: bin/%
@[ -d dist ] || mkdir dist
@rm -f $@ || true
zip $@ $<
bin/$(BINARY)-$(VERSION)-%: $(SRC)
@[ -d bin ] || mkdir bin
GOOS=$(firstword $(subst -, , $*)) GOARCH=$(lastword $(subst armel, arm, $(subst i386, 386, $(subst -, , $*)))) $(BUILDCMD)
.PHONY: clean bench test dist version