summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim King <taking@cs.nyu.edu>2015-11-05 00:08:45 -0800
committerTim King <taking@cs.nyu.edu>2015-11-05 00:08:45 -0800
commite4ac720f865ce499c6f818f0cdb60dfabe913df5 (patch)
tree6927c5e08ee00d2d9baa950665dea4440bc87776
parentf9e109b0ac12ffbfd167a19dcd60f16241a0542c (diff)
This commit slightly generalizes the scripts for generating the _tags files.
-rw-r--r--src/options/Makefile.am6
-rwxr-xr-xsrc/options/mktagheaders10
-rwxr-xr-xsrc/options/mktags9
3 files changed, 17 insertions, 8 deletions
diff --git a/src/options/Makefile.am b/src/options/Makefile.am
index 19aa43c98..ad0ec7914 100644
--- a/src/options/Makefile.am
+++ b/src/options/Makefile.am
@@ -148,7 +148,7 @@ BUILT_SOURCES += \
%_tags.h: %_tags mktagheaders
$(AM_V_at)chmod +x @srcdir@/mktagheaders
- $(AM_V_GEN)( @srcdir@/mktagheaders "$<" ) >"$@"
+ $(AM_V_GEN)( @srcdir@/mktagheaders "$<" "$<" ) >"$@"
# This .tmp business is to keep from having to re-compile options.cpp
# (and then re-link the libraries) if nothing has changed.
@@ -162,7 +162,9 @@ BUILT_SOURCES += \
# expression (no |, no \<, ...).
Debug_tags.tmp Trace_tags.tmp: mktags
$(AM_V_at)chmod +x @srcdir@/mktags
- $(AM_V_GEN)(@srcdir@/mktags '$(@:_tags.tmp=)' '@srcdir@/../') >"$@"
+ $(AM_V_GEN)(@srcdir@/mktags \
+ '$(@:_tags.tmp=)' \
+ "$$(find @srcdir@/../ -name '*.cpp' -o -name '*.h' -o -name '*.cc' -o -name '*.g')") >"$@"
MOSTLYCLEANFILES = \
Debug_tags \
diff --git a/src/options/mktagheaders b/src/options/mktagheaders
index 5ef3b3172..af44cee8d 100755
--- a/src/options/mktagheaders
+++ b/src/options/mktagheaders
@@ -7,12 +7,16 @@
#
# Invocation:
#
-# mktagheaders <tag-file>
+# mktagheaders <tag-name> <tag-file>
#
+# <tag-name> will be the name of the generated array.
+# <tag-file> each line of this file is turned into a string in the generated
+# array.
-TAG_FILE=$1
+TAG_NAME=$1
+TAG_FILE=$2
-echo 'static char const* const '$TAG_FILE'[] = {';
+echo 'static char const* const '$TAG_NAME'[] = {';
for tag in `cat $TAG_FILE`; do
echo "\"$tag\",";
done;
diff --git a/src/options/mktags b/src/options/mktags
index 169b373b8..090e57014 100755
--- a/src/options/mktags
+++ b/src/options/mktags
@@ -13,14 +13,17 @@
#
# Invocation:
#
-# mktags {Debug,Trace} <directory>
+# mktags {Debug,Trace} <input-files>
#
+# <input-files> is expected to be passed a single space separated list of files.
+# One can use quotes to achieve this. This is one reason to use "$(...)"
+# instead of back ticks `...`.
DebugOrTrace=$1
-FindDirectory=$2
+InputFiles=$2
grep -h '\<'$DebugOrTrace'\(\.isOn\)* *( *\".*\" *)' \
- `find $FindDirectory -name "*.cpp" -o -name "*.h" -o -name "*.cc" -o -name "*.g"` | \
+ $InputFiles | \
sed 's/\/\/.*//;s/^'$DebugOrTrace'\(\.isOn\)* *( *\"\([^"]*\)\".*/\2/;s/.*[^a-zA-Z0-9_]'$DebugOrTrace'\(\.isOn\)* *( *\"\([^"]*\)\".*/\2/' | \
LC_ALL=C sort | \
uniq
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback