Makefile 3.67 KB
Newer Older
1

2
VERSION=1.7.2
3

Duncan Coutts's avatar
Duncan Coutts committed
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 Distribution/Simple/GHC/*.hs Distribution/Simple/Build/*.hs Distribution/Compat/*.hs
17
18
19
20
21
22
23
24
25
26
27
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))

28
setup: $(SOURCES) Setup.hs
29
30
	-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
# documentation...

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

64
65
66
XMLLINT=xmllint
XMLLINT_OPTIONS=--nonet --noout --valid

67
68
XSLTPROC=xsltproc
XSLTPROC_HTML_OUTDIR=dist/doc/users-guide/
69
XSLTPROC_HTML_CSS=Cabal.css
70
71
72
73
74
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)
SamB's avatar
SamB committed
75
XSLTPROC_HTML_STYLESHEET=http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl
76
XSLTPROC_OPTIONS=--nonet $(XSLTPROC_HTML_PARAMS) $(XSLTPROC_HTML_STYLESHEET)
77
78
79

users-guide: $(USERGUIDE_STAMP)
$(USERGUIDE_STAMP) : doc/Cabal.xml
80
81
	$(XMLLINT) $(XMLLINT_OPTIONS) $<
	$(XSLTPROC) $(XSLTPROC_OPTIONS) $<
82
	cp doc/$(XSLTPROC_HTML_CSS) $(XSLTPROC_HTML_OUTDIR)
83
84
85
86
87
88

docs: haddock users-guide

clean:
	rm -rf dist/
	rm -f setup
89
90
91

# testing...

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

97
98
99
100
101
#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)
102

103
104
105
106
#check:
#	rm -f moduleTest
#	$(MAKE) moduleTest
#	./moduleTest
107
108
109

# distribution...

110
111
112
113
114
115
116
117
118
119
120
$(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
121
	cp changelog $(DISTLOC)/Cabal-$(VERSION)/
122
123
124
125
126
127
128
129
130
131
132
133
	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)
	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...
134

135
136
TAGSSRCDIRS = Distribution Language
tags TAGS: $(SOURCES)
137
	find $(TAGSSRCDIRS) -name \*.\*hs | xargs hasktags