-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
80 lines (51 loc) · 1.88 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
# Makefile
PREFIX=/Applications
VERSION=normal
APP=$(PREFIX)/Cisco/Cisco AnyConnect Secure Mobility Client.app
APP_RESOURCES=$(APP)/Contents/Resources
BUILD=build
BUILD_IMAGES=$(BUILD)/images
BUILD_RESOURCES=$(BUILD)/resources
BUILD_TEMP=$(BUILD)/temp
IMAGES_PREFIX=cisco-anyconnect-toolbar.drawio
ZIP_SCRIPT=makefile-create-zip.sh
all: build
help:
@echo 'Usage:'
@echo
@echo ' make run `make build`'
@echo ' make build build `Resources.zip` and `Resources-Dark.zip` files'
@echo ' make install install assets in AnyConnect (default is `Resources.zip`,'
@echo ' but you can use `make install VERSION=dark` to install'
@echo ' `Resources-Dark.zip`)'
@echo ' make uninstall uninstall assets from AnyConnect'
check-images:
ifeq ("$(wildcard $(BUILD_IMAGES)/$(IMAGES_PREFIX)-*)","")
$(error images in $(BUILD_IMAGES) are missing)
endif
Resources.zip:
BUILD=$(BUILD) BUILD_IMAGES=$(BUILD_IMAGES) BUILD_RESOURCES=$(BUILD_RESOURCES) \
IMAGES_PREFIX=$(IMAGES_PREFIX) \
bash $(ZIP_SCRIPT) Resources.zip normal
Resources-Dark.zip:
BUILD=$(BUILD) BUILD_IMAGES=$(BUILD_IMAGES) BUILD_RESOURCES=$(BUILD_RESOURCES) \
IMAGES_PREFIX=$(IMAGES_PREFIX) \
bash $(ZIP_SCRIPT) Resources-Dark.zip dark
build: check-images Resources.zip Resources-Dark.zip
check_app_find_app=$(shell [[ -d "$(APP_RESOURCES)" ]] && echo "yes")
check-app:
ifeq ("$(check_app_find_app)","")
$(error app not found in $(APP_RESOURCES))
endif
install: check-app
ifeq ($(VERSION), normal)
unzip -d "$(APP_RESOURCES)" Resources.zip
else ifeq ($(VERSION), dark)
unzip -d "$(APP_RESOURCES)" Resources-Dark.zip
else
$(error invalid version $(VERSION))
endif
rm -Rf $(BUILD_TEMP)
uninstall: check-app
zipinfo -l1 Resources.zip | while read i; do rm "$(APP_RESOURCES)/$$i"; done
.PHONY: all help check-images build check-app install uninstall