-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathMakefile
91 lines (76 loc) · 2.52 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
ifndef VERBOSE
.SILENT:
endif
.PHONY: all
all:
@echo "No default action."
.PHONY: check
check:
npm run lint
.PHONY: clean
clean: .script-clean-dirs
.PHONY: build
build: .script-build-dirs
# Only clean and build the source code if HEADLESS_SCRIPTS_SKIP_BUILD is not "1"
# This allows local runs to build source code and container runs to skip building
# We can also skip building locally if we define the envvar.
.PHONY: .script-build-dirs
.script-build-dirs:
ifneq ("$(HEADLESS_SCRIPTS_SKIP_BUILD)", "1")
# Building scripts...
if [ -d "./dist" ]; then rm -rf ./dist; fi
if [ -d "./dist-scripts" ]; then rm -rf ./dist-scripts; fi
npm run --silent build > '/dev/null'
npm run --silent build-scripts > '/dev/null'
endif
# Only clean the source code if HEADLESS_SCRIPTS_SKIP_CLEAN is not "1"
# This allows local runs to clean the built dirs and container runs to skip cleaning
# We can also skip cleaning locally if we define the envvar.
.PHONY: .script-clean-dirs
.script-clean-dirs:
ifneq ("$(HEADLESS_SCRIPTS_SKIP_CLEAN)", "1")
# Cleaning built code dirs...
if [ -d "./dist" ]; then rm -rf ./dist; fi
if [ -d "./dist-scripts" ]; then rm -rf ./dist-scripts; fi
endif
# Internal target to run generate_words command.
.PHONY: .run_words
.run_words:
node dist-scripts/generate_words.js
# Internal target to run create_hsm_key command.
.PHONY: .run_create_hsm_key
.run_create_hsm_key:
ifeq ($(keyname),)
@echo "Usage: make create_hsm_key keyname=YOUR_KEYNAME"
else
@echo "Creating new key..."
node dist-scripts/create-hsm-wallet.js $(keyname)
endif
# Internal target to run xpub_from_seed command.
.PHONY: .run_xpub_from_seed
.run_xpub_from_seed:
ifeq ($(seed),)
@echo "Usage: make xpub_from_seed seed=YOUR_SEED"
else
node dist-scripts/get_xpub_from_seed.js $(seed)
endif
# Internal target to run multisig_xpub_from_seed command.
.PHONY: .run_multisig_xpub_from_seed
.run_multisig_xpub_from_seed:
ifeq ($(seed),)
@echo "Usage: make multisig_xpub_from_seed seed=YOUR_SEED"
else
node dist-scripts/get_multisig_xpub_from_seed.js $(seed)
endif
# Command: generate words
.PHONY: words
words: .script-build-dirs .run_words .script-clean-dirs
# Command: create HSM key
.PHONY: create_hsm_key
create_hsm_key: .script-build-dirs .run_create_hsm_key .script-clean-dirs
# Command: Derive xPub from seed
.PHONY: xpub_from_seed
xpub_from_seed: .script-build-dirs .run_xpub_from_seed .script-clean-dirs
# Command: Derive multisig xPub from seed
.PHONY: multisig_xpub_from_seed
multisig_xpub_from_seed: .script-build-dirs .run_multisig_xpub_from_seed .script-clean-dirs