-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
143 lines (113 loc) · 4.94 KB
/
Makefile
File metadata and controls
143 lines (113 loc) · 4.94 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
.DEFAULT_GOAL := build
include Makefile.in
.PHONY: build devel all all-devel modules modules-dev modules-dist-devel modules-refresh-devel clean check fix setup \
musl-aarch64-dev musl-aarch64 musl-x86_64-dev musl-x86_64 \
stats man test test-core test-modules test-sensors test-integration tar
setup:
$(call deps)
$(call tgt,wasm32-wasip1)
$(call tgt,aarch64-unknown-linux-musl)
$(call tgt,x86_64-unknown-linux-musl)
clean:
cargo clean
check:
cargo clippy --no-deps --workspace $(PLATFORM_WORKSPACE_EXCLUDES) -- -Dwarnings -Aunused-variables -Adead-code
fix:
cargo clippy --fix --allow-dirty --allow-staged --workspace $(PLATFORM_WORKSPACE_EXCLUDES)
musl-aarch64-dev:
$(call check_present,aarch64-linux-musl-gcc)
$(call prep_layout,debug,aarch64-unknown-linux-musl)
cargo build -v --workspace $(PLATFORM_WORKSPACE_EXCLUDES) --target aarch64-unknown-linux-musl
$(call move_bin,debug,aarch64-unknown-linux-musl)
musl-aarch64:
$(call check_present,aarch64-linux-musl-gcc)
$(call prep_layout,release,aarch64-unknown-linux-musl)
cargo build --release --workspace $(PLATFORM_WORKSPACE_EXCLUDES) --target aarch64-unknown-linux-musl
$(call move_bin,release,aarch64-unknown-linux-musl)
musl-x86_64-dev:
$(call check_present,x86_64-linux-musl-gcc)
$(call prep_layout,debug,x86_64-unknown-linux-musl)
cargo build -v --workspace $(PLATFORM_WORKSPACE_EXCLUDES) --target x86_64-unknown-linux-musl
$(call move_bin,debug,x86_64-unknown-linux-musl)
musl-x86_64:
$(call check_present,x86_64-linux-musl-gcc)
$(call prep_layout,release,x86_64-unknown-linux-musl)
cargo build --release --workspace $(PLATFORM_WORKSPACE_EXCLUDES) --target x86_64-unknown-linux-musl
$(call move_bin,release,x86_64-unknown-linux-musl)
all-devel:
$(call prep_layout,debug,)
cargo build -v --workspace $(PLATFORM_WORKSPACE_EXCLUDES)
$(call move_bin,debug,)
all:
$(call prep_layout,release,)
cargo build --release --workspace $(PLATFORM_WORKSPACE_EXCLUDES)
$(call move_bin,release,)
devel:
$(call prep_layout,debug,)
cargo build -v --workspace $(CORE_EXCLUDES)
$(call move_bin,debug,)
build:
$(call prep_layout,release,)
cargo build --release --workspace $(CORE_EXCLUDES)
$(call move_bin,release,)
modules-dev:
$(call prep_layout,debug,)
cargo build -v $(foreach pkg,$(MODULE_PACKAGE_SPECS),-p $(pkg))
$(call move_bin,debug,)
modules:
$(call prep_layout,release,)
cargo build --release $(foreach pkg,$(MODULE_PACKAGE_SPECS),-p $(pkg))
$(call move_bin,release,)
modules-dist-devel:
$(call prep_layout,release,)
cargo build --release $(foreach pkg,$(MODULE_PACKAGE_SPECS),-p $(pkg))
$(call stage_modules_dist)
modules-refresh-devel: modules-dist-devel
$(call tgt,wasm32-wasip1)
$(call refresh_modules_repo)
stats:
tokei . --exclude target --exclude .git
man:
pandoc --standalone --to man docs/manpages/sysinspect.8.md -o docs/manpages/sysinspect.8
test: setup
CARGO_BUILD_JOBS=$(TEST_BUILD_JOBS) cargo nextest run --workspace $(PLATFORM_WORKSPACE_EXCLUDES) --test-threads $(TEST_RUN_THREADS)
test-core: setup
CARGO_BUILD_JOBS=$(TEST_BUILD_JOBS) cargo nextest run $(foreach pkg,$(CORE_PACKAGE_SPECS),-p $(pkg)) --lib --bins --test-threads $(TEST_RUN_THREADS)
test-modules: setup
CARGO_BUILD_JOBS=$(TEST_BUILD_JOBS) cargo nextest run $(foreach pkg,$(MODULE_PACKAGE_SPECS),-p $(pkg)) --bins --test-threads $(TEST_RUN_THREADS)
test-sensors: setup
CARGO_BUILD_JOBS=$(TEST_BUILD_JOBS) cargo nextest run $(foreach pkg,$(SENSOR_PACKAGE_SPECS),-p $(pkg)) --lib --bins --test-threads $(TEST_RUN_THREADS)
test-integration: setup
CARGO_BUILD_JOBS=$(TEST_BUILD_JOBS) cargo nextest run $(INTEGRATION_TEST_TARGETS) --test-threads $(TEST_RUN_THREADS)
tar:
# Cleanup
rm -rf package/${ARC_NAME}
cargo vendor
mkdir -p package/${ARC_NAME}/.cargo
cp .vendor.toml package/${ARC_NAME}/.cargo/config.toml
cp LICENSE package/${ARC_NAME}
cp README.md package/${ARC_NAME}
cp Cargo.lock package/${ARC_NAME}
cp Cargo.toml package/${ARC_NAME}
cp Makefile package/${ARC_NAME}
cp rustfmt.toml package/${ARC_NAME}
cp -a docs package/${ARC_NAME}
cp -a man package/${ARC_NAME}
cp -a libsysinspect package/${ARC_NAME}
cp -a modules package/${ARC_NAME}
cp -a src package/${ARC_NAME}
cp -a vendor package/${ARC_NAME}
# Cleanup. Also https://github.com/rust-lang/cargo/issues/7058
find package/${ARC_NAME} -type d -wholename "*/target" -prune -exec rm -rf {} \;
find package/${ARC_NAME} -type d -wholename "*/vendor/winapi*" -prune -exec \
rm -rf {}/src \; -exec mkdir -p {}/src \; -exec touch {}/src/lib.rs \; -exec rm -rf {}/lib \;
find package/${ARC_NAME} -type d -wholename "*/vendor/windows*" -prune -exec \
rm -rf {}/src \; -exec mkdir -p {}/src \; -exec touch {}/src/lib.rs \; -exec rm -rf {}/lib \;
rm -rf package/${ARC_NAME}/vendor/web-sys/src/*
rm -rf package/${ARC_NAME}/vendor/web-sys/webidls
mkdir -p package/${ARC_NAME}/vendor/web-sys/src
touch package/${ARC_NAME}/vendor/web-sys/src/lib.rs
# Tar the source
tar -C package -czvf package/${ARC_NAME}.tar.gz ${ARC_NAME}
rm -rf package/${ARC_NAME}
rm -rf vendor