-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
49 lines (42 loc) · 1.69 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
MOD_NAME = $(shell go list -m)
BIN_NAME = $(shell basename $(MOD_NAME))
LDFLAGS = -ldflags="-X '$(MOD_NAME)/buildinfo.Version=$(shell git describe --tags 2> /dev/null || echo "devel")'"
out/$(BIN_NAME)-dev: clean lint test
mkdir -p out
go build $(LDFLAGS) -race -o $@
release: clean
mkdir -p out
GOOS=linux GOARCH=amd64 go build $(LDFLAGS) -o out/$(BIN_NAME)-linux
GOOS=linux GOARCH=arm64 go build $(LDFLAGS) -o out/$(BIN_NAME)-linux-arm64
GOOS=darwin GOARCH=amd64 go build $(LDFLAGS) -o out/$(BIN_NAME)-darwin
GOOS=darwin GOARCH=arm64 go build $(LDFLAGS) -o out/$(BIN_NAME)-darwin-arm64
GOOS=windows GOARCH=amd64 go build $(LDFLAGS) -o out/$(BIN_NAME)-windows.exe
README.md: out/$(BIN_NAME)-dev
@echo "# $(BIN_NAME)" > README.md
@echo "" >> README.md
@echo "[![Go Reference](https://pkg.go.dev/badge/$(MOD_NAME).svg)](https://pkg.go.dev/$(MOD_NAME))" >> README.md
@echo "" >> README.md
@echo "A cli application for installing Minecraft servers and [Modrinth](https://modrinth.com/) [modpacks](https://docs.modrinth.com/docs/modpacks/format_definition/)." >> README.md
@echo "" >> README.md
@echo "---" >> README.md
@echo "" >> README.md
@echo "#### modpack deployment" >> README.md
@echo "\`\`\`" >> README.md
./out/mrpack-install-dev --help >> README.md
@echo "\`\`\`" >> README.md
@echo "" >> README.md
@echo "---" >> README.md
@echo "" >> README.md
@echo "#### server deployment" >> README.md
@echo "\`\`\`" >> README.md
./out/mrpack-install-dev server --help >> README.md
@echo "\`\`\`" >> README.md
clean:
go clean
go mod tidy
rm -rf out
lint:
go vet
test:
go test -v -parallel $(shell grep -c -E "^processor.*[0-9]+" "/proc/cpuinfo") $(MOD_NAME)/...
.PHONY: clean lint test release