hledger/shell-completion/Makefile
Vladimir Zhelezov bc66b23520 Fix build race condition
Make `command-options` a prerequisite of `hledger-completion.bash`.
Currently the build succeeds only because the former takes less time
to finish than all the prerequisites of the latter. If you run a
`make clean && make -j 4`, the build would fail as they are built
in parallel.
2021-02-28 08:33:18 +01:00

32 lines
867 B
Makefile

.PHONY: command-options clean
all: hledger-completion.bash
hledger-completion.bash: hledger-completion.bash.m4 commands-list.txt query-filters.txt generic-options.txt command-options
m4 hledger-completion.bash.m4 > $@
generic-options.txt:
hledger -h | ./output-options.sh | sort -u > $@
commands.txt:
hledger | ./output-commands.sh | grep -v ^hledger | sort -u > $@
echo ui >> $@
echo web >> $@
echo api >> $@
commands-list.txt: commands.txt
paste -sd, $^ | tr -d '\n' > $@
#query-filters.txt:
# The query filters are hard to extract!
# hledger help --cat hledger | sed -n '/^QUERIES/,/^[A-Z]/p'
command-options: commands.txt
parallel -j8 'hledger {} -h | ./output-options.sh {} | sort -u > options-{}.txt' < commands.txt
clean:
rm -f commands*.txt generic-options.txt options-*.txt
rm -f hledger-completion.bash
rm -rf _{commands,options}.tmp