forked from terhechte/SourceKittenDaemon
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
61 lines (50 loc) · 1.63 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
ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
VERSION := $(shell git rev-parse HEAD)
BUILD := .build
DIST := dist
PREFIX := /usr/local
IDENTIFIER := com.stylemac.SourceKittenDaemon
UNAME := $(shell uname)
BINARIES_FOLDER := /bin
LIB_FOLDER := /lib
PWD := $(shell pwd)
SRC_FILES := $(shell find Sources -name '*.swift' -type file)
default: SourceKittenDaemon.pkg
.PHONY: clean
clean:
rm -rf "$(DIST)"
rm -rf "$(BUILD)"
.PHONY: install
install: $(DIST)$(BINARIES_FOLDER)/sourcekittendaemon
mkdir -p "$(PREFIX)$(BINARIES_FOLDER)"
mkdir -p "$(PREFIX)$(LIB_FOLDER)"
cp -f "$(DIST)$(BINARIES_FOLDER)/sourcekittendaemon" "$(PREFIX)$(BINARIES_FOLDER)/"
.PHONY: test
test:
FIXTURE_PATH="$(ROOT_DIR)/Tests/SourceKittenDaemonTests/Fixtures" \
FIXTURE_PROJECT_DIR="$(ROOT_DIR)/Tests/SourceKittenDaemonTests/Fixtures/Project" \
FIXTURE_PROJECT_FILE_PATH="$(ROOT_DIR)/Tests/SourceKittenDaemonTests/Fixtures/Project/Fixture.xcodeproj" \
swift test --build-path "./.build/$(UNAME)"
.PHONY: linuxtest
linuxtest:
docker run --rm \
--volume "$(PWD):/package" \
--workdir "/package" \
ibmcom/swift-ubuntu \
/bin/bash -c "make test"
SourceKittenDaemon.pkg: $(DIST)$(BINARIES_FOLDER)/sourcekittendaemon
pkgbuild \
--identifier "$(IDENTIFIER)" \
--root "$(DIST)" \
--install-location "$(PREFIX)" \
--version "$(VERSION)" \
$@
$(DIST)$(BINARIES_FOLDER)/sourcekittendaemon: $(BUILD)/release/sourcekittend
mkdir -p $(@D)
cp $< $@
$(DIST)$(LIB_FOLDER)/%.dylib: $(BUILD)/release/%.dylib
mkdir -p $(@D)
cp $< $@
$(BUILD)/release/sourcekittend: $(SRC_FILES)
mkdir -p $(@D)
swift build -c release --build-path $(BUILD)