Last active
April 16, 2016 15:51
-
-
Save mietek/23c577f4e47b82e8c3f4 to your computer and use it in GitHub Desktop.
Example Makefile for a Haskell project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: test | |
ci: depclean test doc | |
PKG_DESCRIPTION = example.cabal | |
DEP = .cabal-sandbox | |
CONFIGURE = dist/setup-config | |
ifndef PREFIX | |
PREFIX = /usr/local | |
endif | |
.PHONY: ci install dep configure build test run doc clean depclean | |
install: | |
cabal install \ | |
--enable-documentation \ | |
--enable-tests \ | |
--global \ | |
--ignore-sandbox \ | |
--haddock-hyperlink-source \ | |
--prefix=$(PREFIX) \ | |
--reorder-goals \ | |
--run-tests | |
$(DEP): $(PKG_DESCRIPTION) | |
[ -e $(DEP) ] || ( \ | |
cabal sandbox init && \ | |
cabal install alex cpphs happy hscolour ) | |
cabal install \ | |
--dependencies-only \ | |
--enable-documentation \ | |
--enable-tests \ | |
--haddock-hyperlink-source \ | |
--reorder-goals | |
dep: $(DEP) | |
$(CONFIGURE): $(DEP) | |
cabal configure --enable-tests | |
configure: $(CONFIGURE) | |
build: $(CONFIGURE) | |
cabal build | |
test: $(CONFIGURE) | |
cabal test --show-details=streaming | |
run: $(CONFIGURE) | |
cabal run | |
doc: $(CONFIGURE) | |
cabal haddock --hyperlink-source | |
clean: | |
rm -rf dist | |
depclean: | |
rm -rf .cabal-sandbox cabal.sandbox.config dist |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment