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 HLINT_OPTS ?= --cross --report=dist/report.html
23 SETUP_FILE := $(wildcard Setup.*hs)
24 CABAL_FILE := $(wildcard *.cabal)
25 PKG_NAME := $(CABAL_FILE:.cabal=)
27 ifeq ($(shell ls configure.ac 2>/dev/null),configure.ac)
28 AUTOCONF_AC_FILE := configure.ac
29 AUTOCONF_FILE := configure
31 ifeq ($(shell ls configure.in 2>/dev/null),configure.in)
32 AUTOCONF_AC_FILE := configure.in
33 AUTOCONF_FILE := configure
40 BUILDINFO_IN_FILE := $(wildcard *.buildinfo.in)
41 BUILDINFO_FILE := $(BUILDINFO_IN_FILE:.in=)
45 build: setup-config build-hook
51 ifeq ($(RUN_COMMAND),)
53 @echo "cabal-package.mk: No command to run."
54 @echo "cabal-package.mk: If you want to run something, define RUN_COMMAND variable."
57 @echo ".:.:. Let's go .:.:."
61 setup-config: dist/setup-config setup-config-hook $(BUILDINFO_FILE)
65 dist/setup-config: $(CABAL_FILE) Setup $(AUTOCONF_FILE)
66 ./Setup configure $(CONFIGURE_ARGS)
68 $(AUTOCONF_FILE): $(AUTOCONF_AC_FILE)
71 $(BUILDINFO_FILE): $(BUILDINFO_IN_FILE) configure
72 ./Setup configure $(CONFIGURE_ARGS)
78 $(RM_RF) dist Setup *.o *.hi .setup-config *.buildinfo *.tix .hpc
79 $(FIND) . -name '*~' -exec rm -f {} \;
87 $(SUDO) ./Setup install
95 if ls *.tix >/dev/null 2>&1; then \
96 $(HPC) sum --output="merged.tix" --union --exclude=Main *.tix; \
97 $(HPC) markup --destdir="dist/hpc" --fun-entry-count "merged.tix"; \
101 $(DITZ) html dist/ditz
105 $(DITZ) releases | awk '{print $$1}' | sort --reverse | while read i; do \
106 $(DITZ) changelog $$i >> $@; \
112 \( -name 'dist' -or -name '.git' -or -name '_darcs' \) -prune \
114 \( -name '*.c' -or -name '*.h' -or \
115 -name '*.hs' -or -name '*.lhs' -or \
116 -name '*.hsc' -or -name '*.cabal' \) \
117 -exec egrep -i '(fixme|thinkme)' {} \+ \
118 || echo 'No FIXME or THINKME found.'
121 $(HLINT) . $(HLINT_OPTS)
123 push: push-repo push-ditz push-doc
126 if [ -d "_darcs" ]; then \
128 elif [ -d ".git" ]; then \
129 git push --all && git push --tags; \
135 www@nem.cielonegro.org:static.cielonegro.org/htdocs/ditz/$(PKG_NAME)
138 if [ -d "dist/doc" ]; then \
140 dist/doc/html/$(PKG_NAME)/ \
141 www@nem.cielonegro.org:static.cielonegro.org/htdocs/doc/$(PKG_NAME); \
144 .PHONY: build build-hook setup-config setup-config-hook run clean clean-hook \
145 install doc sdist test lint push push-repo push-ditz push-doc \