-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
68 lines (54 loc) · 1.64 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
SHELL := bash
NAME := grimson
DIST := dist
UNAME := $(shell uname -s)
BOOTSTRAP_VERSION := 0.0.3
BOOTSTRAP_URL := https://github.com/packwiz/packwiz-installer-bootstrap/releases/download/v$(BOOTSTRAP_VERSION)/packwiz-installer-bootstrap.jar
ifeq ($(UNAME), Darwin)
SED ?= gsed
SHASUM ?= shasum -a 256
else
SED ?= sed
SHASUM ?= sha256sum
endif
ifndef OUTPUT
ifeq ($(GITHUB_REF_TYPE),tag)
OUTPUT ?= $(subst v,,$(GITHUB_REF_NAME))
else
OUTPUT ?= testing
endif
endif
ifndef VERSION
ifeq ($(GITHUB_REF_TYPE),tag)
VERSION ?= $(subst v,,$(GITHUB_REF_NAME))
else
VERSION ?= $(shell git rev-parse --short HEAD)
endif
endif
$(DIST):
mkdir -p $(DIST)
.PHONY: clean
clean:
rm -rf $(DIST)
.PHONY: docs
docs:
cd docs; hugo
.PHONY: build
build: $(DIST)/$(NAME)-$(OUTPUT).mrpack $(DIST)/$(NAME)-$(OUTPUT).mrpack.sha256
$(DIST)/$(NAME)-$(OUTPUT).mrpack: $(DIST)
$(SED) -i 's|version = ".*"|version = "$(VERSION)"|' pack.toml
cd $(DIST) && packwiz modrinth export --meta-folder-base $(CURDIR)/ --pack-file $(CURDIR)/pack.toml --yes
git checkout $(CURDIR)/pack.toml
ifeq ($(OUTPUT), testing)
mv $(DIST)/$(NAME)-$(VERSION).mrpack $(DIST)/$(NAME)-$(OUTPUT).mrpack
endif
$(DIST)/$(NAME)-$(OUTPUT).mrpack.sha256: $(DIST)
cd $(DIST) && $(SHASUM) $(NAME)-$(OUTPUT).mrpack >| $(NAME)-$(OUTPUT).mrpack.sha256
.PHONY: client
client: packwiz-installer-bootstrap.jar
java -jar packwiz-installer-bootstrap.jar --no-gui pack.toml --side client
.PHONY: server
server: packwiz-installer-bootstrap.jar
java -jar packwiz-installer-bootstrap.jar --no-gui pack.toml --side server
packwiz-installer-bootstrap.jar:
curl -sSLo packwiz-installer-bootstrap.jar $(BOOTSTRAP_URL)