Permalink
Browse files

more build infrastructure

  • Loading branch information...
1 parent 1da070c commit b317cfdd56f61b3f7c750b773ebad87d3bccf6f6 @LeventErkok committed Dec 19, 2011
Showing with 72 additions and 6 deletions.
  1. +11 −6 Makefile
  2. +3 −0 buildUtils/.gitignore
  3. +5 −0 buildUtils/Makefile
  4. +53 −0 buildUtils/simplify.hs
View
@@ -3,16 +3,20 @@
# The sbv library is distributed with the BSD3 license. See the LICENSE file
# in the distribution for details.
SHELL := /usr/bin/env bash
-SRCS = $(shell find . -name '*.hs' -or -name '*.lhs' | grep -v SBVUnitTest/SBVUnitTest.hs)
+SRCS = $(shell find . -name '*.hs' -or -name '*.lhs' | grep -v SBVUnitTest/SBVUnitTest.hs | grep -v buildUtils/simplify.hs)
LINTSRCS = $(shell find . -name '*.hs' -or -name '*.lhs' | grep -v Paths_sbv.hs)
STAMPFILE = SBVUnitTest/SBVUnitTestBuildTime.hs
DEPSRCS = $(shell find . -name '*.hs' -or -name '*.lhs' | grep -v Paths_sbv.hs | grep -v $(STAMPFILE))
CABAL = cabal
CABPFLAG = --disable-library-profiling --disable-documentation --force-reinstalls --ghc-options=-Werror
+SIMPLIFY = ./buildUtils/simplify
-.PHONY: all install test sdist clean docs gold stamp hlint
+.PHONY: all install test sdist clean docs gold stamp hlint simplify
-all: install
+all: simplify install
+
+simplify:
+ @(make -s -C buildUtils)
install: $(STAMPFILE)
@@ -24,7 +28,7 @@ $(STAMPFILE): $(DEPSRCS)
@echo "buildTime = \"$(shell date)\"" >> ${STAMPFILE}
@find . -name \*.\*hs | xargs hasktags -c
@sort -o tags tags
- @($(CABAL) $(CABPFLAG) install || (rm $(STAMPFILE) && false))
+ @((set -o pipefail; $(CABAL) $(CABPFLAG) install 2>&1 | $(SIMPLIFY)) || (rm $(STAMPFILE) && false))
test:
@echo "Executing inline tests.."
@@ -33,15 +37,16 @@ test:
@time SBVUnitTests
sdist:
- $(CABAL) sdist
+ @(set -o pipefail; $(CABAL) sdist | $(SIMPLIFY))
clean:
rm -rf dist $(STAMPFILE)
docs:
- $(CABAL) haddock --hyperlink-source
+ @(set -o pipefail; $(CABAL) haddock --hyperlink-source 2>&1 | $(SIMPLIFY))
release: clean install sdist docs hlint test
+ @echo "SBV is ready for release!"
# use this as follows: make gold TGTS="cgUSB5"
# where the tag is one (or many) given in the SBVUnitTest.hs file
View
@@ -0,0 +1,3 @@
+*.hi
+*.o
+simplify
View
@@ -0,0 +1,5 @@
+simplify: simplify.hs
+ ghc -O2 -Wall -Werror --make simplify
+
+clean:
+ rm *.o *.hi
View
@@ -0,0 +1,53 @@
+module Main(main) where
+
+import Control.Monad
+import Data.Char
+import Data.List
+import System.IO
+
+main :: IO ()
+main = do hSetBuffering stdin NoBuffering
+ hSetBuffering stdout NoBuffering
+ let loop = do end <- isEOF
+ unless end $ do i <- getLine
+ case clean i of
+ Nothing -> loop
+ Just s -> putStrLn s
+ loop
+ loop
+
+clean :: String -> Maybe String
+clean s
+ | junk s = Nothing
+clean ('[':r) = Just $ extract r
+clean l = Just l
+
+extract :: String -> String
+extract s = case words s of
+ (n : "of" : m' : "Compiling" : _)
+ | not (null m'), last m' == ']', all isDigit n, all isDigit (init m')
+ -> let (f, ']':r) = break (== ']') ('[':s)
+ in unwords ((f ++ "]") : take 2 (words r))
+ _ -> s
+
+junk :: String -> Bool
+junk s = any (`isPrefixOf` s) junkPre || any (`isInfixOf` s) junkIn
+ where junkPre = [ "In order, the following would be installed:"
+ , "ld: warning: could not create compact unwind for"
+ , "Loading package"
+ , "Resolving dependencies"
+ , "Building source dist"
+ , "Preprocessing library"
+ , "Preprocessing executable"
+ , "Running Haddock"
+ , "Running hscolour"
+ , "Warning: The documentation for the following packages are not installed."
+ , "links will be generated to these packages:"
+ , "haddock coverage for"
+ ]
+ junkIn = [ "(reinstall) changes:"
+ , "could not find link destinations for"
+ -- subjective
+ , "Data.SBV.BitVectors.Data.Cached Data.SBV.BitVectors.Data.SW Data.SBV.BitVectors.Data.Outputtable Data.SBV.BitVectors.Data.Quantifier"
+ , "Data.SBV.BitVectors.Data.Outputtable Data.SBV.BitVectors.STree.STreeInternal Data.SBV.SMT.SMT.SMTModel Data.SBV.SMT.SMT.SMTEngine Data.SBV.BitVectors.Data.State Data.SBV.Compilers.CodeGen.CgState"
+ ]

0 comments on commit b317cfd

Please sign in to comment.