-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
38 lines (31 loc) · 1.26 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
prefix ?= /usr/local
bindir = $(prefix)/bin
libdir = $(prefix)/lib
buildroot = $(shell swift build -c release --show-bin-path)
configure:
echo "let DEFAULT_PLUGIN_LOCATION=\"$(libdir)/libXCGrapherModuleImportPlugin.dylib\"" > Sources/xcgrapher/Generated.swift
build: configure
xcrun swift build -c release --disable-sandbox
install: build
# Seems like brew hasn't created this yet and it confuses 'install' so...
mkdir -p "$(bindir)"
mkdir -p "$(libdir)"
# Install the binary
install "$(buildroot)/xcgrapher" "$(bindir)"
# Install the libs
install "$(buildroot)/libXCGrapherPluginSupport.dylib" "$(libdir)"
install "$(buildroot)/libXCGrapherModuleImportPlugin.dylib" "$(libdir)"
install_name_tool -change "$(buildroot)/libXCGrapherPluginSupport.dylib" "$(libdir)/libXCGrapherPluginSupport.dylib" "$(bindir)/xcgrapher"
install_name_tool -change "@rpath/libXCGrapherPluginSupport.dylib" "$(libdir)/libXCGrapherPluginSupport.dylib" "$(bindir)/xcgrapher"
uninstall:
rm -rf "$(bindir)/xcgrapher"
rm -rf "$(libdir)/libXCGrapherPluginSupport.dylib"
rm -rf "$(libdir)/libXCGrapherModuleImportPlugin.dylib"
lint:
swiftlint --autocorrect .
swiftlint .
swiftformat .
clean:
rm -rf .build
rm Sources/xcgrapher/Generated.swift
.PHONY: build install uninstall clean configure