Git fork

Documentation: extract script to generate a list of mergetools

We include the list of available mergetools into our manpages. Extract
the script that performs this logic such that we can reuse it in other
build systems.

While at it, refactor the Makefile targets such that we don't create
"mergetools-list.made" anymore. It shouldn't be necessary, as we can
instead have other targets depend on "mergetools-{diff,merge}.txt"
directly.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Patrick Steinhardt and committed by
Junio C Hamano
023c3370 628d49f6

+25 -14
+8 -14
Documentation/Makefile
··· 282 282 -include ../GIT-VERSION-FILE 283 283 endif 284 284 285 + mergetools_txt = mergetools-diff.txt mergetools-merge.txt 286 + 285 287 # 286 288 # Determine "include::" file references in asciidoc files. 287 289 # 288 290 docdep_prereqs = \ 289 - mergetools-list.made $(mergetools_txt) \ 291 + $(mergetools_txt) \ 290 292 cmd-list.made $(cmds_txt) 291 293 292 294 doc.dep : $(docdep_prereqs) $(DOC_DEP_TXT) build-docdep.perl ··· 315 317 $(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl .. . $(cmds_txt) && \ 316 318 date >$@ 317 319 318 - mergetools_txt = mergetools-diff.txt mergetools-merge.txt 319 - 320 - $(mergetools_txt): mergetools-list.made 321 - 322 - mergetools-list.made: ../git-mergetool--lib.sh $(wildcard ../mergetools/*) 323 - $(QUIET_GEN) \ 324 - $(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && TOOL_MODE=diff && \ 325 - . ../git-mergetool--lib.sh && \ 326 - show_tool_names can_diff' | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >mergetools-diff.txt && \ 327 - $(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && TOOL_MODE=merge && \ 328 - . ../git-mergetool--lib.sh && \ 329 - show_tool_names can_merge' | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >mergetools-merge.txt && \ 330 - date >$@ 320 + mergetools-%.txt: generate-mergetool-list.sh ../git-mergetool--lib.sh $(wildcard ../mergetools/*) 321 + mergetools-diff.txt: 322 + $(QUIET_GEN)$(SHELL_PATH) ./generate-mergetool-list.sh .. diff $@ 323 + mergetools-merge.txt: 324 + $(QUIET_GEN)$(SHELL_PATH) ./generate-mergetool-list.sh .. merge $@ 331 325 332 326 TRACK_ASCIIDOCFLAGS = $(subst ','\'',$(ASCIIDOC_COMMON):$(ASCIIDOC_HTML):$(ASCIIDOC_DOCBOOK)) 333 327
+17
Documentation/generate-mergetool-list.sh
··· 1 + #!/bin/sh 2 + 3 + if test "$#" -ne 3 4 + then 5 + echo >&2 "USAGE: $0 <SOURCE_DIR> <MODE> <OUTPUT>" 6 + exit 1 7 + fi 8 + 9 + SOURCE_DIR="$1" 10 + TOOL_MODE="$2" 11 + OUTPUT="$3" 12 + MERGE_TOOLS_DIR="$SOURCE_DIR/mergetools" 13 + 14 + ( 15 + . "$SOURCE_DIR"/git-mergetool--lib.sh && 16 + show_tool_names can_$TOOL_MODE 17 + ) | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >"$OUTPUT"