]> gitweb.michael.orlitzky.com - spline3.git/blobdiff - makefile
src/{Cube,FunctionValues}.hs: add explicit Cardinal imports.
[spline3.git] / makefile
index 236c495dc7f61abb94bd803e481972f436b1e6be..3862b333e3dbf6fd4de745e560814c56554969bf 100644 (file)
--- a/makefile
+++ b/makefile
@@ -1,48 +1,70 @@
-.PHONY : test publish_doc doc src_html hlint
+PN = spline3
+BIN = dist/build/$(PN)/$(PN)
+SRCS := $(shell find src/ -type f -name '*.hs')
 
-spline3: src/*.hs
-       runghc Setup.hs clean
-       runghc Setup.hs configure --user --flags=${FLAGS}
+BIN           = dist/build/spline3/spline3
+DOCTESTS_BIN  = dist/build/doctests/doctests
+TESTSUITE_BIN = dist/build/testsuite/testsuite
+
+.PHONY : test doc dist hlint
+
+$(BIN): $(PN).cabal $(SRCS)
+       runghc Setup.hs configure \
+                        --user \
+                        --prefix=/ \
+                        --flags=${FLAGS}
        runghc Setup.hs build
 
-llvm: src/*.hs
-       FLAGS="llvm" make
+$(DOCTESTS_BIN): $(SRCS) test/Doctests.hs
+       runghc Setup.hs configure \
+                        --user \
+                        --prefix=/ \
+                        --flags=${FLAGS} \
+                        --enable-tests
+       runghc Setup.hs build
 
-profile: src/*.hs
-       runghc Setup.hs configure --user --enable-executable-profiling
+$(TESTSUITE_BIN): $(SRCS) test/TestSuite.hs
+       runghc Setup.hs configure \
+                        --user \
+                        --prefix=/ \
+                        --flags=${FLAGS} \
+                        --enable-tests
        runghc Setup.hs build
 
-hpc: src/*.hs
-       FLAGS="hpc" make
+llvm: $(PN).cabal $(SRCS)
+       FLAGS="llvm" make
+
+profile: $(SRCS)
+       runghc Setup.hs configure \
+                        --user \
+                        --prefix=/ \
+                        --enable-executable-profiling
+       runghc Setup.hs build
 
 clean:
        runghc Setup.hs clean
-       rm -f dist/
+       rm -rf dist/
        rm -f *.prof
-       rm -rf .hpc
+       rm -f .hpc
 
-test:
-       runghc -i"src" test/TestSuite.hs
+test:  $(PN).cabal $(TESTSUITE_BIN) $(DOCTESTS_BIN) $(BIN)
+       runghc Setup.hs test
 
-src_html:
-       util/hscolour_srcs
+dist:
+       runghc Setup.hs configure --prefix=/
+       TAR_OPTIONS="--format=ustar" runghc Setup.hs sdist
 
-# Neither 'haddock' nor 'hscolour' seem to work properly.
-doc: src_html
-       runghc Setup.hs hscolour --executables
-       runghc Setup.hs haddock --internal    \
-                               --executables \
-                               --hyperlink-source
+doc: dist/doc
 
-SSH_USER=root@michael.orlitzky.com
-PUBLIC_DOCDIR=/var/www/orlitzky.com/michael/public/spline3/
-publish_doc: doc
-       rsync -avz -e ssh               \
-       ./dist/doc/html/spline3/spline3 \
-       $(SSH_USER):$(PUBLIC_DOCDIR)
+dist/doc: $(PN).cabal $(SRCS)
+       runghc Setup.hs configure --user --prefix=/ --flags=${FLAGS}
+       runghc Setup.hs hscolour --all
+       runghc Setup.hs haddock --all \
+                                --hyperlink-source \
+                                --haddock-options="--ignore-all-exports"
 
 hlint:
        hlint --ignore="Use camelCase"     \
-             --ignore="Redundant bracket" \
-             --color                      \
-             src
+              --ignore="Redundant bracket" \
+              --color                     \
+              src