forked from hzrd149/nostrudel-startos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
46 lines (34 loc) · 1.35 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
PACKAGE_ID := $(shell grep -o "id: '[^']*'" startos/manifest.ts | sed "s/id: '\([^']*\)'/\1/")
.PHONY: all clean install build-js
all: check-deps check-init deps ${PACKAGE_ID}.s9pk
@echo " Done!"
@echo " Filesize:$(shell du -h $(PACKAGE_ID).s9pk) is ready"
check-deps:
@if ! command -v start-cli > /dev/null; then \
echo "Error: start-cli not found. Please install it first."; \
exit 1; \
fi
check-init:
@if [ ! -f ~/.startos/developer.key.pem ]; then \
start-cli init; \
fi
deps: node_modules build-js
build-js: javascript/index.js
${PACKAGE_ID}.s9pk: build-js
$(eval INGREDIENTS := $(shell start-cli s9pk list-ingredients))
start-cli s9pk pack
javascript/index.js: $(shell git ls-files startos) tsconfig.json node_modules package.json
npm run build
node_modules: package.json package-lock.json
npm ci
package-lock.json: package.json
npm i
clean:
rm -rf ${PACKAGE_ID}.s9pk
rm -rf javascript
rm -rf node_modules
install:
@if [ ! -f ~/.startos/config.yaml ]; then echo "You must define \"host: http://server-name.local\" in ~/.startos/config.yaml config file first."; exit 1; fi
@echo "\nInstalling to $$(grep -v '^#' ~/.startos/config.yaml | cut -d'/' -f3) ...\n"
@[ -f $(PACKAGE_ID).s9pk ] || ( $(MAKE) && echo "\nInstalling to $$(grep -v '^#' ~/.startos/config.yaml | cut -d'/' -f3) ...\n" )
@start-cli package install -s $(PACKAGE_ID).s9pk