-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
109 lines (88 loc) · 2.38 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#
# Makefile
# PinKit
#
################################################################################
#
# Variables
#
SHELL = /bin/sh
# trunk
# SWIFT_VERSION = swift-DEVELOPMENT-SNAPSHOT-2020-04-23-a
# Swift 5.3
# SWIFT_VERSION = swift-5.3-DEVELOPMENT-SNAPSHOT-2020-04-21-a
SWIFT_VERSION = 5.3
# set EXECUTABLE_DIRECTORY according to your specific environment
# run swift build and see where the output executable is created
# OS specific differences
UNAME = ${shell uname}
ifeq ($(UNAME), Darwin)
SWIFTC_FLAGS =
LINKER_FLAGS = -Xlinker -L/usr/local/lib
PLATFORM = x86_64-apple-macosx
EXECUTABLE_DIRECTORY = ./.build/${PLATFORM}/debug
TEST_BUNDLE = PinKitPackageTests.xctest
TEST_RESOURCES_DIRECTORY = ./.build/${PLATFORM}/debug/${TEST_BUNDLE}/Contents/Resources
endif
ifeq ($(UNAME), Linux)
SWIFTC_FLAGS = -Xcc -fblocks
LINKER_FLAGS = -Xlinker -rpath -Xlinker .build/debug
PATH_TO_SWIFT = /home/vagrant/swiftenv/versions/$(SWIFT_VERSION)
PLATFORM = x86_64-unknown-linux
EXECUTABLE_DIRECTORY = ./.build/${PLATFORM}/debug
TEST_RESOURCES_DIRECTORY = ${EXECUTABLE_DIRECTORY}
endif
RUN_RESOURCES_DIRECTORY = ${EXECUTABLE_DIRECTORY}
################################################################################
#
# Targets
#
.PHONY: version
version:
xcodebuild -version
swift --version
swift package tools-version
.PHONY: init
init:
- swiftenv install $(SWIFT_VERSION)
swiftenv local $(SWIFT_VERSION)
ifeq ($(UNAME), Linux)
cd /vagrant && \
git clone --recursive -b experimental/foundation https://github.com/apple/swift-corelibs-libdispatch.git && \
cd swift-corelibs-libdispatch && \
sh ./autogen.sh && \
./configure --with-swift-toolchain=/home/vagrant/swiftenv/versions/$(SWIFT_VERSION)/usr \
--prefix=/home/vagrant/swiftenv/versions/$(SWIFT_VERSION)/usr && \
make && make install
endif
.PHONY: xcproj
xcproj:
swift package generate-xcodeproj
.PHONY: clean
clean:
rm -rf Packages
xcodebuild clean
swift package clean
swift package reset
.PHONY: describe
describe:
swift package describe
.PHONY: resolve
resolve:
swift package resolve
.PHONY: dependencies
dependencies: resolve
swift package show-dependencies
.PHONY: update
update: resolve
swift package update
.PHONY: build
build:
swift build $(SWIFTC_FLAGS) $(LINKER_FLAGS)
.PHONY: test
test: build
swift test --enable-test-discovery
.PHONY: run
# make run ARGS="asdf"
run: build
${EXECUTABLE_DIRECTORY}/${CMD_NAME} $(ARGS)