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 $(DITZ) releases | awk '{print $$1}' | sort --reverse | while read i; do \
105 $(DITZ) changelog $$i >> $@; \
111 \( -name 'dist' -or -name '.git' -or -name '_darcs' \) -prune \
113 \( -name '*.c' -or -name '*.h' -or \
114 -name '*.hs' -or -name '*.lhs' -or \
115 -name '*.hsc' -or -name '*.cabal' \) \
116 -exec egrep -i '(fixme|thinkme)' {} \+ \
117 || echo 'No FIXME or THINKME found.'
120 $(HLINT) . --cross --report
122 push: push-repo push-ditz push-doc
125 if [ -d "_darcs" ]; then \
127 elif [ -d ".git" ]; then \
128 git push --all && git push --tags; \
134 www@nem.cielonegro.org:static.cielonegro.org/htdocs/ditz/$(PKG_NAME)
137 if [ -d "dist/doc" ]; then \
139 dist/doc/html/$(PKG_NAME)/ \
140 www@nem.cielonegro.org:static.cielonegro.org/htdocs/doc/$(PKG_NAME); \
143 .PHONY: build build-hook setup-config setup-config-hook run clean clean-hook \
144 install doc sdist test lint push push-repo push-ditz push-doc \