-
Notifications
You must be signed in to change notification settings - Fork 27
/
Makefile
146 lines (104 loc) · 7.12 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
.PHONY: build push README.md clean binary
APP=gif
NAME := yeetgif
REPOSITORY := quay.io/sergey_grebenshchikov/$(NAME)
VERSION := 1.23.6
VERSION_COMMIT := $(VERSION)-$(shell printf "%s" "$$(git rev-parse HEAD)" | cut -c 1-8)
PACKAGES := $(shell go list -f {{.Dir}} ./...)
GOFILES := $(addsuffix /*.go,$(PACKAGES))
GOFILES := $(wildcard $(GOFILES))
build: Dockerfile $(GOFILES)
docker build -t $(NAME) -t $(REPOSITORY):latest -t $(REPOSITORY):$(VERSION) .
push: build
docker push $(REPOSITORY):latest
docker push $(REPOSITORY):$(VERSION)
clean:
rm -rf binaries zip
# go get -u github.com/github/hub
release: zip README.md
git reset
dep ensure
git add vendor
git add Gopkg.toml Gopkg.lock
git commit -m "dep ensure" || true
git reset
git add README.template.md README.md Makefile
git commit -m "Release $(VERSION)" || true
git push
hub release create $(VERSION) -m "$(VERSION)" -a release/$(APP)_$(VERSION)_osx_x86_64.tar.gz -a release/$(APP)_$(VERSION)_windows_x86_64.zip -a release/$(APP)_$(VERSION)_linux_x86_64.tar.gz -a release/$(APP)_$(VERSION)_osx_x86_32.tar.gz -a release/$(APP)_$(VERSION)_windows_x86_32.zip -a release/$(APP)_$(VERSION)_linux_x86_32.tar.gz -a release/$(APP)_$(VERSION)_linux_arm64.tar.gz
README.md: binary
<README.template.md subst USAGE_rain="$$($(APP) rain -h 2>&1)" USAGE_emoji="$$($(APP) emoji -h 2>&1)" USAGE_text="$$($(APP) text -h 2>&1)" USAGE_chop="$$($(APP) chop -h 2>&1)" USAGE_erase="$$($(APP) erase -h 2>&1)" USAGE_roll="$$($(APP) roll -h 2>&1)" USAGE_wobble="$$($(APP) wobble -h 2>&1)" USAGE_pulse="$$($(APP) pulse -h 2>&1)" USAGE_zoom="$$($(APP) zoom -h 2>&1)" USAGE_shake="$$($(APP) shake -h 2>&1)" USAGE_woke="$$($(APP) woke -h 2>&1)" USAGE_fried="$$($(APP) fried -h 2>&1)" USAGE_hue="$$($(APP) hue -h 2>&1)" USAGE_tint="$$($(APP) tint -h 2>&1)" USAGE_resize="$$($(APP) resize -h 2>&1)" USAGE_crop="$$($(APP) crop -h 2>&1)" USAGE_optimize="$$($(APP) optimize -h 2>&1)" USAGE_compose="$$($(APP) compose -h 2>&1)" USAGE_crowd="$$($(APP) crowd -h 2>&1)" USAGE_cat="$$($(APP) cat -h 2>&1)" USAGE_meta="$$($(APP) meta -h 2>&1)" USAGE="$$($(APP) -h 2>&1)" VERSION="$(VERSION)" APP="$(APP)" >README.md
examples: doc/terminal.gif doc/roll.gif doc/wobble.gif doc/pulse.gif doc/zoom.gif doc/shake.gif doc/woke.gif doc/fried.gif doc/hue.gif doc/tint.gif doc/compose.gif doc/crowd.gif doc/erase.gif doc/gunther.gif doc/rain.gif doc/rain-thonk.gif
doc/terminal.gif: doc/wobble.gif
<doc/terminal.png gif -n 5 fried -j 0 -a 0 -t 0 -u 1 -o 1 -n 0.9 | gif compose -s 1.0 -p right doc/wobble.gif | gif optimize -n --kb=999 > doc/terminal.gif
doc/erase.gif: doc/skeledance.gif
<doc/skeledance.gif gif -d 80 erase -t 0.05 -s 100 >doc/erase.gif
doc/roll.gif:
<doc/eggplant.png gif roll > doc/roll.gif
doc/wobble.gif:
gif -r emoji -s 128 eggplant | gif -n 30 wobble -a 10 -f 2 > doc/wobble.gif
doc/rain.gif:
gif -r emoji -s 64 aubergine | gif -r rain | gif optimize -n --kb=999 > doc/rain.gif
doc/rain-thonk.gif:
zsh -c "gif -r emoji think | gif -r roll | gif -r rain <(gif -r emoji -s 96 aubergine) <(gif -r emoji -s 96 peach) | gif optimize -n --kb=4096 > doc/rain-thonk.gif"
doc/rain-scream.gif:
zsh -c "gif -r emoji scream | gif -r pulse | gif -r rain <(gif -r emoji -s 100 baguette) | gif compose -z under <(gif -r zoom 1.1,1.0,1.1 <doc/galaxy.jpg) | gif -r fried -t 0.05 -u 1.5 -o 1.5 -n 1.1 -a 0.1 | gif optimize -n --kb=4096 > doc/rain-scream.gif"
doc/pulse.gif:
<doc/eggplant.png gif pulse > doc/pulse.gif
doc/zoom.gif:
<doc/eggplant.png gif zoom > doc/zoom.gif
doc/shake.gif:
<doc/eggplant.png gif shake > doc/shake.gif
doc/woke.gif:
<doc/yeet.png gif woke "[[32,60],[92,60]]" > doc/woke.gif
doc/fried.gif:
<doc/yeet.png gif fried > doc/fried.gif
doc/hue.gif:
<doc/eggplant.png gif hue > doc/hue.gif
doc/tint.gif:
<doc/eggplant.png gif tint > doc/tint.gif
doc/compose.gif:
<doc/yeet.png gif compose -p left -s 0.8 -x 50 doc/wobble.gif > doc/compose.gif
doc/crowd.gif:
<doc/wobble.gif gif crowd > doc/crowd.gif
doc/gunther.gif:
<doc/gunther.jpg gif woke -t center -a 0.7 -s 1.3 "[[160,130],[245,130]]" | gif text "i showed u my skul gun answer me" | gif fried | gif zoom 1.1 | gif optimize -n --kb=999 > doc/gunther.gif
binary:
go install ./cmd/$(APP)
zip: release/$(APP)_$(VERSION)_osx_x86_64.tar.gz release/$(APP)_$(VERSION)_windows_x86_64.zip release/$(APP)_$(VERSION)_linux_x86_64.tar.gz release/$(APP)_$(VERSION)_osx_x86_32.tar.gz release/$(APP)_$(VERSION)_windows_x86_32.zip release/$(APP)_$(VERSION)_linux_x86_32.tar.gz release/$(APP)_$(VERSION)_linux_arm64.tar.gz
binaries: binaries/osx_x86_64/$(APP) binaries/windows_x86_64/$(APP).exe binaries/linux_x86_64/$(APP) binaries/osx_x86_32/$(APP) binaries/windows_x86_32/$(APP).exe binaries/linux_x86_32/$(APP)
release/$(APP)_$(VERSION)_osx_x86_64.tar.gz: binaries/osx_x86_64/$(APP)
mkdir -p release
tar cfz release/$(APP)_$(VERSION)_osx_x86_64.tar.gz -C binaries/osx_x86_64 $(APP)
binaries/osx_x86_64/$(APP): $(GOFILES) Makefile
GOOS=darwin GOARCH=amd64 go build -ldflags "-X main.version=$(VERSION_COMMIT)" -o binaries/osx_x86_64/$(APP) ./cmd/$(APP)
release/$(APP)_$(VERSION)_windows_x86_64.zip: binaries/windows_x86_64/$(APP).exe
mkdir -p release
cd ./binaries/windows_x86_64 && zip -r -D ../../release/$(APP)_$(VERSION)_windows_x86_64.zip $(APP).exe
binaries/windows_x86_64/$(APP).exe: $(GOFILES) Makefile
GOOS=windows GOARCH=amd64 go build -ldflags "-X main.version=$(VERSION_COMMIT)" -o binaries/windows_x86_64/$(APP).exe ./cmd/$(APP)
release/$(APP)_$(VERSION)_linux_x86_64.tar.gz: binaries/linux_x86_64/$(APP)
mkdir -p release
tar cfz release/$(APP)_$(VERSION)_linux_x86_64.tar.gz -C binaries/linux_x86_64 $(APP)
binaries/linux_x86_64/$(APP): $(GOFILES) Makefile
GOOS=linux GOARCH=amd64 go build -ldflags "-X main.version=$(VERSION_COMMIT)" -o binaries/linux_x86_64/$(APP) ./cmd/$(APP)
release/$(APP)_$(VERSION)_osx_x86_32.tar.gz: binaries/osx_x86_32/$(APP)
mkdir -p release
tar cfz release/$(APP)_$(VERSION)_osx_x86_32.tar.gz -C binaries/osx_x86_32 $(APP)
binaries/osx_x86_32/$(APP): $(GOFILES) Makefile
GOOS=darwin GOARCH=386 go build -ldflags "-X main.version=$(VERSION_COMMIT)" -o binaries/osx_x86_32/$(APP) ./cmd/$(APP)
release/$(APP)_$(VERSION)_windows_x86_32.zip: binaries/windows_x86_32/$(APP).exe
mkdir -p release
cd ./binaries/windows_x86_32 && zip -r -D ../../release/$(APP)_$(VERSION)_windows_x86_32.zip $(APP).exe
binaries/windows_x86_32/$(APP).exe: $(GOFILES) Makefile
GOOS=windows GOARCH=386 go build -ldflags "-X main.version=$(VERSION_COMMIT)" -o binaries/windows_x86_32/$(APP).exe ./cmd/$(APP)
release/$(APP)_$(VERSION)_linux_x86_32.tar.gz: binaries/linux_x86_32/$(APP)
mkdir -p release
tar cfz release/$(APP)_$(VERSION)_linux_x86_32.tar.gz -C binaries/linux_x86_32 $(APP)
binaries/linux_x86_32/$(APP): $(GOFILES) Makefile
GOOS=linux GOARCH=386 go build -ldflags "-X main.version=$(VERSION_COMMIT)" -o binaries/linux_x86_32/$(APP) ./cmd/$(APP)
release/$(APP)_$(VERSION)_linux_arm64.tar.gz: binaries/linux_arm64/$(APP)
mkdir -p release
tar cfz release/$(APP)_$(VERSION)_linux_arm64.tar.gz -C binaries/linux_arm64 $(APP)
binaries/linux_arm64/$(APP): $(GOFILES) Makefile
GOOS=linux GOARCH=arm64 go build -ldflags "-X main.version=$(VERSION_COMMIT)" -o binaries/linux_arm64/$(APP) ./cmd/$(APP)