summaryrefslogtreecommitdiff
path: root/src/options
diff options
context:
space:
mode:
authorTim King <taking@google.com>2015-10-23 17:47:11 -0700
committerTim King <taking@google.com>2015-10-26 10:04:26 -0700
commit596581cefe8bc36f30f685d884d6152ff0b80b03 (patch)
tree505b39b24b818daf1374acc0459edc0493400ae3 /src/options
parent918b0fd9ecde048773d245eac66eba9b4306d9d2 (diff)
This commit moves the scripts for building the Debug_tags, Traces_tags, Debug_tags.h and Trace_tags.h out of options/Makefile.am and into seperate scripts. This also enables these files always being created.
Diffstat (limited to 'src/options')
-rw-r--r--src/options/Makefile.am39
-rwxr-xr-xsrc/options/mktagheaders20
-rwxr-xr-xsrc/options/mktags32
3 files changed, 65 insertions, 26 deletions
diff --git a/src/options/Makefile.am b/src/options/Makefile.am
index 24b78836a..19aa43c98 100644
--- a/src/options/Makefile.am
+++ b/src/options/Makefile.am
@@ -131,35 +131,24 @@ EXTRA_DIST = \
../smt/smt_options.cpp \
options.cpp \
options_holder.h \
- $(OPTIONS_FILES_SRCS)
+ $(OPTIONS_FILES_SRCS) \
+ mktagheaders \
+ mktags
+
-if CVC4_DEBUG
-# listing Debug_tags too ensures that make doesn't auto-remove it
+# listing {Debug,Trace}_tags too ensures that make doesn't auto-remove it
# after building (if it does, we don't get the "cached" effect with
# the .tmp files below, and we have to re-compile and re-link each
# time, even when there are no changes).
BUILT_SOURCES += \
Debug_tags.h \
- Debug_tags
-endif
-if CVC4_TRACING
-# listing Trace_tags too ensures that make doesn't auto-remove it
-# after building (if it does, we don't get the "cached" effect with
-# the .tmp files below, and we have to re-compile and re-link each
-# time, even when there are no changes).
-BUILT_SOURCES += \
+ Debug_tags \
Trace_tags.h \
Trace_tags
-endif
-%_tags.h: %_tags
- $(AM_V_GEN)( \
- echo 'static char const* const $^[] = {'; \
- for tag in `cat $^`; do \
- echo "\"$$tag\","; \
- done; \
- echo 'NULL'; \
- echo '};' \
- ) >"$@"
+
+%_tags.h: %_tags mktagheaders
+ $(AM_V_at)chmod +x @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.
@@ -171,11 +160,9 @@ endif
# The "sed" invocation below is particularly obnoxious, but it works around
# inconsistencies in REs on different platforms, using only a basic regular
# expression (no |, no \<, ...).
-Debug_tags.tmp Trace_tags.tmp:
- $(AM_V_GEN)\
- grep -h '\<$(@:_tags.tmp=)\(\.isOn\)* *( *\".*\" *)' \
- `find @srcdir@/../ -name "*.cpp" -o -name "*.h" -o -name "*.cc" -o -name "*.g"` | \
- sed 's/\/\/.*//;s/^$(@:_tags.tmp=)\(\.isOn\)* *( *\"\([^"]*\)\".*/\2/;s/.*[^a-zA-Z0-9_]$(@:_tags.tmp=)\(\.isOn\)* *( *\"\([^"]*\)\".*/\2/' | LC_ALL=C sort | uniq >"$@"
+Debug_tags.tmp Trace_tags.tmp: mktags
+ $(AM_V_at)chmod +x @srcdir@/mktags
+ $(AM_V_GEN)(@srcdir@/mktags '$(@:_tags.tmp=)' '@srcdir@/../') >"$@"
MOSTLYCLEANFILES = \
Debug_tags \
diff --git a/src/options/mktagheaders b/src/options/mktagheaders
new file mode 100755
index 000000000..63a19bc23
--- /dev/null
+++ b/src/options/mktagheaders
@@ -0,0 +1,20 @@
+#!/bin/bash
+#
+# mktagheaders
+#
+# The purpose of this script is to generate the *_tag.h header file from the
+# *_tags file.
+#
+# Invocation:
+#
+# mktagheaders <tag-file>
+#
+
+TAG_FILE=$1
+
+echo 'static char const* const '$TAG_FILE'[] = {';
+for tag in `cat $TAG_FILE`; do
+ echo "\"$$tag\",";
+done;
+echo 'NULL';
+echo '};'
diff --git a/src/options/mktags b/src/options/mktags
new file mode 100755
index 000000000..169b373b8
--- /dev/null
+++ b/src/options/mktags
@@ -0,0 +1,32 @@
+#!/bin/bash
+#
+# mktags
+#
+# The purpose of this script is to create Debug_tags and Trace_tags files.
+# Note that in the Makefile workflow these are first stored in a *_tags.tmp
+# file. This file contains a list of all of the strings that occur in things
+# like Debug("foo") or Debug.isOn("bar") in a given directory. The list is
+# seperated by newlines. The expected Debug_tags file for the previous two
+# tags would be:
+# bar
+# foo
+#
+# Invocation:
+#
+# mktags {Debug,Trace} <directory>
+#
+
+DebugOrTrace=$1
+FindDirectory=$2
+
+grep -h '\<'$DebugOrTrace'\(\.isOn\)* *( *\".*\" *)' \
+ `find $FindDirectory -name "*.cpp" -o -name "*.h" -o -name "*.cc" -o -name "*.g"` | \
+ sed 's/\/\/.*//;s/^'$DebugOrTrace'\(\.isOn\)* *( *\"\([^"]*\)\".*/\2/;s/.*[^a-zA-Z0-9_]'$DebugOrTrace'\(\.isOn\)* *( *\"\([^"]*\)\".*/\2/' | \
+ LC_ALL=C sort | \
+ uniq
+
+
+# Reference copy of what this is replacing.
+# grep -h '\<$(@:_tags.tmp=)\(\.isOn\)* *( *\".*\" *)' \
+# `find @srcdir@/../ -name "*.cpp" -o -name "*.h" -o -name "*.cc" -o -name "*.g"` | \
+# sed 's/\/\/.*//;s/^$(@:_tags.tmp=)\(\.isOn\)* *( *\"\([^"]*\)\".*/\2/;s/.*[^a-zA-Z0-9_]$(@:_tags.tmp=)\(\.isOn\)* *( *\"\([^"]*\)\".*/\2/' | LC_ALL=C sort | uniq
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback