output asked headers in the order they were asked; avoid header name spoofing by...
[hband-tools.git] / user-tools / Makefile
blob2902f1835b4762f4f78b551b0fe69c5080c40826
2 REPO_ROOT ?= ..
4 TOOLS_TARGET_DIR = /usr/tool
6 include $(dir $(lastword $(MAKEFILE_LIST)))/Makefile.lists.mk
8 SYMLINKS = $(shell find $(addprefix ./,$(TOOLS)) -maxdepth 0 -type l -printf "%f\n")
9 SYMLINK_TOOLS = $(filter $(SYMLINKS),$(TOOLS))
10 NORMAL_TOOLS = $(filter-out $(SYMLINK_TOOLS),$(TOOLS))
11 TOOLS_TARGET_FILES = $(addprefix $(TOOLS_TARGET_DIR)/,$(NORMAL_TOOLS))
12 TOOLS_TARGET_SYMLINKS = $(addprefix $(TOOLS_TARGET_DIR)/,$(SYMLINK_TOOLS))
16 default:
17 @echo You may be interested in: install-all, install-tools, list-tools, manpages
18 @false
19 .PHONY: default
22 $(TOOLS_TARGET_DIR)/msg: /etc/bash_completion.d/msg
23 $(TOOLS_TARGET_DIR)/perl-repl: /usr/libexec/perlshell
24 $(TOOLS_TARGET_DIR)/rsync-semichroot: /usr/share/doc/tool/rsync-semichroot.txt
25 $(TOOLS_TARGET_DIR)/multithrottler: /usr/lib/multithrottler/Throttler.pm
27 /etc/bash_completion.d/msg: $(REPO_ROOT)/bash/bash_completion.d/msg
28 install $(REPO_ROOT)/bash/bash_completion.d/msg $@
29 @echo remove $@ >> uninstall.sh
31 /usr/libexec/perlshell: $(REPO_ROOT)/libexec/perlshell
32 install $(REPO_ROOT)/libexec/perlshell $@
33 @echo remove $@ >> uninstall.sh
35 /usr/share/doc/tool/rsync-semichroot.txt: $(REPO_ROOT)/doc/rsync-semichroot.txt | /usr/share/doc/tool
36 install $(REPO_ROOT)/doc/rsync-semichroot.txt $@
37 @echo remove $@ >> uninstall.sh
39 /usr/lib/tool/bash-utils: $(REPO_ROOT)/bash/bash-utils | /usr/lib/tool
40 install $(REPO_ROOT)/bash/bash-utils $@
41 @echo remove $@ >> uninstall.sh
43 /usr/lib/multithrottler/Throttler.pm: $(REPO_ROOT)/lib/multithrottler/Throttler.pm | /usr/lib/multithrottler
44 install $(REPO_ROOT)/lib/multithrottler/Throttler.pm $@
45 @echo remove $@ >> uninstall.sh
47 /usr/lib/multithrottler:
48 [ -d $@ ] || mkdir $@
49 @echo remove $@ >> uninstall.sh
52 $(TOOLS_TARGET_DIR):
53 [ -d $@ ] || mkdir $@
54 @echo remove $@ >> uninstall.sh
56 /usr/share/doc/tool:
57 [ -d $@ ] || mkdir $@
58 @echo remove $@ >> uninstall.sh
60 /usr/lib/tool:
61 [ -d $@ ] || mkdir $@
62 @echo remove $@ >> uninstall.sh
66 DEPCHECK_TARGETS = $(addprefix DEPCHECK/,$(NORMAL_TOOLS))
67 depcheck-all: $(DEPCHECK_TARGETS)
68 .PHONY: $(DEPCHECK_TARGETS)
70 DEPCHECK/lines:
71 perl -MARGV::readonly -e 1
72 DEPCHECK/parsel:
73 python3 -c 'import parsel; import cssselect'
74 DEPCHECK/xml2json:
75 python -c 'import xmltodict'
76 DEPCHECK/palemoon-current-url:
77 which jq
78 DEPCHECK/dbus-call:
79 perl -MNet::DBus -e 1
80 perl -MXML::Hash::LX -e 1
81 perl -MJSON -e 1
83 .PHONY: try-satisfy-dependencies
84 try-satisfy-dependencies:
85 cpan ARGV::readonly || true
86 apt install python3-parsel || true
87 apt install python3-cssselect || true
88 apt install python3-xmltodict || true
89 apt install jq || true
90 apt install libnet-dbus-perl || cpan Net::DBus || true
91 apt install libxml-hash-lx-perl || cpan XML::Hash::LX || true
92 apt install libjson-perl || cpan JSON || true
93 apt install liblog-log4perl-perl || cpan Log::Log4perl || true
94 apt install libyaml-perl || cpan YAML || true
97 install-all: \
98 /usr/lib/tool/bash-utils \
99 install-tools \
100 install-manpages
101 .PHONY: install-all
104 install-tools: depcheck-all $(TOOLS_TARGET_FILES) $(TOOLS_TARGET_SYMLINKS)
105 .PHONY: install-tools
107 $(TOOLS_TARGET_FILES) $(TOOLS_TARGET_SYMLINKS): | $(TOOLS_TARGET_DIR)
109 $(TOOLS_TARGET_FILES): $(TOOLS_TARGET_DIR)/%: % DEPCHECK/%
110 install --compare $(notdir $@) $(TOOLS_TARGET_DIR)/
111 @echo remove $@ >> uninstall.sh
113 install-symlinks: $(TOOLS_TARGET_SYMLINKS)
114 .PHONY: install-symlinks
116 $(TOOLS_TARGET_SYMLINKS): $(TOOLS_TARGET_DIR)/%: %
117 ln -snfv $(shell readlink $<) $@
118 @echo remove $@ >> uninstall.sh
121 list-tools:
122 @echo $(TOOLS) | tr " " "\n" | sort
123 .PHONY: list-tools
126 include $(dir $(lastword $(MAKEFILE_LIST)))/Makefile.documentation.mk