]> gitweb.michael.orlitzky.com - spline3.git/blobdiff - makefile
src/{Cube,FunctionValues}.hs: add explicit Cardinal imports.
[spline3.git] / makefile
index dc1c3642e1ae0a40d8e28fdf4dc1ee13433fef7a..3862b333e3dbf6fd4de745e560814c56554969bf 100644 (file)
--- a/makefile
+++ b/makefile
@@ -1,55 +1,70 @@
-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
+PN = spline3
+BIN = dist/build/$(PN)/$(PN)
+SRCS := $(shell find src/ -type f -name '*.hs')
 
-BIN := spline3
+BIN           = dist/build/spline3/spline3
+DOCTESTS_BIN  = dist/build/doctests/doctests
+TESTSUITE_BIN = dist/build/testsuite/testsuite
 
-.PHONY : test doc src_html hlint
+.PHONY : test doc dist hlint
 
-$(BIN): src/*.hs
-       ghc -O2 $(GHC_WARNINGS) --make -o bin/${BIN} src/*.hs
+$(BIN): $(PN).cabal $(SRCS)
+       runghc Setup.hs configure \
+                        --user \
+                        --prefix=/ \
+                        --flags=${FLAGS}
+       runghc Setup.hs build
 
-all: $(BIN) test_src
+$(DOCTESTS_BIN): $(SRCS) test/Doctests.hs
+       runghc Setup.hs configure \
+                        --user \
+                        --prefix=/ \
+                        --flags=${FLAGS} \
+                        --enable-tests
+       runghc Setup.hs build
 
-test_src: src/Tests/*.hs
-       ghc -O2 $(GHC_WARNINGS) --make -o bin/${BIN} src/*.hs src/Tests/*.hs
+$(TESTSUITE_BIN): $(SRCS) test/TestSuite.hs
+       runghc Setup.hs configure \
+                        --user \
+                        --prefix=/ \
+                        --flags=${FLAGS} \
+                        --enable-tests
+       runghc Setup.hs build
 
-profile: src/*.hs
-       ghc -O2 $(GHC_WARNINGS) -prof -auto-all --make -o bin/$(BIN) src/*.hs
+llvm: $(PN).cabal $(SRCS)
+       FLAGS="llvm" make
+
+profile: $(SRCS)
+       runghc Setup.hs configure \
+                        --user \
+                        --prefix=/ \
+                        --enable-executable-profiling
+       runghc Setup.hs build
 
 clean:
-       rm -f bin/$(BIN)
-       rm -f src/*.hi
-       rm -f src/*.o
-       rm -f src/Tests/*.hi
-       rm -f src/Tests/*.o
+       runghc Setup.hs clean
+       rm -rf dist/
        rm -f *.prof
-       rm -rf doc/html/*
-
-test:
-       runghc -i"src" test/TestSuite.hs
-
+       rm -f .hpc
 
-src_html:
-       util/hscolour_srcs
+test:  $(PN).cabal $(TESTSUITE_BIN) $(DOCTESTS_BIN) $(BIN)
+       runghc Setup.hs test
 
+dist:
+       runghc Setup.hs configure --prefix=/
+       TAR_OPTIONS="--format=ustar" runghc Setup.hs sdist
 
-DOCS := -i /usr/share/doc/ghc-6.12.3/html/libraries/base-4.2.0.2/base.haddock
-DOCS += -i /usr/share/doc/storable-complex-0.2.1/html/storable-complex.haddock
-DOCS += -i /usr/share/doc/hmatrix-0.10.0.1/html/hmatrix.haddock
+doc: dist/doc
 
-doc: src_html
-       haddock $(DOCS) --html --use-unicode               \
-         --odir=doc/html/ --title="spline3"               \
-         --source-module="src/%{MODULE/.//}.html"         \
-         --source-entity="src/%{MODULE/.//}.html#%{NAME}" \
-         src/*.hs src/Tests/*.hs
+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