Makefile 5.37 KB
Newer Older
1

Duncan Coutts's avatar
Duncan Coutts committed
2
CABALVERSION=1.2.0
3

4
5
KIND=rc
#KIND=latest
Duncan Coutts's avatar
Duncan Coutts committed
6
GHCFLAGS= --make -cpp -Wall -DCABAL_VERSION=1,2,0
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
users-guide: 
67
68
	docbook2html doc/Cabal.xml --output doc/users-guide

69
70
71
doc: haddock users-guide
docs: doc

72
73
74
75
clean: clean-cabal clean-hunit clean-test clean-doc

clean-cabal:
	-rm -f Distribution/*.o Distribution/*.hi
Ian Lynagh's avatar
Ian Lynagh committed
76
77
	-rm -f Distribution/Compat/*.o Distribution/Compat/*.hi
	-rm -f Distribution/PreProcess/*.o Distribution/PreProcess/*.hi
78
	-rm -f Distribution/Simple/*.o Distribution/Simple/*.hi
Ian Lynagh's avatar
Ian Lynagh committed
79
	-rm -f Language/Haskell/*.o Language/Haskell/*.hi
80
81
82
83
84
85
86
87
	-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
88
	cd tests/HUnit-1.0 && $(MAKE) clean
89
90

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

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:
106
	cd tests/HUnit-1.0 && $(MAKE) && ./setup configure --prefix=$(PREF) && ./setup build
107
108
109
110
111
112
113
114
115
116
117
	touch $@

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

# testing...

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

tests: moduleTest clean
121
122
123
124
	cd tests/A && $(MAKE) clean
	cd tests/HUnit-1.0 && $(MAKE) clean
	cd tests/A && $(MAKE)
	cd tests/HUnit-1.0 && $(MAKE)
125
126
127

check:
	rm -f moduleTest
128
	$(MAKE) moduleTest
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
155
156
157
	./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)
158
	darcs dist --dist-name=cabal-$(CABALVERSION)
159
160
161
162
163
164
165
166
167
168

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)
169
	cd $(TMPDISTLOC) && tar -zxvf $(CABALBALL)
170
	#mkdir $(TMPDISTLOC)/cabal/doc
171
	$(MAKE) doc
172
173
174
175
	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
176

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

release: dist
	mkdir $(TMPDISTLOC)/release
182
183
184
185
186
187
	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)'
188

189
190
191
192
193
194
195
196
# 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