-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
74 lines (61 loc) Β· 1.71 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
.DEFAULT_GOAL := default
ARTIFACTS := $(shell pwd)/artifacts
BUILD := $(shell pwd)/.build
CONFIGURATION := Release
CLI_PROJECT := Nyancat/Nyancat.csproj
CLI_TOOL := nyancat
RUNTIME := linux-x64
FRAMEWORK := net6.0
.PHONY: purge
purge: clean
rm -rf .build
rm -rf artifacts
.PHONY: clean
clean:
dotnet clean
.PHONY: run
run:
dotnet run --project $(CLI_PROJECT) --framework $(FRAMEWORK)
.PHONY: restore
restore:
dotnet restore
dotnet tool restore
.PHONY: default
default: clean restore
$(MAKE) package
.PHONY: package
package:
dotnet build $(CLI_PROJECT) -c $(CONFIGURATION)
dotnet pack $(CLI_PROJECT) --configuration $(CONFIGURATION) \
--no-build \
--output $(ARTIFACTS) \
--include-symbols
.PHONY: package-native
package-native:
# Prereqs: https://github.com/dotnet/runtimelab/blob/feature/NativeAOT/samples/prerequisites.md#ubuntu-1604
dotnet publish $(CLI_PROJECT) -c $(CONFIGURATION) \
--nologo \
--output $(BUILD)/publish/$(RUNTIME) \
--runtime $(RUNTIME) \
--framework $(FRAMEWORK) \
--self-contained true \
-p:Mode=CoreRT-ReflectionFree
@mkdir -p $(ARTIFACTS)
@cp $(BUILD)/publish/$(RUNTIME)/$(CLI_TOOL) $(ARTIFACTS)/$(CLI_TOOL).$(RUNTIME)
@strip $(ARTIFACTS)/$(CLI_TOOL).$(RUNTIME)
@upx --best $(ARTIFACTS)/$(CLI_TOOL).$(RUNTIME)
.PHONY: install
install:
dotnet tool install --global --add-source $(ARTIFACTS) \
--version $$(dotnet minver -t v -a minor -v e) \
$(CLI_TOOL)
.PHONY: uninstall
uninstall:
dotnet tool uninstall --global $(CLI_TOOL)
.PHONY: checksum
checksum:
@rm -f $(ARTIFACTS)/SHA256SUMS.txt
@cd $(ARTIFACTS) && find . -type f -print0 | xargs -0 sha256sum | tee SHA256SUMS.txt
.PHONY: validate
validate:
@cd $(ARTIFACTS) && cat SHA256SUMS.txt | sha256sum -c -