interplane.Get Omega
Read in your language

git

[Ported from github.com/git/git] Sync with Git 2.56.1

Brought by drakestapleton

branch master Branches Tags History

git / tools / generate-configlist.sh

55 lines · 1063 bytes Raw Blame History
1#!/bin/sh
2
3SOURCE_DIR="$1"
4OUTPUT="$2"
5DEPFILE="$3"
6
7if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT"
8then
9 echo >&2 "USAGE: $0 <SOURCE_DIR> <OUTPUT> [<DEPFILE>]"
10 exit 1
11fi
12
13print_config_list () {
14 cat <<EOF
15static const char *config_name_list[] = {
16EOF
17 sed -e '
18 /^`*[a-zA-Z].*\..*`*::$/ {
19 /deprecated/d;
20 s/::$//;
21 s/`//g;
22 s/^.*$/ "&",/;
23 p;};
24 d' \
25 "$SOURCE_DIR"/Documentation/*config.adoc \
26 "$SOURCE_DIR"/Documentation/config/*.adoc |
27 sort
28 cat <<EOF
29 NULL,
30};
31EOF
32}
33
34{
35 echo "/* Automatically generated by generate-configlist.sh */"
36 echo
37 echo
38 print_config_list
39} >"$OUTPUT"
40
41if test -n "$DEPFILE"
42then
43 QUOTED_OUTPUT="$(printf '%s\n' "$OUTPUT" | sed 's,[&/\],\\&,g')"
44 {
45 printf '%s' "$QUOTED_OUTPUT: "
46 printf '%s\n' "$SOURCE_DIR"/Documentation/*config.adoc \
47 "$SOURCE_DIR"/Documentation/config/*.adoc |
48 sed -e 's/[# ]/\\&/g' |
49 tr '\n' ' '
50 printf '\n'
51 printf '%s:\n' "$SOURCE_DIR"/Documentation/*config.adoc \
52 "$SOURCE_DIR"/Documentation/config/*.adoc |
53 sed -e 's/[# ]/\\&/g'
54 } >"$DEPFILE"
55fi