From: Morgan Deters Date: Tue, 12 Nov 2013 15:10:45 +0000 (-0500) Subject: Fix new-theory script for new, flattened build system. X-Git-Tag: cvc5-1.0.0~7263 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5efc6eeb5e46ec7a907a96ccfaa947688ce69885;p=cvc5.git Fix new-theory script for new, flattened build system. --- diff --git a/contrib/alttheoryskel/Makefile b/contrib/alttheoryskel/Makefile deleted file mode 100644 index 2aeda0cf8..000000000 --- a/contrib/alttheoryskel/Makefile +++ /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 index 2f36e8fc1..000000000 --- a/contrib/alttheoryskel/Makefile.am +++ /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 diff --git a/contrib/new-theory b/contrib/new-theory index 4649e5943..c1478a980 100755 --- a/contrib/new-theory +++ b/contrib/new-theory @@ -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 index 2aeda0cf8..000000000 --- a/contrib/theoryskel/Makefile +++ /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 index 000544d98..000000000 --- a/contrib/theoryskel/Makefile.am +++ /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