-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
85 lines (69 loc) · 1.57 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
SHELL = /bin/bash
ifeq ($(OS),Windows_NT)
detected_OS := Windows
else
detected_OS := $(shell uname)
endif
ifeq ($(detected_OS),Linux) # Linux only
prefix ?= ~/.local
else
prefix ?= /usr/local
endif
bindir ?= $(prefix)/bin
libdir ?= $(prefix)/lib
srcdir = Sources
templatesdir = Templates
utilsdir = utils
REPODIR = $(shell pwd)
BUILDDIR = $(REPODIR)/.build
PRODUCTDIR = $(BUILDDIR)/apple/Products/Release
SOURCES = $(wildcard $(srcdir)/**/*.swift)
TEMPLATES = $(templatesdir)
UTILS = $(utilsdir)
.DEFAULT_GOAL = all
.PHONY: all
all: variants
variants: $(SOURCES)
@swift build \
-c release \
--arch arm64 \
--arch x86_64 \
--disable-sandbox \
--build-path "$(BUILDDIR)"
.PHONY: install
install: variants
@install -d $(bindir) $(libdir)
@install "$(PRODUCTDIR)/variants" $(bindir)
@mkdir -p $(libdir)/variants
@cp -R "$(TEMPLATES)" $(libdir)/variants/
@cp -R "$(UTILS)" $(libdir)/variants/
.PHONY: uninstall
uninstall:
@rm -rf $(bindir)/variants
@rm -rf $(libdir)/variants
.PHONY: clean
distclean:
@rm -f $(BUILDDIR)/release
.PHONY: clean
clean: distclean
@rm -rf $(BUILDDIR)
.PHONY: prepare_for_test
prepare_for_test:
@rm -rf variants.yml
.PHONY: test
test: prepare_for_test
@swift test
ifeq ($(detected_OS),Darwin) # Mac OSX only
@xcodebuild test -scheme VariantsCore
endif
.PHONY: coverage
coverage: test
@bundle install
@bundle exec slather coverage --ignore ../**/*/Xcode\* --ignore Tests/\* --scheme VariantsCore Variants.xcodeproj/
.PHONY: lint
lint:
@swiftlint --strict
.PHONY: validation
validation: lint coverage
@rm -rf variants.yml
@echo "Ready to go."