This repository has been archived by the owner on Dec 17, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathMakefile
83 lines (71 loc) · 2.33 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
UNAME := $(shell uname)
ifeq ($(UNAME), Linux)
DefaultBuildFlags=
else ifeq ($(UNAME), Darwin)
DefaultBuildFlags=-Xswiftc -target -Xswiftc x86_64-apple-macosx10.12
endif
DebugBuildFlags=$(DefaultBuildFlags)
ReleaseBuildFlags=$(DefaultBuildFlags) -Xswiftc -static-stdlib -c release
INSTALL_PATH?=/usr/local
.PHONY: debug
## Build the package in debug
debug:
swift build $(DebugBuildFlags)
.PHONY: release
## Build the package in release
release:
swift build $(ReleaseBuildFlags)
.PHONY: clean
## Clean the package of build information
clean:
rm -rf .build
.PHONY: install
## Install the release version of the package
install: release
cp -f .build/release/langserver-swift $(INSTALL_PATH)/bin/langserver-swift
.PHONY: uninstall
## Undo the effects of install
uninstall:
rm -r $(INSTALL_PATH)/bin/langserver-swift
.PHONY: test
## Build and run the tests
test:
swift test $(DebugBuildFlags)
.PHONY: xcodeproj
## Generate the Xcode project
xcodeproj:
swift package generate-xcodeproj --enable-code-coverage --xcconfig-overrides settings.xcconfig
.PHONY: print_target_build_dir
## Print Xcode project's TARGET_BUILD_DIR value to use for debugging purposes
print_target_build_dir: xcodeproj
xcodebuild -project langserver-swift.xcodeproj -target "LanguageServer" -showBuildSettings | grep "TARGET_BUILD_DIR"
.PHONY: ci
## Operations to run for Continuous Integration
ifeq ($(UNAME), Linux)
ci: tools_versions debug test
else ifeq ($(UNAME), Darwin)
ci: tools_versions debug test release
endif
.PHONY: tools_versions
## Print the tools versions to STDOUT
tools_versions:
swift --version
swift build --version
.PHONY: help
# taken from this gist https://gist.github.com/rcmachado/af3db315e31383502660
## Show this help message.
help:
$(info Usage: make [target...])
$(info Available targets)
@awk '/^[a-zA-Z\-\_0-9]+:/ { \
nb = sub( /^## /, "", helpMsg ); \
if(nb == 0) { \
helpMsg = $$0; \
nb = sub( /^[^:]*:.* ## /, "", helpMsg ); \
} \
if (nb) \
print $$1 "\t" helpMsg; \
} \
{ helpMsg = $$0 }' \
$(MAKEFILE_LIST) | column -ts $$'\t' | \
grep --color '^[^ ]*'