forked from cloudflare/collapsify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
40 lines (32 loc) · 1.21 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
NAME := collapsify
VERSION := $(shell node -p "require('./package.json').version")
ITERATION := 0
TMP_ROOT := $(shell pwd)/tmp
PACKAGE_ROOT := $(TMP_ROOT)/packaging
INSTALL_PREFIX := usr/local
DEB_PACKAGE := $(TMP_ROOT)/$(NAME)_$(VERSION)-$(ITERATION)_amd64.deb
$(DEB_PACKAGE): clean
@echo $(VERSION)
mkdir -p $(PACKAGE_ROOT)/$(INSTALL_PREFIX)/$(NAME)
# statics:
cp -r -p bin $(PACKAGE_ROOT)/$(INSTALL_PREFIX)/$(NAME)/.
cp -r -p lib $(PACKAGE_ROOT)/$(INSTALL_PREFIX)/$(NAME)/.
cp -r -p index.js $(PACKAGE_ROOT)/$(INSTALL_PREFIX)/$(NAME)/.
cp -r -p package.json $(PACKAGE_ROOT)/$(INSTALL_PREFIX)/$(NAME)/.
cp -r -p package-lock.json $(PACKAGE_ROOT)/$(INSTALL_PREFIX)/$(NAME)/.
# add node dependcies
cd $(PACKAGE_ROOT)/$(INSTALL_PREFIX)/$(NAME)/; npm ci
# build deb package:
fpm -C $(PACKAGE_ROOT) -s dir -t deb -n $(NAME) -v $(VERSION) \
--iteration $(ITERATION) \
--depends "nodejs" \
--deb-user root \
--deb-group root \
-p $(DEB_PACKAGE)
.PHONY: cf-package
cf-package: $(DEB_PACKAGE)
.PHONY: clean-package
clean-package:
$(RM) -r $(TMP_ROOT)
.PHONY: clean
clean: clean-package