-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
60 lines (45 loc) · 1.7 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
# Prevent any included targets from becoming the default target.
.PHONY: all
all:
PROJECT_PATH ?= $(realpath $(dir $(firstword $(MAKEFILE_LIST))))
BUILD_DIR ?= $(abspath $(PROJECT_PATH)/build)
include mk/toolchain.mk
include mk/graft.mk
include mk/log.mk
CRYPTEX_ID ?= com.jonpalmisc.srdsh
CRYPTEX_VERSION ?= 1.0.0
CRYPTEX ?= $(BUILD_DIR)/$(CRYPTEX_ID).cxbd
CRYPTEX_ROOT ?= $(BUILD_DIR)/$(CRYPTEX_ID).root
CRYPTEX_IMAGE ?= $(BUILD_DIR)/$(CRYPTEX_ID).dmg
ROOT_DAEMON_DIR := $(CRYPTEX_ROOT)/Library/LaunchDaemons
ROOT_BIN_DIR := $(CRYPTEX_ROOT)/usr/bin
all: $(CRYPTEX)
CRYPTEX_CONTENTS :=
include $(wildcard apps/*/module.mk)
$(CRYPTEX_ROOT):
@$(call log_info, "Creating cryptex root...")
mkdir -p $(ROOT_DAEMON_DIR)
mkdir -p $(ROOT_BIN_DIR)
$(CRYPTEX_CONTENTS): $(CRYPTEX_ROOT)
$(CRYPTEX_IMAGE): $(CRYPTEX_CONTENTS)
@$(call log, "Creating cryptex disk image...")
@rm -fr $@
hdiutil create -fs hfs+ -srcfolder $(CRYPTEX_ROOT) $@ $(HUSH)
$(CRYPTEX): $(CRYPTEX_IMAGE)
@$(call log, "Creating cryptex...")
cryptexctl create --research --replace -o $(BUILD_DIR) \
--identifier=$(CRYPTEX_ID) --version=$(CRYPTEX_VERSION) \
--variant=research $(CRYPTEX_IMAGE)
# This is split out as a separate step to avoid repeatedly re-signing the
# cryptex upon installation even if the contents have not changed.
$(CRYPTEX).signed: $(CRYPTEX)
@$(call log_info, "Personalizing cryptex for device...")
cryptexctl personalize --replace -o $(BUILD_DIR) --variant=research $(CRYPTEX) || exit 1
.PHONY: install
install: $(CRYPTEX).signed
@$(call log, "Installing cryptex on device...")
cryptexctl uninstall $(CRYPTEX_ID) $(HUSH) || true
cryptexctl install --variant=research $(CRYPTEX).signed
.PHONY: clean
clean:
rm -fr $(BUILD_DIR)