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
22 SETUP_FILE := $(wildcard Setup.*hs)
23 CABAL_FILE := $(wildcard *.cabal)
25 ifeq ($(shell ls configure.ac 2>/dev/null),configure.ac)
26 AUTOCONF_AC_FILE := configure.ac
27 AUTOCONF_FILE := configure
29 ifeq ($(shell ls configure.in 2>/dev/null),configure.in)
30 AUTOCONF_AC_FILE := configure.in
31 AUTOCONF_FILE := configure
38 BUILDINFO_IN_FILE := $(wildcard *.buildinfo.in)
39 BUILDINFO_FILE := $(BUILDINFO_IN_FILE:.in=)
43 build: setup-config build-hook
49 ifeq ($(RUN_COMMAND),)
51 @echo "cabal-package.mk: No command to run."
52 @echo "cabal-package.mk: If you want to run something, define RUN_COMMAND variable."
55 @echo ".:.:. Let's go .:.:."
59 setup-config: dist/setup-config setup-config-hook $(BUILDINFO_FILE)
63 dist/setup-config: $(CABAL_FILE) Setup $(AUTOCONF_FILE)
64 ./Setup configure $(CONFIGURE_ARGS)
66 $(AUTOCONF_FILE): $(AUTOCONF_AC_FILE)
69 $(BUILDINFO_FILE): $(BUILDINFO_IN_FILE) configure
70 ./Setup configure $(CONFIGURE_ARGS)
76 $(RM_RF) dist Setup *.o *.hi .setup-config *.buildinfo *.tix .hpc
77 $(FIND) . -name '*~' -exec rm -f {} \;
85 $(SUDO) ./Setup install
93 if ls *.tix >/dev/null 2>&1; then \
94 $(HPC) sum --output="merged.tix" --union --exclude=Main *.tix; \
95 $(HPC) markup --destdir="dist/hpc" --fun-entry-count "merged.tix"; \
99 $(DITZ) html dist/ditz
103 \( -name 'dist' -or -name '.git' -or -name '_darcs' \) -prune \
105 \( -name '*.c' -or -name '*.h' -or \
106 -name '*.hs' -or -name '*.lhs' -or \
107 -name '*.hsc' -or -name '*.cabal' \) \
108 -exec egrep -i '(fixme|thinkme)' {} \+ \
109 || echo 'No FIXME or THINKME found.'
113 # $(HLINT) . --report \
114 # --ignore="Use string literal" \
115 # --ignore="Use concatMap"
117 .PHONY: build build-hook setup-config setup-config-hook run clean clean-hook install doc sdist test lint