]> gitweb.michael.orlitzky.com - spline3.git/commitdiff
Update the makefile to use Cabal.
authorMichael Orlitzky <michael@orlitzky.com>
Sun, 27 Nov 2011 01:37:28 +0000 (20:37 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Sun, 27 Nov 2011 01:37:28 +0000 (20:37 -0500)
makefile

index 0db6ce105640de93d2bcc1268b8dbfb0e4026360..236c495dc7f61abb94bd803e481972f436b1e6be 100644 (file)
--- a/makefile
+++ b/makefile
-BIN := spline3
-TMPDIR := /tmp
-
-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
-GHC_WARNINGS += -fwarn-tabs
-GHC_WARNINGS += -fwarn-incomplete-record-updates
-GHC_WARNINGS += -fwarn-monomorphism-restriction
-GHC_WARNINGS += -fwarn-unused-do-bind
-
-OPTIMIZATIONS := -O2
-OPTIMIZATIONS += -funbox-strict-fields
-OPTIMIZATIONS += -fexcess-precision
-OPTIMIZATIONS += -fno-spec-constr-count
-
-GHC_OPTS += $(OPTIMIZATIONS)
-GHC_OPTS += $(GHC_WARNINGS)
-GHC_OPTS += -odir $(TMPDIR)
-GHC_OPTS += -hidir $(TMPDIR)
-GHC_OPTS += --make
-GHC_OPTS += -rtsopts
-GHC_OPTS += -threaded
-GHC_OPTS += -o bin/${BIN}
-
 .PHONY : test publish_doc doc src_html hlint
 
-$(BIN): src/*.hs
-       ghc -optc-O3 -optc-march=native $(GHC_OPTS) src/*.hs
+spline3: src/*.hs
+       runghc Setup.hs clean
+       runghc Setup.hs configure --user --flags=${FLAGS}
+       runghc Setup.hs build
 
 llvm: src/*.hs
-       ghc -fllvm -optlo-O3 -optlc-O3 $(GHC_OPTS) src/*.hs
+       FLAGS="llvm" make
 
 profile: src/*.hs
-       GHC_OPTS="-prof -auto-all -caf-all" make
-
-profile-llvm: src/*.hs
-       GHC_OPTS="-fllvm -prof -auto-all -caf-all" make llvm
+       runghc Setup.hs configure --user --enable-executable-profiling
+       runghc Setup.hs build
 
 hpc: src/*.hs
-       GHC_OPTS="-fhpc" make
+       FLAGS="hpc" make
 
 clean:
-       rm -f bin/$(BIN)
-       rm -f $(TMPDIR)/*.hi
-       rm -f $(TMPDIR)/*.o
+       runghc Setup.hs clean
+       rm -f dist/
        rm -f *.prof
-       rm -rf doc/html/*
+       rm -rf .hpc
 
 test:
        runghc -i"src" test/TestSuite.hs
 
-
 src_html:
        util/hscolour_srcs
 
-
-DOCS := -i /usr/share/doc/ghc-*/html/libraries/base-*/base.haddock
-DOCS += -i /usr/share/doc/ghc-*/html/libraries/ghc-prim-*/ghc-prim.haddock
-DOCS += -i /usr/share/doc/ghc-*/html/libraries/haskell98-*/haskell98.haddock
-DOCS += -i /usr/share/doc/quickcheck-*/html/QuickCheck.haddock
-DOCS += -i /usr/share/doc/hunit-*/html/HUnit.haddock
-DOCS += -i /usr/share/doc/test-framework-*/html/test-framework.haddock
-DOCS += -i /usr/share/doc/repa-*/html/repa.haddock
-DOCS += -i /usr/share/doc/vector-*/html/vector.haddock
-
-
-HTMLS := /usr/share/doc/ghc-*/html/libraries/base-*/*.html
-HTMLS += /usr/share/doc/ghc-*/html/libraries/ghc-prim-*/*.html
-HTMLS += /usr/share/doc/ghc-*/html/libraries/haskell98-*/*.html
-HTMLS += /usr/share/doc/quickcheck-*/html/*.html
-HTMLS += /usr/share/doc/hunit-*/html/*.html
-HTMLS += /usr/share/doc/test-framework-*/html/*.html
-HTMLS += /usr/share/doc/vector-*/html/*.html
-HTMLS += /usr/share/doc/repa-*/html/*.html
-
-HSCOLOUR_SRCS := /usr/share/doc/ghc-*/html/libraries/base-*/src/*
-HSCOLOUR_SRCS += /usr/share/doc/ghc-*/html/libraries/ghc-prim-*/src/*
-HSCOLOUR_SRCS += /usr/share/doc/ghc-*/html/libraries/haskell98-*/src/*
-HSCOLOUR_SRCS += /usr/share/doc/test-framework-*/html/src/*
-HSCOLOUR_SRCS += /usr/share/doc/vector-*/html/src/*
-HSCOLOUR_SRCS += /usr/share/doc/repa-*/html/src/*.html
-
+# Neither 'haddock' nor 'hscolour' seem to work properly.
 doc: src_html
-       cp -n $(HTMLS) ./doc/html/
-       cp -n $(HSCOLOUR_SRCS) ./doc/html/src/
-       haddock $(DOCS) --html --use-unicode               \
-         --odir=doc/html/ --title="spline3"               \
-         --source-module="src/%{MODULE/.//}.html"         \
-         --source-entity="src/%{MODULE/.//}.html#%{NAME}" \
-         src/*.hs
+       runghc Setup.hs hscolour --executables
+       runghc Setup.hs haddock --internal    \
+                               --executables \
+                               --hyperlink-source
 
 SSH_USER=root@michael.orlitzky.com
 PUBLIC_DOCDIR=/var/www/orlitzky.com/michael/public/spline3/
 publish_doc: doc
-       rsync -avz -e ssh ./doc/html/ $(SSH_USER):$(PUBLIC_DOCDIR)
+       rsync -avz -e ssh               \
+       ./dist/doc/html/spline3/spline3 \
+       $(SSH_USER):$(PUBLIC_DOCDIR)
 
 hlint:
        hlint --ignore="Use camelCase"     \