-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMakefile
60 lines (50 loc) · 2.14 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
PROG := linstor-gui
DESTDIR =
NODEVERSION = 20
ifndef VERSION
checkVERSION:
$(error environment variable VERSION is not set)
else
checkVERSION:
lbvers.py check --base=$(BASE) --build=$(BUILD) --build-nr=$(BUILD_NR) --pkg-nr=$(PKG_NR) \
--debian-changelog=debian/changelog --rpm-spec=$(PROG).spec
endif
.PHONY: .env
.env:
echo VERSION=$(VERSION) > $@
.PHONY: build
build: deps .env ## build project
npm run build
.PHONY: install
install: ## install files
mkdir -p $(DESTDIR)/usr/share/linstor-server
cp -r dist $(DESTDIR)/usr/share/linstor-server/ui
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: deps
deps: ## install dependencies
npm install
.PHONY: release
release: checkVERSION build
mkdir -p /tmp/$(PROG)-$(VERSION)
cp -r dist Makefile README.md COPYING /tmp/$(PROG)-$(VERSION)
tar -C /tmp --owner=0 --group=0 -czvf $(PROG)-$(VERSION).tar.gz $(PROG)-$(VERSION)
.PHONY: release-docker
release-docker: checkVERSION
tmpdir=$$(mktemp -d) && \
docker run -it --rm -v $(PWD):/src:ro,z -v $$tmpdir:/out:z node:$(NODEVERSION) /bin/bash -c \
'install /dev/null /usr/local/bin/lbvers.py && cd $$HOME && cp -r /src . && cd ./src && make release VERSION=$(VERSION) && cp $(PROG)-$(VERSION).tar.gz /out' && \
mv $$tmpdir/*.tar.gz . && echo "rm -rf $$tmpdir"
.PHONY: debrelease
debrelease: checkVERSION build
mkdir -p /tmp/$(PROG)-$(VERSION)/debian
for f in changelog compat control copyright rules; do cp debian/$$f /tmp/$(PROG)-$(VERSION)/debian; done
cp -r dist Makefile README.md COPYING $(PROG).spec /tmp/$(PROG)-$(VERSION)
tar -C /tmp --owner=0 --group=0 -czvf $(PROG)-$(VERSION).tar.gz $(PROG)-$(VERSION)
.PHONY: debrelease-docker
debrelease-docker: checkVERSION ## build a release in a node container
tmpdir=$$(mktemp -d) && \
docker run -it --rm -v $(PWD):/src:ro,z -v $$tmpdir:/out:z node:$(NODEVERSION) /bin/bash -c \
'install /dev/null /usr/local/bin/lbvers.py && cd $$HOME && cp -r /src . && cd ./src && make debrelease VERSION=$(VERSION) && cp $(PROG)-$(VERSION).tar.gz /out' && \
mv $$tmpdir/*.tar.gz . && echo "rm -rf $$tmpdir"