Makefile 3.5 KB
Newer Older
1

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

4
5
KIND=devel
#KIND=rc
6
7
#KIND=latest

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
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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=,
VERSION_VALUE=$(subst .,$(COMMA),$(VERSION))

setup: $(SOURCES)
	-mkdir -p dist/setup
	$(HC) $(GHCFLAGS) --make -DCABAL_VERSION=$(VERSION_VALUE) -i. -odir dist/setup -hidir dist/setup Setup.hs -o setup
31
32
33
34

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

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

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

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

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

58
59
60
61
# documentation...

haddock: $(HADDOCK_STAMP)
$(HADDOCK_STAMP) : $(CONFIG_STAMP)
62
63
	./setup haddock

64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
XSLTPROC=xsltproc
XSLTPROC_HTML_OUTDIR=dist/doc/users-guide/
XSLTPROC_HTML_CSS=doc/fptools.css
XSLTPROC_HTML_PARAMS=\
	--param use.id.as.filename 1 \
	--param toc.section.depth 3 \
	--stringparam base.dir $(XSLTPROC_HTML_OUTDIR) \
	--stringparam html.stylesheet $(XSLTPROC_HTML_CSS)
XSLTPROC_HTML_STYLESHEET=/usr/share/sgml/docbook/xsl-stylesheets-1.70.1/xhtml/chunk.xsl

users-guide: $(USERGUIDE_STAMP)
$(USERGUIDE_STAMP) : doc/Cabal.xml
	$(XSLTPROC) $(XSLTPROC_HTML_PARAMS) $(XSLTPROC_HTML_STYLESHEET) $<
	cp $(XSLTPROC_HTML_CSS) $(XSLTPROC_HTML_OUTDIR)

docs: haddock users-guide

clean:
	rm -rf dist/
	rm -f setup
84
85
86

# testing...

87
88
89
90
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
91

92
93
94
95
96
#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)
97

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

# distribution...

105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
$(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/
	cp releaseNotes changelog $(DISTLOC)/Cabal-$(VERSION)/
	tar -C $(DISTLOC) -c Cabal-$(VERSION) -zf $(DISTLOC)/Cabal-$(VERSION).tar.gz
	mv $(DISTLOC)/Cabal-$(VERSION)/doc $(DISTLOC)/
	mv $(DISTLOC)/Cabal-$(VERSION)/releaseNotes $(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)
	scp -r $(DISTLOC) www.haskell.org:/home/haskell/cabal/release/cabal-$(VERSION)
	ssh www.haskell.org 'cd /home/haskell/cabal/release && rm -f $(KIND) && ln -s cabal-$(VERSION) $(KIND)'

# tags...
130

131
132
TAGSSRCDIRS = Distribution Language
tags TAGS: $(SOURCES)
133
	find $(TAGSSRCDIRS) -name \*.\*hs | xargs hasktags