Makefile 5.33 KB
Newer Older
1

2
3
CABALVERSION=1.1.7

4
5
KIND=rc
#KIND=latest
6
GHCFLAGS= --make -cpp -Wall -DCABAL_VERSION=1,1,7
7
8
9
# later: -Wall
PREF=/usr/local
USER_FLAG =
10
11
12
GHCPKGFLAGS =
HC=ghc
HC_PKG=ghc-pkg
13
14
15
16
17
18
19
20
21
22
# Comment out this line if your system doesn't have System.Posix.
ISPOSIX=-DHAVE_UNIX_PACKAGE

ifdef user
USER_FLAG = --user
GHCPKGFLAGS = -f ~/.ghc-packages
GHCFLAGS += -package-conf ~/.ghc-packages
endif

# the cabal tarball...
23
CABALBALL=cabal-$(CABALVERSION).tar.gz
24

25
all: build
26
27
28
29
30
31
32
33
34
35
36

# build the library itself

setup::
	mkdir -p dist/tmp
	$(HC) $(GHCFLAGS) -i. -odir dist/tmp -hidir dist/tmp Setup.lhs -o setup

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

config: setup
37
	./setup configure --ghc --with-compiler=$(HC) --prefix=$(PREF)
38
39
40
41

build: build-stamp
build-stamp: config
	./setup build
42

43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
install: build-stamp
	./setup install $(USER_FLAG)

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

haddock: setup
	./setup configure
	./setup haddock

clean-doc:
64
	cd doc && $(MAKE) clean
65
66
67
68
69
70
71
72

doc: haddock
	docbook2html doc/Cabal.xml --output doc/users-guide

clean: clean-cabal clean-hunit clean-test clean-doc

clean-cabal:
	-rm -f Distribution/*.o Distribution/*.hi
Ian Lynagh's avatar
Ian Lynagh committed
73
74
	-rm -f Distribution/Compat/*.o Distribution/Compat/*.hi
	-rm -f Distribution/PreProcess/*.o Distribution/PreProcess/*.hi
75
	-rm -f Distribution/Simple/*.o Distribution/Simple/*.hi
Ian Lynagh's avatar
Ian Lynagh committed
76
	-rm -f Language/Haskell/*.o Language/Haskell/*.hi
77
78
79
80
81
82
83
84
	-rm -f darcs* out.build *~ semantic.cache* x*.html
	-rm -f library-infrastructure--darcs.tar.gz
	-rm -rf setup *.o *.hi moduleTest dist installed-pkg-config
	-rm -f build-stamp
	-rm -rf dist/hugs

clean-hunit:
	-rm -f hunit-stamp hunitInstall-stamp
85
	cd tests/HUnit-1.0 && $(MAKE) clean
86
87

clean-test:
88
89
	cd tests/A && $(MAKE) clean
	cd tests/wash2hs && $(MAKE) clean
90
91
92
93
94
95
96
97
98
99
100
101
102

remove: remove-cabal remove-hunit
remove-cabal:
	-$(HC_PKG) $(GHCPKGFLAGS) -r Cabal
	-rm -rf $(PREF)/lib/Cabal-0.1
remove-hunit:
	-$(HC_PKG) $(GHCPKGFLAGS) -r HUnit
	-rm -rf $(PREF)/lib/HUnit-1.0

# dependencies (included):

hunit: hunit-stamp
hunit-stamp:
103
	cd tests/HUnit-1.0 && $(MAKE) && ./setup configure --prefix=$(PREF) && ./setup build
104
105
106
107
108
109
110
111
112
113
114
	touch $@

hunitInstall: hunitInstall-stamp
hunitInstall-stamp: hunit-stamp
	cd tests/HUnit-1.0 && ./setup install $(USER_FLAG)
	touch $@

# testing...

moduleTest:
	mkdir -p dist/debug
115
	$(HC) $(GHCFLAGS) $(ISPOSIX) -DDEBUG -odir dist/debug -hidir dist/debug -idist/debug/:src:tests/HUnit-1.0/src tests/ModuleTest.hs -o moduleTest
116
117

tests: moduleTest clean
118
119
120
121
	cd tests/A && $(MAKE) clean
	cd tests/HUnit-1.0 && $(MAKE) clean
	cd tests/A && $(MAKE)
	cd tests/HUnit-1.0 && $(MAKE)
122
123
124

check:
	rm -f moduleTest
125
	$(MAKE) moduleTest
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
	./moduleTest

# distribution...

pushall:
	darcs push ijones@darcs.haskell.org:/home/darcs/cabal
	darcs push ijones@darcs.haskell.org:/home/darcs/packages/Cabal

pullall:
	darcs pull ijones@darcs.haskell.org:/home/darcs/cabal
	darcs pull ijones@darcs.haskell.org:/home/darcs/packages/Cabal


pushdist: pushall dist
	scp $(TMPDISTLOC)/cabal.tar.gz ijones@www.haskell.org:~/cabal/cabal-code.tgz
#	PUSH ELSEWHERE: scp changelog ijones@www.haskell.org:~/cabal/release/changelog
#	PUSH ELSEWHERE: scp releaseNotes ijones@www.haskell.org:~/cabal/release/notes
#	rm -f /tmp/cabal-code.tgz

deb: dist
	cd $(TMPDISTLOC) && ln -s $(CABALBALL) haskell-cabal_$(CABALVERSION).orig.tar.gz
	cd $(TMPDISTLOC) && tar -zxvf $(CABALBALL)
	mv $(TMPDISTLOC)/cabal $(TMPDISTLOC)/haskell-cabal-$(CABALVERSION)
	cd $(TMPDISTLOC)/haskell-cabal-$(CABALVERSION) && debuild

$(CABALBALL):
	darcs record
	rm -rf /tmp/cabal* /tmp/Cabal*
	rm -rf $(TMPDISTLOC)
155
	darcs dist --dist-name=cabal-$(CABALVERSION)
156
157
158
159
160
161
162
163
164
165

TMPDISTLOC=/tmp/cabaldist

# after this command, there will be cabal.tar.gz in $(TMPDISTLOC),
# which will have built docs, haddock, and source code.

dist: haddock $(CABALBALL)
	rm -rf $(TMPDISTLOC)
	mkdir $(TMPDISTLOC)
	mv $(CABALBALL) $(TMPDISTLOC)
166
	cd $(TMPDISTLOC) && tar -zxvf $(CABALBALL)
167
	#mkdir $(TMPDISTLOC)/cabal/doc
168
	$(MAKE) doc
169
170
171
172
	cp -r dist/doc/html $(TMPDISTLOC)/cabal-$(CABALVERSION)/doc/API
	cp -r doc/users-guide $(TMPDISTLOC)/cabal-$(CABALVERSION)/doc/users-guide
	cd ~/prgs/build/haskell-report/packages && docbook2html -o /tmp/pkg-spec-html pkg-spec.sgml && docbook2pdf pkg-spec.sgml -o /tmp
	cp -r /tmp/pkg-spec{-html,.pdf} $(TMPDISTLOC)/cabal-$(CABALVERSION)/doc
173

174
175
	cd $(TMPDISTLOC) && rm -f $(CABALBALL) && tar -zcvf $(CABALBALL) cabal-$(CABALVERSION)
	@echo "Cabal tarball built: $(TMPDISTLOC)/$(CABALBALL)"
176
177
178

release: dist
	mkdir $(TMPDISTLOC)/release
179
180
181
182
183
184
	cp $(TMPDISTLOC)/cabal-$(CABALVERSION)/releaseNotes $(TMPDISTLOC)/release
	cp $(TMPDISTLOC)/cabal-$(CABALVERSION)/changelog $(TMPDISTLOC)/release
	cp -r $(TMPDISTLOC)/cabal-$(CABALVERSION)/doc $(TMPDISTLOC)/release
	cp $(TMPDISTLOC)/cabal-$(CABALVERSION).tar.gz  $(TMPDISTLOC)/release/cabal-$(CABALVERSION).tar.gz
	scp -r $(TMPDISTLOC)/release www.haskell.org:/home/haskell/cabal/release/cabal-$(CABALVERSION)
	ssh www.haskell.org 'cd /home/haskell/cabal/release && rm -f $(KIND) && ln -s cabal-$(CABALVERSION) $(KIND)'
185

186
187
188
189
190
191
192
193
# dirs that contain source files that should be tagged.  Be careful to
# about using "."
TAGSSRCDIRS = Distribution Language

# create ctags/etags files.
tags::
	find $(TAGSSRCDIRS) -name \*.\*hs | xargs hasktags