1 # -*- makefile-gmake -*-
5 # CONFIGURE_ARGS :: arguments to be passed to ./Setup configure
6 # default: --disable-optimization
8 # RUN_COMMAND :: command to be run for "make run"
20 CONFIGURE_ARGS ?= --disable-optimization
21 HADDOCK_OPTS ?= --hyperlink-source
22 HLINT_OPTS ?= --cross --report=dist/report.html
24 SETUP_FILE := $(wildcard Setup.*hs)
25 CABAL_FILE := $(wildcard *.cabal)
26 PKG_NAME := $(CABAL_FILE:.cabal=)
28 ifeq ($(shell ls configure.ac 2>/dev/null),configure.ac)
29 AUTOCONF_AC_FILE := configure.ac
30 AUTOCONF_FILE := configure
32 ifeq ($(shell ls configure.in 2>/dev/null),configure.in)
33 AUTOCONF_AC_FILE := configure.in
34 AUTOCONF_FILE := configure
41 BUILDINFO_IN_FILE := $(wildcard *.buildinfo.in)
42 BUILDINFO_FILE := $(BUILDINFO_IN_FILE:.in=)
46 build: setup-config build-hook
52 ifeq ($(RUN_COMMAND),)
54 @echo "cabal-package.mk: No command to run."
55 @echo "cabal-package.mk: If you want to run something, define RUN_COMMAND variable."
58 @echo ".:.:. Let's go .:.:."
62 setup-config: dist/setup-config setup-config-hook $(BUILDINFO_FILE)
66 dist/setup-config: $(CABAL_FILE) Setup $(AUTOCONF_FILE)
67 ./Setup configure $(CONFIGURE_ARGS)
69 $(AUTOCONF_FILE): $(AUTOCONF_AC_FILE)
72 $(BUILDINFO_FILE): $(BUILDINFO_IN_FILE) configure
73 ./Setup configure $(CONFIGURE_ARGS)
79 $(RM_RF) dist Setup *.o *.hi .setup-config *.buildinfo *.tix .hpc
80 $(FIND) . -name '*~' -exec rm -f {} \;
85 ./Setup haddock $(HADDOCK_OPTS)
88 $(SUDO) ./Setup install
96 if ls *.tix >/dev/null 2>&1; then \
97 $(HPC) sum --output="merged.tix" --union --exclude=Main *.tix; \
98 $(HPC) markup --destdir="dist/hpc" --fun-entry-count "merged.tix"; \
102 $(DITZ) html dist/ditz
106 $(DITZ) releases | awk '{print $$1}' | sort --reverse | while read i; do \
107 $(DITZ) changelog $$i >> $@; \
113 \( -name 'dist' -or -name '.git' -or -name '_darcs' \) -prune \
115 \( -name '*.c' -or -name '*.h' -or \
116 -name '*.hs' -or -name '*.lhs' -or \
117 -name '*.hsc' -or -name '*.cabal' \) \
118 -exec egrep 'FIXME|THINKME|TODO' {} \+ \
119 || echo 'No FIXME or THINKME found.'
122 $(HLINT) . $(HLINT_OPTS)
124 push: push-repo push-ditz push-doc
127 if [ -d "_darcs" ]; then \
129 elif [ -d ".git" ]; then \
130 git push --all && git push --tags; \
136 www@nem.cielonegro.org:static.cielonegro.org/htdocs/ditz/$(PKG_NAME)
139 if [ -d "dist/doc" ]; then \
141 dist/doc/html/$(PKG_NAME)/ \
142 www@nem.cielonegro.org:static.cielonegro.org/htdocs/doc/$(PKG_NAME); \
145 .PHONY: build build-hook setup-config setup-config-hook run clean clean-hook \
146 install doc sdist test lint push push-repo push-ditz push-doc \