Fix new-theory script for new, flattened build system.
authorMorgan Deters <mdeters@cs.nyu.edu>
Tue, 12 Nov 2013 15:10:45 +0000 (10:10 -0500)
committerMorgan Deters <mdeters@cs.nyu.edu>
Tue, 12 Nov 2013 15:11:06 +0000 (10:11 -0500)
contrib/alttheoryskel/Makefile [deleted file]
contrib/alttheoryskel/Makefile.am [deleted file]
contrib/new-theory
contrib/theoryskel/Makefile [deleted file]
contrib/theoryskel/Makefile.am [deleted file]

diff --git a/contrib/alttheoryskel/Makefile b/contrib/alttheoryskel/Makefile
deleted file mode 100644 (file)
index 2aeda0c..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-topdir = ../../..
-srcdir = src/theory/$dir
-
-include $(topdir)/Makefile.subdir
diff --git a/contrib/alttheoryskel/Makefile.am b/contrib/alttheoryskel/Makefile.am
deleted file mode 100644 (file)
index 2f36e8f..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-AM_CPPFLAGS = \
-       -D__BUILDING_CVC4LIB \
-       -I@builddir@/../.. -I@srcdir@/../../include -I@srcdir@/../..
-AM_CXXFLAGS = -Wall -Wno-unknown-pragmas $(FLAG_VISIBILITY_HIDDEN)
-
-noinst_LTLIBRARIES = lib$dir.la
-
-lib$dir_la_SOURCES = \
-       theory_$dir.h \
-       theory_$dir.cpp
-
-EXTRA_DIST = \
-       kinds \
-       options_handlers.h
index 4649e5943f43e26cf53b8a0491e22049f4dadf5e..c1478a980beb24c68c3cae1d1ae4bff2d7e00497 100755 (executable)
@@ -5,6 +5,11 @@
 
 cd "`dirname "$0"`/.."
 
+if ! perl -v &>/dev/null; then
+  echo "ERROR: perl is required to run this script." >&2
+  exit 1
+fi
+
 if [ ! -e src/theory/theory_engine.h ]; then
   echo "ERROR: This script doesn't appear to be the contrib/ subdirectory" >&2
   echo "ERROR: of the CVC4 source tree." >&2
@@ -126,34 +131,36 @@ else
 fi
 
 echo
-echo "Adding $dir to SUBDIRS to src/theory/Makefile.am..."
-if grep -q '^SUBDIRS = .*[^a-zA-Z0-9_]'"$dir"'\([^a-zA-Z0-9_]\|$\)' src/theory/Makefile.am &>/dev/null; then
-  echo "NOTE: src/theory/Makefile.am already descends into dir $dir"
+echo "Adding $dir to THEORIES to src/Makefile.am..."
+if grep -q '^THEORIES = .*[^a-zA-Z0-9_]'"$dir"'\([^a-zA-Z0-9_]\|$\)' src/Makefile.am &>/dev/null; then
+  echo "NOTE: src/Makefile.am already lists theory $dir"
 else
-  awk '/^SUBDIRS = / {print $0,"'"$dir"'"} !/^SUBDIRS = / {print$0}' src/theory/Makefile.am > src/theory/Makefile.am.new-theory
-  if ! cp -f src/theory/Makefile.am src/theory/Makefile.am~; then
-    echo "ERROR: cannot copy src/theory/Makefile.am !" >&2
+  awk '/^THEORIES = / {print $0,"'"$dir"'"} !/^THEORIES = / {print$0}' src/Makefile.am > src/Makefile.am.new-theory
+  if ! cp -f src/Makefile.am src/Makefile.am~; then
+    echo "ERROR: cannot copy src/Makefile.am !" >&2
     exit 1
   fi
-  if ! mv -f src/theory/Makefile.am.new-theory src/theory/Makefile.am; then
-    echo "ERROR: cannot replace src/theory/Makefile.am !" >&2
+  if ! mv -f src/Makefile.am.new-theory src/Makefile.am; then
+    echo "ERROR: cannot replace src/Makefile.am !" >&2
     exit 1
   fi
 fi
 
-echo "Adding lib$dir.la to LIBADD to src/theory/Makefile.am..."
-if grep -q '^  @builddir@/'"$dir"'/lib'"$dir"'\.la\>' src/theory/Makefile.am &>/dev/null; then
-  echo "NOTE: src/theory/Makefile.am already seems to include lib$dir.la"
-else
-  awk '!/^libtheory_la_LIBADD = / {print$0} /^libtheory_la_LIBADD = / {while(/\\ *$/){print $0;getline} print $0,"\\";print "\t@builddir@/'"$dir"'/lib'"$dir"'.la"}' src/theory/Makefile.am > src/theory/Makefile.am.new-theory
-  if ! cp -f src/theory/Makefile.am src/theory/Makefile.am~; then
-    echo "ERROR: cannot copy src/theory/Makefile.am !" >&2
-    exit 1
-  fi
-  if ! mv -f src/theory/Makefile.am.new-theory src/theory/Makefile.am; then
-    echo "ERROR: cannot replace src/theory/Makefile.am !" >&2
-    exit 1
-  fi
+echo "Adding sources to src/Makefile.am..."
+
+perl -e '
+  while(<>) { print; last if /^libcvc4_la_SOURCES = /; }
+  if('$alternate') {
+    while(<>) { if(!/\\$/) { chomp; print "$_ \\\n\ttheory/'"$dir"'/theory_'"$dir"'.h \\\n\ttheory/'"$dir"'/theory_'"$dir"'.cpp\n"; last; } else { print; } }
+  } else {
+    while(<>) { if(!/\\$/) { chomp; print "$_ \\\n\ttheory/'"$dir"'/theory_'"$dir"'.h \\\n\ttheory/'"$dir"'/theory_'"$dir"'.cpp \\\n\ttheory/'"$dir"'/theory_'"$dir"'_rewriter.h \\\n\ttheory/'"$dir"'/theory_'"$dir"'_type_rules.h\n"; last; } else { print; } }
+  }
+  while(<>) { print; last if /^EXTRA_DIST = /; }
+  while(<>) { if(!/\\$/) { chomp; print "$_ \\\n\ttheory/'"$dir"'/kinds \\\n\ttheory/'"$dir"'/options_handlers.h\n"; last; } else { print; } }
+  while(<>) { print; }' src/Makefile.am > src/Makefile.am.new-theory
+if ! mv -f src/Makefile.am.new-theory src/Makefile.am; then
+  echo "ERROR: cannot replace src/Makefile.am !" >&2
+  exit 1
 fi
 
 echo "Adding ../theory/$dir/options.cpp to OPTIONS_FILES_SRCS"
diff --git a/contrib/theoryskel/Makefile b/contrib/theoryskel/Makefile
deleted file mode 100644 (file)
index 2aeda0c..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-topdir = ../../..
-srcdir = src/theory/$dir
-
-include $(topdir)/Makefile.subdir
diff --git a/contrib/theoryskel/Makefile.am b/contrib/theoryskel/Makefile.am
deleted file mode 100644 (file)
index 000544d..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-AM_CPPFLAGS = \
-       -D__BUILDING_CVC4LIB \
-       -I@builddir@/../.. -I@srcdir@/../../include -I@srcdir@/../..
-AM_CXXFLAGS = -Wall -Wno-unknown-pragmas $(FLAG_VISIBILITY_HIDDEN)
-
-noinst_LTLIBRARIES = lib$dir.la
-
-lib$dir_la_SOURCES = \
-       theory_$dir.h \
-       theory_$dir.cpp \
-       theory_$dir_rewriter.h \
-       theory_$dir_type_rules.h
-
-EXTRA_DIST = \
-       kinds \
-       options_handlers.h