[RFC/PATCH 1/5] glossary.h: generate a glossary list from the Makefile

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Generate a header file which lists all terms defined in the glossary
in a way suitable for localisation. This will be used by the new
glossary command.

Signed-off-by: Michael J Gruber <git@xxxxxxxxxxxxxxxxxxxx>
---
I also snuck in a change to the clean target, so that we don't have to update
it (its definition) as long as we keep GENERATED_H up to date.

 .gitignore           | 1 +
 Makefile             | 7 +++++--
 generate-glossary.sh | 8 ++++++++
 3 files changed, 14 insertions(+), 2 deletions(-)
 create mode 100755 generate-glossary.sh

diff --git a/.gitignore b/.gitignore
index a052419..fb4ebaa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -208,6 +208,7 @@
 /test-urlmatch-normalization
 /test-wildmatch
 /common-cmds.h
+/glossary.h
 *.tar.gz
 *.dsc
 *.deb
diff --git a/Makefile b/Makefile
index 14d5ac1..ae74fdf 100644
--- a/Makefile
+++ b/Makefile
@@ -627,7 +627,7 @@ LIB_FILE = libgit.a
 XDIFF_LIB = xdiff/lib.a
 VCSSVN_LIB = vcs-svn/lib.a
 
-GENERATED_H += common-cmds.h
+GENERATED_H += common-cmds.h glossary.h
 
 LIB_H = $(shell $(FIND) . \
 	-name .git -prune -o \
@@ -1649,6 +1649,9 @@ common-cmds.h: ./generate-cmdlist.sh command-list.txt
 common-cmds.h: $(wildcard Documentation/git-*.txt)
 	$(QUIET_GEN)./generate-cmdlist.sh > $@+ && mv $@+ $@
 
+glossary.h: ./generate-glossary.sh Documentation/glossary-content.txt
+	$(QUIET_GEN)./generate-glossary.sh > $@+ && mv $@+ $@
+
 SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):$(GIT_VERSION):\
 	$(localedir_SQ):$(NO_CURL):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
 	$(gitwebdir_SQ):$(PERL_PATH_SQ)
@@ -2356,7 +2359,7 @@ clean: profile-clean coverage-clean
 	$(RM) $(TEST_PROGRAMS) $(NO_INSTALL)
 	$(RM) -r bin-wrappers $(dep_dirs)
 	$(RM) -r po/build/
-	$(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h $(ETAGS_TARGET) tags cscope*
+	$(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope*
 	$(RM) -r $(GIT_TARNAME) .doc-tmp-dir
 	$(RM) $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
 	$(RM) $(htmldocs).tar.gz $(manpages).tar.gz
diff --git a/generate-glossary.sh b/generate-glossary.sh
new file mode 100755
index 0000000..41f1eb3
--- /dev/null
+++ b/generate-glossary.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+echo "/* Automatically generated by $0 */
+
+static const char *glossary[] = {"
+
+sed -n -e 's/^.*\]\]\(.*\)::$/\tN_("\1"),/p' Documentation/glossary-content.txt
+echo "};"
-- 
2.2.0.345.g7041aac

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]