]> gitweb @ CieloNegro.org - blackboard-dns.git/blob - cabal-package.mk
Initial revision of the Blackboard DDNS.
[blackboard-dns.git] / cabal-package.mk
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
16 SETUP_FILE ?= $(wildcard Setup.*hs)
17 CABAL_FILE ?= $(wildcard *.cabal)
18
19 CONFIGURE_ARGS := --disable-optimization
20
21 build: dist/setup-config Setup
22         ./Setup build
23
24 ifeq ($(RUN_COMMAND),)
25 run:
26         @echo "cabal-package.mk: No command to run."
27         @echo "cabal-package.mk: If you want to run something, define RUN_COMMAND variable."
28 else
29 run: build
30         @echo ".:.:. Let's go .:.:."
31         $(RUN_COMMAND)
32 endif
33
34 dist/setup-config: $(CABAL_FILE) Setup
35         ./Setup configure $(CONFIGURE_ARGS)
36
37 Setup: $(SETUP_FILE)
38         $(GHC) --make Setup
39
40 clean:
41         $(RM_RF) dist Setup *.o *.hi .setup-config *.buildinfo
42         $(FIND) . -name '*~' -exec rm -f {} \;
43
44 doc: dist/setup-config Setup
45         ./Setup haddock
46
47 install: build
48         $(SUDO) ./Setup install
49
50 sdist: Setup
51         ./Setup sdist
52
53 test: build
54         ./Setup test
55
56 .PHONY: build run clean install doc sdist test