-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathMakefile
More file actions
80 lines (66 loc) · 2.37 KB
/
Makefile
File metadata and controls
80 lines (66 loc) · 2.37 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
# Copyright 2023 The ChromiumOS Authors
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
RUSTFLAGS='-C target-feature=+crt-static'
.PHONY : build
build:
@rustup -q which rustc > /dev/null || { echo "Please install rustup via https://rustup.rs/" ; exit 1 ; }
RUSTFLAGS=$(RUSTFLAGS) cargo build --target x86_64-unknown-linux-gnu
make doc
.PHONY : doc
doc: docs/cmdline.md
.PHONY : release_build
release_build:
@rustup -q which rustc > /dev/null || { echo "Please install rustup via https://rustup.rs/" ; exit 1 ; }
RUSTFLAGS=$(RUSTFLAGS) cargo build --release --target x86_64-unknown-linux-gnu
.PHONY : install
install:
@rustup -q which rustc > /dev/null || { echo "Please install rustup via https://rustup.rs/" ; exit 1 ; }
RUSTFLAGS=$(RUSTFLAGS) cargo install --target x86_64-unknown-linux-gnu --path . --locked
@echo $$SHELL | grep bash > /dev/null && cro3 setup bash-completion || echo "SHELL is not Bash. Command completion will not work."
@printf "\ncro3 is successfully installed at `which cro3`. Try \`cro3 --help\` if you want!\n"
.PHONY : check
check:
cargo fmt
cargo clippy -- -D warnings
cargo test
cargo check
.PHONY : shellcheck
shellcheck:
shellcheck `git ls-files *.sh *.bash`
# - https://google.github.io/styleguide/shellguide.html#indentation
# > Indent 2 spaces. No tabs.
shfmt -w -i 2 .
.PHONY : commit
commit:
make
make check
make shellcheck
git add -A
git commit
.PHONY : test
test:
make build
cargo test
make cmdline_doc_check
make bash_completion_check
.PHONY : release
release:
bash scripts/deploy_release.sh
DOC_SRC=$(shell git ls-files src/cmd/*.rs)
docs/cmdline.md: docs/cmdline_preface.md ${DOC_SRC} Makefile
cp docs/cmdline_preface.md $@
@cat ${DOC_SRC} | grep '//!' | sed -E 's#^//! ?##' >> $@
.PHONY : cmdline_doc_check
cmdline_doc_check:
./scripts/cmdline_doc_check.sh
.PHONY : bash_completion_check
bash_completion_check:
./scripts/bash_completion_check.sh
.PHONY : preview
preview: docs/cmdline.md
make --silent cmdline_doc_check 2>/dev/null || echo "^^^^ Warning: This warning has been ignored but please fix them before submitting!"
gh extension exec markdown-preview docs/cmdline.md --host 0.0.0.0 || \
echo "To install markdown-preview, run: gh extension install https://github.com/yusukebe/gh-markdown-preview | cat -"