-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
61 lines (45 loc) · 1.55 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
# Makefile
# local config
SWIFT_BUILD=swift build
SWIFT_CLEAN=swift package clean
SWIFT_BUILD_DIR=.build
SWIFT_TEST=swift test
CONFIGURATION=debug
DOCKER=/usr/local/bin/docker
# docker config (5.6.1 seems the first w/ aarch64)
SWIFT_BUILD_IMAGE="swift:5.6.2-focal"
DOCKER_BUILD_DIR=".docker$(SWIFT_BUILD_DIR)"
SWIFT_DOCKER_BUILD_DIR="$(DOCKER_BUILD_DIR)/aarch64-unknown-linux/$(CONFIGURATION)"
DOCKER_BUILD_PRODUCT="$(DOCKER_BUILD_DIR)/$(TOOL_NAME)"
SWIFT_SOURCES=\
Sources/*/*.swift
all: all-native
all-native:
$(SWIFT_BUILD) -c $(CONFIGURATION)
# Cannot test in `release` configuration?!
test:
$(SWIFT_TEST)
clean :
$(SWIFT_CLEAN)
# We have a different definition of "clean", might be just German
# pickyness.
rm -rf $(SWIFT_BUILD_DIR)
# Test Linux Builds in Docker
$(DOCKER_BUILD_PRODUCT): $(SWIFT_SOURCES)
$(DOCKER) run --rm \
-v "$(PWD):/src" \
-v "$(PWD)/$(DOCKER_BUILD_DIR):/src/.build" \
"$(SWIFT_BUILD_IMAGE)" \
bash -c 'apt-get update -qq && apt-get install -y -qq libsqlite3-dev 2>&1 >/dev/null && cd /src && swift build -c $(CONFIGURATION)'
docker-all: $(DOCKER_BUILD_PRODUCT)
docker-test: docker-all
$(DOCKER) run --rm \
-v "$(PWD):/src" \
-v "$(PWD)/$(DOCKER_BUILD_DIR):/src/.build" \
"$(SWIFT_BUILD_IMAGE)" \
bash -c 'apt-get update -qq && apt-get install -y -qq libsqlite3-dev 2>&1 >/dev/null && cd /src && swift test -c $(CONFIGURATION)'
docker-clean:
rm $(DOCKER_BUILD_PRODUCT)
docker-distclean:
rm -rf $(DOCKER_BUILD_DIR)
distclean: clean docker-distclean