-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
49 lines (35 loc) · 1.22 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
TEMP_FOLDER ?= /tmp/Saber.dst
PREFIX ?= /usr/local
INSTALL_DIR = $(PREFIX)/bin
SWIFT_BUILD_FLAGS = --configuration release
SWIFT_TEST_FLAGS = -Xswiftc -DTEST
BIN_PATH = $(shell swift build $(SWIFT_BUILD_FLAGS) --show-bin-path)/saber
VERSION_SOURCE = SaberVersion
VERSION_SWIFT_SOURCE = Sources/Saber/SaberVersion.swift
CURRENT_VERSION = $(shell cat "$(VERSION_SOURCE)")
clean:
rm -rf "$(TEMP_FOLDER)"
swift package clean
build:
swift build $(SWIFT_BUILD_FLAGS) $(SWIFT_BUILD_XFLAGS)
install: clean build
install -d "$(INSTALL_DIR)"
install "$(BIN_PATH)" "$(INSTALL_DIR)"
uninstall:
rm -rf "$(INSTALL_DIR)/saber"
test: clean
swift test $(SWIFT_TEST_FLAGS)
docker_linux_test:
swift test --generate-linuxmain
docker run --rm -i -t --volume "$(shell pwd):/package" --workdir "/package" swift:4.2 /bin/bash -c "make test"
xcodeproj:
swift package generate-xcodeproj --xcconfig-overrides Saber.xcconfig
get_version:
@echo "$(CURRENT_VERSION)"
set_version:
$(eval NEW_VERSION := $(filter-out $@,$(MAKECMDGOALS)))
@echo "$(NEW_VERSION)" > "$(VERSION_SOURCE)"
@echo "// DO NOT EDIT! See Makefile 'set_version'" > "$(VERSION_SWIFT_SOURCE)"
@echo "public let saberVersion = \"$(NEW_VERSION)\"" >> "$(VERSION_SWIFT_SOURCE)"
%:
@: