Skip to content

Instantly share code, notes, and snippets.

@Happy-Ferret
Forked from mietek/Makefile
Created January 28, 2016 10:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Happy-Ferret/916e33d50a2196de81e4 to your computer and use it in GitHub Desktop.
Save Happy-Ferret/916e33d50a2196de81e4 to your computer and use it in GitHub Desktop.
Example Makefile for a Haskell project
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