-
-
Notifications
You must be signed in to change notification settings - Fork 64
/
Makefile
114 lines (91 loc) · 4.54 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
################################################################################
## Copyright (C) 2019-2022 Chrystian Huot <[email protected]>
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>
################################################################################
app := rdio-scanner
date := 2022/11/25
ver := 6.6.3
client := $(wildcard client/*.json client/*.ts)
server := $(wildcard server/*.go)
build = @cd server && GOOS=$(1) GOARCH=$(3) go build -o ../dist/$(2)-$(3)/$(4)
pandoc = @test -d dist/$(1)-$(2) || mkdir -p dist/$(1)-$(2) && pandoc -f markdown -o dist/$(1)-$(2)/$(3) --resource-path docs:docs/platforms $(4) docs/webapp.md docs/faq.md CHANGELOG.md
zip = @cd dist/$(1)-$(2) && zip -q ../$(app)-$(1)-$(2)-v$(ver).zip * && cd ..
.PHONY: all clean container dist sed
.PHONY: freebsd freebsd-amd64
.PHONY: linux linux-386 linux-amd64 linux-arm linux-arm64
.PHONY: macos macos-amd64 macos-arm64
.PHONY: windows windows-amd64
all: clean dist
clean:
@rm -fr client/node_modules dist server/webapp
container: webapp linux-amd64
@podman login docker.io
@podman manifest rm localhost/rdio-scanner:latest || true
@podman build --platform linux/amd64,linux/arm,linux/arm64 --pull --manifest rdio-scanner:latest .
@podman manifest push --format v2s2 localhost/rdio-scanner:latest docker://docker.io/chuot/rdio-scanner:latest
dist: freebsd linux macos windows
sed:
@sed -i -re "s|^(\s*\"version\":).*$$|\1 \"$(ver)\"|" client/package.json
@sed -i -re "s|^(const\s+Version\s+=).*$$|\1 \"$(ver)\"|" server/version.go
@sed -i -re "s|v[0-9]+\.[0-9]+\.[0-9]+|v$(ver)|" COMPILING.md README.md docs/docker/README.md docs/platforms/*.md
@sed -i -re "s|[0-9]{4}/[0-9]{2}/[0-9]{2}|$(date)|" docs/docker/README.md docs/platforms/*.md
webapp: server/webapp/index.html
server/webapp/index.html: $(client)
@cd client && test -d node_modules || npm ci --loglevel=error --no-progress
@cd client && npm run build
freebsd: freebsd-amd64
freebsd-amd64: webapp dist/$(app)-freebsd-amd64-v$(ver).zip
dist/$(app)-freebsd-amd64-v$(ver).zip: $(server)
$(call pandoc,freebsd,amd64,rdio-scanner.pdf,docs/platforms/freebsd.md)
$(call build,freebsd,freebsd,amd64,$(app))
$(call zip,freebsd,amd64,$(app))
linux: linux-386 linux-amd64 linux-arm linux-arm64
linux-386: webapp dist/$(app)-linux-386-v$(ver).zip
linux-amd64: webapp dist/$(app)-linux-amd64-v$(ver).zip
linux-arm: webapp dist/$(app)-linux-arm-v$(ver).zip
linux-arm64: webapp dist/$(app)-linux-arm64-v$(ver).zip
dist/$(app)-linux-386-v$(ver).zip: $(server)
$(call pandoc,linux,386,rdio-scanner.pdf,docs/platforms/linux.md)
$(call build,linux,linux,386,$(app))
$(call zip,linux,386,$(app))
dist/$(app)-linux-amd64-v$(ver).zip: $(server)
$(call pandoc,linux,amd64,rdio-scanner.pdf,docs/platforms/linux.md)
$(call build,linux,linux,amd64,$(app))
$(call zip,linux,amd64,$(app))
dist/$(app)-linux-arm-v$(ver).zip: $(server)
$(call pandoc,linux,arm,rdio-scanner.pdf,docs/platforms/linux.md)
$(call build,linux,linux,arm,$(app))
$(call zip,linux,arm,$(app))
dist/$(app)-linux-arm64-v$(ver).zip: $(server)
$(call pandoc,linux,arm64,rdio-scanner.pdf,docs/platforms/linux.md)
$(call build,linux,linux,arm64,$(app))
$(call zip,linux,arm64,$(app))
macos: macos-amd64 macos-arm64
macos-amd64: webapp dist/$(app)-macos-amd64-v$(ver).zip
macos-arm64: webapp dist/$(app)-macos-arm64-v$(ver).zip
dist/$(app)-macos-amd64-v$(ver).zip: $(server)
$(call pandoc,macos,amd64,rdio-scanner.pdf,docs/platforms/macos.md)
$(call build,darwin,macos,amd64,$(app))
$(call zip,macos,amd64,$(app))
dist/$(app)-macos-arm64-v$(ver).zip: $(server)
$(call pandoc,macos,arm64,rdio-scanner.pdf,docs/platforms/macos.md)
$(call build,darwin,macos,arm64,$(app))
$(call zip,macos,arm64,$(app))
windows: windows-amd64
windows-amd64: webapp dist/$(app)-windows-amd64-v$(ver).zip
dist/$(app)-windows-amd64-v$(ver).zip: $(server)
$(call pandoc,windows,amd64,rdio-scanner.pdf,docs/platforms/windows.md)
$(call build,windows,windows,amd64,$(app).exe)
$(call zip,windows,amd64,$(app))