Use cabal to build the binary and documentation.
authorMichael Orlitzky <michael@orlitzky.com>
Sun, 11 Dec 2011 14:48:28 +0000 (09:48 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Sun, 11 Dec 2011 14:48:28 +0000 (09:48 -0500)
Setup.hs [new file with mode: 0644]
makefile
twat.cabal [new file with mode: 0644]

diff --git a/Setup.hs b/Setup.hs
new file mode 100644 (file)
index 0000000..9a994af
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
index 6f9eadf547f5137c46310ad69dbfcaf361690be7..8bd7248952ed1c4f53cf4f2eeb92460be6c5b7b1 100644 (file)
--- a/makefile
+++ b/makefile
@@ -1,40 +1,19 @@
-GHC_WARNINGS := -Wall
-GHC_WARNINGS += -fwarn-hi-shadowing
-GHC_WARNINGS += -fwarn-missing-signatures
-GHC_WARNINGS += -fwarn-name-shadowing
-GHC_WARNINGS += -fwarn-orphans
-GHC_WARNINGS += -fwarn-type-defaults
-
-BIN=bin/twat
-
 .PHONY : doc test
 
-all: $(BIN)
-
-$(BIN): src/Twitter/*.hs src/*.hs
-       ghc -O2 $(GHC_WARNINGS) --make -o $(BIN) src/Twitter/*.hs src/*.hs
-
-profile: src/Twitter/*.hs src/*.hs
-       ghc -O2 $(GHC_WARNINGS) -prof -auto-all --make -o $(BIN) src/Twitter/*.hs src/*.hs
+twat: src/*.hs src/Twitter/*.hs
+       runghc Setup.hs clean
+       runghc Setup.hs configure --user
+       runghc Setup.hs build
 
 clean:
-       rm -f $(BIN)
-       rm -f src/*.hi
-       rm -f src/Twitter/*.hi
-       rm -f src/*.o
-       rm -f src/Twitter/*.o
-       rm -f *.prof
+       runghc Setup.hs clean
 
 test:
        runghc -i"src" test/TestSuite.hs
 
+# Neither 'haddock' nor 'hscolour' seem to work properly.
 doc:
-       mkdir -p doc
-       haddock -i /usr/share/doc/haxml-1.13.2/html/HaXml.haddock \
-               -i /usr/share/doc/ghc-6.8.2/libraries/base/base.haddock \
-               -i /usr/share/doc/curl-1.3.5/html/curl.haddock \
-               -i /usr/share/doc/regex-compat-0.71.0.1/html/regex-compat.haddock \
-               -i /usr/share/doc/ghc-6.8.2/libraries/process/process.haddock \
-               -h \
-               -o doc/ \
-               src/*.hs src/Twitter/*.hs
+       runghc Setup.hs hscolour --executables
+       runghc Setup.hs haddock --internal    \
+                               --executables \
+                               --hyperlink-source
diff --git a/twat.cabal b/twat.cabal
new file mode 100644 (file)
index 0000000..96779ae
--- /dev/null
@@ -0,0 +1,43 @@
+name:           twat
+version:        0.0
+cabal-version:  >= 1.8
+author:         Michael Orlitzky
+maintainer:    Michael Orlitzky <michael@orlitzky.com>
+synopsis:
+  Twat twats tweets so you don't have to twitter.
+build-type:     Simple
+
+executable twat
+  build-depends:
+    base                        == 4.4.*,
+    curl                        == 1.3.*,
+    HaXml                       == 1.22.*,
+    HUnit                       == 1.2.*,
+    MissingH                    == 1.*,
+    process                     == 1.*,
+    old-time                    == 1.*,
+    regex-compat                == 0.*
+
+
+  main-is:
+    Main.hs
+
+  hs-source-dirs:
+    src/
+
+  ghc-options:
+    -Wall
+    -fwarn-hi-shadowing
+    -fwarn-missing-signatures
+    -fwarn-name-shadowing
+    -fwarn-orphans
+    -fwarn-type-defaults
+    -fwarn-tabs
+    -fwarn-incomplete-record-updates
+    -fwarn-monomorphism-restriction
+    -fwarn-unused-do-bind
+    -funbox-strict-fields
+    -fexcess-precision
+    -fno-spec-constr-count
+    -optc-O3
+    -optc-march=native