Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 168 lines (136 sloc) 4.074 kb
f40cdbc @phonohawk Fixed some minor problems in the previous patch.
authored
1 # -*- makefile-gmake -*-
2 #
3 # Variables:
4 #
5 # CONFIGURE_ARGS :: arguments to be passed to ./Setup configure
6 # default: --disable-optimization
7 #
8 # RUN_COMMAND :: command to be run for "make run"
9 #
10
11 GHC ?= ghc
12 FIND ?= find
13 RM_RF ?= rm -rf
14 SUDO ?= sudo
15 AUTOCONF ?= autoconf
959f97a @phonohawk Bump version to 0.10.1
authored
16 HLINT ?= hlint
17 HPC ?= hpc
18 DITZ ?= ditz
f40cdbc @phonohawk Fixed some minor problems in the previous patch.
authored
19
20 CONFIGURE_ARGS ?= --disable-optimization
6fe2832 @phonohawk Upstream update of cabal-package.mk
authored
21 HADDOCK_OPTS ?= --hyperlink-source
22 HLINT_OPTS ?= \
23 --hint=Default --hint=Dollar --hint=Generalise \
24 --cross \
25 --ignore="Parse error" \
26 --report=dist/report.html
f40cdbc @phonohawk Fixed some minor problems in the previous patch.
authored
27
28 SETUP_FILE := $(wildcard Setup.*hs)
29 CABAL_FILE := $(wildcard *.cabal)
959f97a @phonohawk Bump version to 0.10.1
authored
30 PKG_NAME := $(CABAL_FILE:.cabal=)
f40cdbc @phonohawk Fixed some minor problems in the previous patch.
authored
31
32 ifeq ($(shell ls configure.ac 2>/dev/null),configure.ac)
33 AUTOCONF_AC_FILE := configure.ac
34 AUTOCONF_FILE := configure
35 else
36 ifeq ($(shell ls configure.in 2>/dev/null),configure.in)
37 AUTOCONF_AC_FILE := configure.in
38 AUTOCONF_FILE := configure
39 else
40 AUTOCONF_AC_FILE :=
41 AUTOCONF_FILE :=
42 endif
43 endif
44
45 BUILDINFO_IN_FILE := $(wildcard *.buildinfo.in)
46 BUILDINFO_FILE := $(BUILDINFO_IN_FILE:.in=)
47
48 all: build
49
50 build: setup-config build-hook
51 ./Setup build
959f97a @phonohawk Bump version to 0.10.1
authored
52 $(RM_RF) *.tix
f40cdbc @phonohawk Fixed some minor problems in the previous patch.
authored
53
54 build-hook:
55
56 ifeq ($(RUN_COMMAND),)
57 run:
58 @echo "cabal-package.mk: No command to run."
59 @echo "cabal-package.mk: If you want to run something, define RUN_COMMAND variable."
60 else
61 run: build
62 @echo ".:.:. Let's go .:.:."
63 $(RUN_COMMAND)
64 endif
65
66 setup-config: dist/setup-config setup-config-hook $(BUILDINFO_FILE)
67
68 setup-config-hook:
69
70 dist/setup-config: $(CABAL_FILE) Setup $(AUTOCONF_FILE)
71 ./Setup configure $(CONFIGURE_ARGS)
72
73 $(AUTOCONF_FILE): $(AUTOCONF_AC_FILE)
74 $(AUTOCONF)
75
76 $(BUILDINFO_FILE): $(BUILDINFO_IN_FILE) configure
77 ./Setup configure $(CONFIGURE_ARGS)
78
79 Setup: $(SETUP_FILE)
80 $(GHC) --make Setup
81
6fe2832 @phonohawk Upstream update of cabal-package.mk
authored
82 reconfigure:
83 rm -f dist/setup-config
84 $(MAKE) setup-config
85
f40cdbc @phonohawk Fixed some minor problems in the previous patch.
authored
86 clean: clean-hook
959f97a @phonohawk Bump version to 0.10.1
authored
87 $(RM_RF) dist Setup *.o *.hi .setup-config *.buildinfo *.tix .hpc
f40cdbc @phonohawk Fixed some minor problems in the previous patch.
authored
88 $(FIND) . -name '*~' -exec rm -f {} \;
89
90 clean-hook:
91
92 doc: setup-config
6fe2832 @phonohawk Upstream update of cabal-package.mk
authored
93 ./Setup haddock $(HADDOCK_OPTS)
f40cdbc @phonohawk Fixed some minor problems in the previous patch.
authored
94
95 install: build
96 $(SUDO) ./Setup install
97
98 sdist: setup-config
99 ./Setup sdist
100
101 test: build
959f97a @phonohawk Bump version to 0.10.1
authored
102 $(RM_RF) dist/test
f40cdbc @phonohawk Fixed some minor problems in the previous patch.
authored
103 ./Setup test
959f97a @phonohawk Bump version to 0.10.1
authored
104 if ls *.tix >/dev/null 2>&1; then \
105 $(HPC) sum --output="merged.tix" --union --exclude=Main *.tix; \
106 $(HPC) markup --destdir="dist/hpc" --fun-entry-count "merged.tix"; \
107 fi
108
6fe2832 @phonohawk Upstream update of cabal-package.mk
authored
109 # -- Find FIXME Tags ----------------------------------------------------------
959f97a @phonohawk Bump version to 0.10.1
authored
110 fixme:
111 @$(FIND) . \
112 \( -name 'dist' -or -name '.git' -or -name '_darcs' \) -prune \
113 -or \
114 \( -name '*.c' -or -name '*.h' -or \
115 -name '*.hs' -or -name '*.lhs' -or \
116 -name '*.hsc' -or -name '*.cabal' \) \
6fe2832 @phonohawk Upstream update of cabal-package.mk
authored
117 -exec egrep 'FIXME|THINKME|TODO' {} \+ \
118 || echo 'No FIXME, THINKME, nor TODO found.'
959f97a @phonohawk Bump version to 0.10.1
authored
119
6fe2832 @phonohawk Upstream update of cabal-package.mk
authored
120 # -- HLint --------------------------------------------------------------------
121 HLINT_TARGETS ?= $$(find -E . -type d -name dist -prune -o -regex '.*\.(hsc?|lhs)' -print)
959f97a @phonohawk Bump version to 0.10.1
authored
122 lint:
6fe2832 @phonohawk Upstream update of cabal-package.mk
authored
123 $(HLINT) $(HLINT_TARGETS) $(HLINT_OPTS)
124
125 # -- Ditz the Distributed Issue Tracker ---------------------------------------
126 ifeq (,$(wildcard .ditz-config))
127 ditz:
128 else
129 ditz:
130 $(DITZ) html dist/ditz
131
132 ChangeLog:
133 rm -f $@
134 $(DITZ) releases | awk '{print $$1}' | sort --reverse | while read i; do \
135 $(DITZ) changelog $$i >> $@; \
136 done
137 head $@
138 endif
139
140 # -- Pushing to remote hosts --------------------------------------------------
141 push: push-repo push-ditz push-doc
959f97a @phonohawk Bump version to 0.10.1
authored
142
6fe2832 @phonohawk Upstream update of cabal-package.mk
authored
143 push-repo:
959f97a @phonohawk Bump version to 0.10.1
authored
144 if [ -d "_darcs" ]; then \
145 darcs push; \
146 elif [ -d ".git" ]; then \
147 git push --all && git push --tags; \
148 fi
6fe2832 @phonohawk Upstream update of cabal-package.mk
authored
149
150 push-ditz: ditz
151 if [ -d "dist/ditz" ]; then \
152 rsync -av --delete \
153 dist/ditz/ \
154 www@nem.cielonegro.org:static.cielonegro.org/htdocs/ditz/$(PKG_NAME); \
155 fi
156
157 push-doc: doc
959f97a @phonohawk Bump version to 0.10.1
authored
158 if [ -d "dist/doc" ]; then \
159 rsync -av --delete \
160 dist/doc/html/$(PKG_NAME)/ \
161 www@nem.cielonegro.org:static.cielonegro.org/htdocs/doc/$(PKG_NAME); \
162 fi
163
6fe2832 @phonohawk Upstream update of cabal-package.mk
authored
164 # -- Phony Targets ------------------------------------------------------------
165 .PHONY: build build-hook setup-config setup-config-hook run clean clean-hook \
166 install doc sdist test lint push push-repo push-ditz push-doc \
167 ChangeLog
Something went wrong with that request. Please try again.