-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
62 lines (46 loc) · 1.77 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
# Thunderbolt/USB4 debug tools
# Copyright (C) 2023, Intel Corporation
CARGO = cargo
INSTALL = install
LN = ln
RM = rm
RMDIR = rmdir
# Release build, uncomment for debug build
#CFLAGS =
#IFLAGS = --debug
CFLAGS = -r
IFLAGS =
# For buildroot, override $PREFIX if using something else
BR_HOME ?= $(HOME)/devel/buildroot
PREFIX ?= $(BR_HOME)/output/target/usr
TOOLS = tbadapters tbauth tbdump tbget tblist tbmargin tbset tbtrace
SCRIPTS = nvm-version.sh pcie-downstream-mapping.sh reset-port.sh tb-bandwidth.sh
build:
$(CARGO) build $(CFLAGS)
run:
$(CARGO) run $(CFLAGS)
install-scripts:
$(INSTALL) -d $(PREFIX)/share/tbtools/scripts
$(foreach script, $(SCRIPTS), $(INSTALL) -m 0755 scripts/$(script) $(PREFIX)/share/tbtools/scripts/$(script);)
uninstall-scripts:
$(foreach script, $(SCRIPTS), $(RM) -f $(PREFIX)/share/tbtools/scripts/$(script);)
-$(RMDIR) $(PREFIX)/share/tbtools/scripts
install-completion:
$(INSTALL) -d $(PREFIX)/share/bash-completion/completions
$(INSTALL) -m 0644 scripts/tbtools-completion.bash $(PREFIX)/share/bash-completion/completions
$(foreach tool, $(TOOLS), $(LN) -sf tbtools-completion.bash $(PREFIX)/share/bash-completion/completions/$(tool);)
uninstall-completion:
$(foreach tool, $(TOOLS), $(RM) -f $(PREFIX)/share/bash-completion/completions/$(tool);)
$(RM) -f $(PREFIX)/share/bash-completion/completions/tbtools-completion.bash
install-binaries:
$(CARGO) install $(IFLAGS) --path . --root $(PREFIX)
# Create convenient lstb symlink as well
$(LN) -sf tblist $(PREFIX)/bin/lstb
uninstall-binaries:
$(CARGO) uninstall --root $(PREFIX)
$(RM) -f $(PREFIX)/bin/lstb
install: install-binaries install-completion install-scripts
uninstall: uninstall-scripts uninstall-completion uninstall-binaries
clean:
$(CARGO) clean
.PHONY: build run install clean