Makefile 3.43 KB
Newer Older
1

Duncan Coutts's avatar
Duncan Coutts committed
2
VERSION=1.11.2
3

Duncan Coutts's avatar
Duncan Coutts committed
4
5
#KIND=devel
KIND=rc
6
#KIND=cabal-latest
7

8
9
PREFIX=/usr/local
HC=ghc
Duncan Coutts's avatar
Duncan Coutts committed
10
GHCFLAGS=-Wall
11

12
all: build
13
14
15

# build the library itself

16
SOURCES=Distribution/*.hs Distribution/Simple/*.hs Distribution/PackageDescription/*.hs Distribution/Simple/GHC/*.hs Distribution/Simple/Build/*.hs Distribution/Compat/*.hs Distribution/Simple/Program/*.hs
17
18
19
20
21
22
23
24
25
26
CONFIG_STAMP=dist/setup-config
BUILD_STAMP=dist/build/libHSCabal-$(VERSION).a
HADDOCK_STAMP=dist/doc/html/Cabal/index.html
USERGUIDE_STAMP=dist/doc/users-guide/index.html
SDIST_STAMP=dist/Cabal-$(VERSION).tar.gz
DISTLOC=dist/release
DIST_STAMP=$(DISTLOC)/Cabal-$(VERSION).tar.gz

COMMA=,

27
setup: $(SOURCES) Setup.hs
28
	-mkdir -p dist/setup
29
	$(HC) $(GHCFLAGS) --make -i. -odir dist/setup -hidir dist/setup Setup.hs -o setup
30
31
32
33

Setup-nhc:
	hmake -nhc98 -package base -prelude Setup

34
35
$(CONFIG_STAMP): setup Cabal.cabal
	./setup configure --with-compiler=$(HC) --prefix=$(PREFIX)
36

37
38
build: $(BUILD_STAMP)
$(BUILD_STAMP): $(CONFIG_STAMP) $(SOURCES)
39
	./setup build
40

41
42
install: $(BUILD_STAMP)
	./setup install
43
44
45
46
47
48
49
50
51
52
53
54
55
56

hugsbootstrap:
	rm -rf dist/tmp dist/hugs
	mkdir -p dist/tmp
	mkdir dist/hugs
	cp -r Distribution dist/tmp
	hugs-package dist/tmp dist/hugs
	cp Setup.lhs Cabal.cabal dist/hugs

hugsinstall: hugsbootstrap
	cd dist/hugs && ./Setup.lhs configure --hugs
	cd dist/hugs && ./Setup.lhs build
	cd dist/hugs && ./Setup.lhs install

57
58
59
# documentation...

haddock: $(HADDOCK_STAMP)
60
$(HADDOCK_STAMP) : $(CONFIG_STAMP) $(BUILD_STAMP)
61
62
	./setup haddock

63
64
65
66
67
PANDOC=pandoc
PANDOC_OPTIONS= \
	--standalone \
	--smart \
	--css=$(PANDOC_HTML_CSS)
68
PANDOC_HTML_OUTDIR=dist/doc/users-guide
69
PANDOC_HTML_CSS=Cabal.css
70

71
72
73
74
users-guide: $(USERGUIDE_STAMP) doc/*.markdown
$(USERGUIDE_STAMP): doc/*.markdown
	mkdir -p $(PANDOC_HTML_OUTDIR)
	for file in $^; do $(PANDOC) $(PANDOC_OPTIONS) --from=markdown --to=html --output $(PANDOC_HTML_OUTDIR)/$$(basename $${file} .markdown).html $${file}; done
75
	cp doc/$(PANDOC_HTML_CSS) $(PANDOC_HTML_OUTDIR)
76
77
78
79
80
81

docs: haddock users-guide

clean:
	rm -rf dist/
	rm -f setup
82
83
84

# testing...

85
86
87
88
moduleTest: tests/ModuleTest.hs tests/PackageDescriptionTests.hs
	mkdir -p dist/test
	$(HC) --make -Wall -DDEBUG -odir dist/test -hidir dist/test \
		-itests tests/ModuleTest.hs -o moduleTest
89

90
91
92
93
94
#tests: moduleTest clean
#	cd tests/A && $(MAKE) clean
#	cd tests/HUnit-1.0 && $(MAKE) clean
#	cd tests/A && $(MAKE)
#	cd tests/HUnit-1.0 && $(MAKE)
95

96
97
98
99
#check:
#	rm -f moduleTest
#	$(MAKE) moduleTest
#	./moduleTest
100
101
102

# distribution...

103
104
105
106
107
108
109
110
111
112
113
$(SDIST_STAMP) : $(BUILD_STAMP)
	./setup sdist

dist: $(DIST_STAMP)
$(DIST_STAMP) : $(HADDOCK_STAMP) $(USERGUIDE_STAMP) $(SDIST_STAMP)
	rm -rf $(DISTLOC)
	mkdir $(DISTLOC)
	tar -xzf $(SDIST_STAMP) -C $(DISTLOC)/
	mkdir $(DISTLOC)/Cabal-$(VERSION)/doc
	cp -r dist/doc/html $(DISTLOC)/Cabal-$(VERSION)/doc/API
	cp -r dist/doc/users-guide $(DISTLOC)/Cabal-$(VERSION)/doc/
Duncan Coutts's avatar
Duncan Coutts committed
114
	cp changelog $(DISTLOC)/Cabal-$(VERSION)/
115
116
117
118
119
120
121
122
	tar -C $(DISTLOC) -c Cabal-$(VERSION) -zf $(DISTLOC)/Cabal-$(VERSION).tar.gz
	mv $(DISTLOC)/Cabal-$(VERSION)/doc $(DISTLOC)/
	mv $(DISTLOC)/Cabal-$(VERSION)/changelog $(DISTLOC)/
	rm -r $(DISTLOC)/Cabal-$(VERSION)/
	@echo "Cabal tarball built: $(DIST_STAMP)"
	@echo "Release fileset prepared: $(DISTLOC)/"

release: $(DIST_STAMP)
123
124
	scp -r $(DISTLOC) haskell.org:/srv/web/haskell.org/cabal/release/cabal-$(VERSION)
	ssh haskell.org 'cd /srv/web/haskell.org/cabal/release && rm -f $(KIND) && ln -s cabal-$(VERSION) $(KIND)'
125
126

# tags...
127

128
129
TAGSSRCDIRS = Distribution Language
tags TAGS: $(SOURCES)
130
	find $(TAGSSRCDIRS) -name \*.\*hs | xargs hasktags