-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
84 lines (70 loc) · 2.48 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
.PHONY: build_release build run before_test after_test test xcodeproj codecov docker install uninstall clean
SC=swift
VERSION=1.1.1
CONFIGDIR=~/.hazel
BINARYDIR=/usr/local/bin
RELEASEDIR=.build/release
DEBUGDIR=.build/debug
SWIFT_FLAGS=--configuration debug -Xswiftc "-D" -Xswiftc "DEBUG"
build:
$(SC) build $(SWIFT_FLAGS)
build_release: SWIFT_FLAGS=--disable-sandbox --static-swift-stdlib -c release
build_release: build
run: build before_test
ln -sf $(DEBUGDIR)/Hazel hazel_debug
@echo ""
@echo "Symbolic link created."
@echo "Usage: \033[0;31m./hazel_debug\033[0;0m <\033[0;33mcommand\033[0;0m> <\033[0;33margument\033[0;0m>"
@echo ""
debug: build before_test
cp -i $(DEBUGDIR)/Hazel /usr/local/bin/hazel_debug
cp -i .assets/scripts/completion/zsh/_hazel /usr/local/share/zsh/site-functions/_hazel_debug
@echo ""
@echo "Symbolic link created in /usr/local/bin."
@echo "Usage: \033[0;31mhazel_debug\033[0;0m <\033[0;33mcommand\033[0;0m> <\033[0;33margument\033[0;0m>"
@echo ""
before_test:
@echo "\033[0;32mCreating folder /tmp/hazel\033[0;0m"
@mkdir -p /tmp/hazel
@echo "\033[0;32mCopying templates file to /tmp/hazel\033[0;0m"
@cd .assets && cp -r templates /tmp/hazel
@echo "\033[0;32mCopying other settings to /tmp/hazel\033[0;0m"
@cd .assets && cp -f placeholders.json /tmp/hazel/
after_test:
@echo "\033[0;32m"
@echo "Deleting folder /tmp/hazel"
@rm -rf /tmp/hazel
@echo "\033[0;0m"
test: before_test
@echo "\033[0;33m======================== RUNNING TESTS ========================\033[0;0m"
$(SC) test $(SWIFT_FLAGS)
@echo "\033[0;33m===============================================================\033[0;0m"
@$(MAKE) after_test
xcodeproj:
swift package generate-xcodeproj
codecov: before_test
xcodebuild test -scheme Hazel-Package -enableCodeCoverage YES -configuration Debug "OTHER_SWIFT_FLAGS=-DDEBUG"
@$(MAKE) after_test
docker:
docker build --tag hazel .
docker run --rm hazel
install: build_release
mkdir -p $(CONFIGDIR)
cd .assets && cp -r templates $(CONFIGDIR)
cd .assets/scripts && cp -r completion $(CONFIGDIR)
cd .assets && cp -f placeholders.json $(CONFIGDIR)
sudo cp -f $(RELEASEDIR)/Hazel $(BINARYDIR)/hazel
uninstall:
rm -r $(CONFIGDIR)
sudo rm $(BINARYDIR)/hazel
clean:
rm -rf .build/
rm -rf xcov_report
rm -f hazel_debug
rm -rf /tmp/hazel
rm -f /usr/local/bin/hazel_debug
rm -f /usr/local/share/zsh/site-functions/_hazel_debug
compress:
cd ../ && tar czf hazel-$(VERSION).tar.gz Hazel
mv ../hazel-$(VERSION).tar.gz .
shasum -a 256 hazel-$(VERSION).tar.gz