GHCIFLAGS = -XForeignFunctionInterface -lxfconf-0 -idist/build/ PROFDIR = Prof ### Artificial Makefile dependencies tree ############################# DISTDIR = ./dist SOURCES = $(wildcard System/XFCE/Xfconf/*.chs Tests/*.hs) BUILDDIR = $(DISTDIR)/build _MYBIN = $(BUILDDIR)/tests/tests $(BUILDDIR)/testGlib/testGlib _MYDOC = $(DISTDIR)/doc/html/xfconf/index.html ### Cabal frontend #################################################### all: build configure: | $(DISTDIR) $(DISTDIR): xfconf.cabal cabal configure -f "buildTests" --ghc-options="-prof -rtsopts=all" build: $(_MYBIN) $(_MYBIN): $(SOURCES) | configure cabal build .PHONY: clean clean: cabal clean rm -fr $(PROFDIR) docs doc: $(_MYDOC) $(_MYDOC): $(SOURCES) | configure cabal haddock .PHONY: doc_view doc_view: $(_MYDOC) xdg-open $^ ### Debug helpers ##################################################### .PHONY: debug debug: build ghci $(GHCIFLAGS) System/XFCE/Xfconf.hs; .PHONY: debugTest debugTest: build ghci $(GHCIFLAGS) Tests/Tests.hs; .PHONY: debugGlib debugGlib: build ghci $(GHCIFLAGS) Tests/TestGlib.hs; .PHONY: debugDemo debugDemo: build ghci $(GHCIFLAGS) Demo/Demo.hs; ### Launch pre-configured tests ####################################### .PHONY: watch watch: watch xfconf-query -c quickcheck -vl .PHONY: tests test tests test: $(_MYBIN) $(BUILDDIR)/tests/tests --maximum-generated-tests=500 -j3 .PHONY: testGlib testGlib: $(_MYBIN) $(BUILDDIR)/testGlib/testGlib .PHONY: demo demo: build runghc Demo/Demo.hs ### Profiling ######################################################### Prof/tests.prof: rm -fr $(PROFDIR) && mkdir -p $(PROFDIR) ( cd $(PROFDIR)\ ; ../$(BUILDDIR)/tests/tests --maximum-generated-tests=500 -j3 +RTS -p -hc -sstderr\ ; hp2ps -c tests.hp ) profiling: Prof/tests.prof ( cd $(PROFDIR)\ ; xdg-open tests.ps 2>&1 1>/dev/null\ ; less tests.prof )