-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
59 lines (48 loc) · 1.62 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
bin = rmtrash
install_dir = /opt/homebrew/bin
version = $(shell git describe --tags --abbrev=0)
.PHONY: deps
deps:
swift package update
.PHONY: run
run:
swift run
.PHONY: test
test:
swift test
.PHONY: build
build:
swift build -c release
# install config in brew formula
# bin.install ".build/release/rmtrash"
.PHONY: manual
manual:
swift package generate-manual
# install config in brew formula
# man1.install ".build/plugins/GenerateManual/outputs/rmtrash/rmtrash.1"
.PHONY: build-universal
build-universal:
swift build --configuration release --arch x86_64
swift build --configuration release --arch arm64
lipo -create .build/x86_64-apple-macosx/release/$(bin) .build/arm64-apple-macosx/release/$(bin) -output .build/release/$(bin)
.PHONY: release
release: test build-universal manual
mkdir -p .dist
cp .build/plugins/GenerateManual/outputs/rmtrash/rmtrash.1 .build/x86_64-apple-macosx/release
cp .build/plugins/GenerateManual/outputs/rmtrash/rmtrash.1 .build/arm64-apple-macosx/release
cp .build/plugins/GenerateManual/outputs/rmtrash/rmtrash.1 .build/release
tar -czf .dist/$(bin)_$(version)_x86_64.tar.gz -C .build/x86_64-apple-macosx/release $(bin) $(bin).1
tar -czf .dist/$(bin)_$(version)_arm64.tar.gz -C .build/arm64-apple-macosx/release $(bin) $(bin).1
tar -czf .dist/$(bin)_$(version)_universal.tar.gz -C .build/release $(bin) $(bin).1
.PHONY: install
install: build
mv .build/release/$(bin) $(install_dir)/$(bin)
chmod +x $(install_dir)/$(bin)
.PHONY: style
style:
swiftlint --autocorrect Sources/*
swiftlint --autocorrect Tests/*
swiftlint --autocorrect Package.swift
.PHONY: clean
clean:
rm -rf .build .dist