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)
24 PKG_NAME := $(CABAL_FILE:.cabal=)
26 ifeq ($(shell ls configure.ac 2>/dev/null),configure.ac)
27 AUTOCONF_AC_FILE := configure.ac
28 AUTOCONF_FILE := configure
30 ifeq ($(shell ls configure.in 2>/dev/null),configure.in)
31 AUTOCONF_AC_FILE := configure.in
32 AUTOCONF_FILE := configure
39 BUILDINFO_IN_FILE := $(wildcard *.buildinfo.in)
40 BUILDINFO_FILE := $(BUILDINFO_IN_FILE:.in=)
44 build: setup-config build-hook
50 ifeq ($(RUN_COMMAND),)
52 @echo "cabal-package.mk: No command to run."
53 @echo "cabal-package.mk: If you want to run something, define RUN_COMMAND variable."
56 @echo ".:.:. Let's go .:.:."
60 setup-config: dist/setup-config setup-config-hook $(BUILDINFO_FILE)
64 dist/setup-config: $(CABAL_FILE) Setup $(AUTOCONF_FILE)
65 ./Setup configure $(CONFIGURE_ARGS)
67 $(AUTOCONF_FILE): $(AUTOCONF_AC_FILE)
70 $(BUILDINFO_FILE): $(BUILDINFO_IN_FILE) configure
71 ./Setup configure $(CONFIGURE_ARGS)
77 $(RM_RF) dist Setup *.o *.hi .setup-config *.buildinfo *.tix .hpc
78 $(FIND) . -name '*~' -exec rm -f {} \;
86 $(SUDO) ./Setup install
94 if ls *.tix >/dev/null 2>&1; then \
95 $(HPC) sum --output="merged.tix" --union --exclude=Main *.tix; \
96 $(HPC) markup --destdir="dist/hpc" --fun-entry-count "merged.tix"; \
100 $(DITZ) html dist/ditz
104 \( -name 'dist' -or -name '.git' -or -name '_darcs' \) -prune \
106 \( -name '*.c' -or -name '*.h' -or \
107 -name '*.hs' -or -name '*.lhs' -or \
108 -name '*.hsc' -or -name '*.cabal' \) \
109 -exec egrep -i '(fixme|thinkme)' {} \+ \
110 || echo 'No FIXME or THINKME found.'
116 if [ -d "_darcs" ]; then \
118 elif [ -d ".git" ]; then \
119 git push --all && git push --tags; \
121 if [ -d "dist/doc" ]; then \
123 dist/doc/html/$(PKG_NAME)/ \
124 www@nem.cielonegro.org:static.cielonegro.org/htdocs/doc/$(PKG_NAME); \
128 www@nem.cielonegro.org:static.cielonegro.org/htdocs/ditz/$(PKG_NAME)
130 .PHONY: build build-hook setup-config setup-config-hook run clean clean-hook install doc sdist test lint push