Find git executable at run time
[git-darcs-import.git] / GNUmakefile
blobba25b5ca5c6c4887c39ccc28d94287f029f2e249
2 # Build darcs
4 ifeq (,$(findstring disttest,$(MAKECMDGOALS)))
5 ifeq (,$(findstring slowdisttest,$(MAKECMDGOALS)))
6 ifeq (,$(findstring clean,$(MAKECMDGOALS)))
7 ifneq (config,$(MAKECMDGOALS))
8 include autoconf.mk
9 endif
10 endif
11 endif
12 endif
14 ifneq (,$(RTSFLAGS))
15 GHCFLAGS += +RTS $(RTSFLAGS) -RTS
16 endif
18 GHCFLAGS += -Wall -Werror -I. -I./src -i./src
19 GHCFLAGS_src__Darcs__Commands__Record.o = $(filter-out -auto-all,$(GHCFLAGS))
20 GHCFLAGS_src__Darcs__SelectChanges.o = $(filter-out -auto-all,$(GHCFLAGS))
21 GHCFLAGS_src__SHA1.o = $(GHCFLAGS) -no-auto-all -funfolding-use-threshold20
22 ifeq ($(HAVE_CURSES),True)
23 GHCFLAGS_src__Darcs__External.o = $(GHCFLAGS)
24 ifeq ($(HAVE_TERMIO_H),True)
25 # This termio bit is a grim hack for Solaris 10 (at least).
26 # Without it, SGTTY isn't declared. Something in the ghc C headers
27 # which get included before term.h in the generated C is clobbering
28 # it. (If you edit that C and put the curses.h and term.h first, the
29 # error goes away.)
30 GHCFLAGS_src__Darcs__External.o += '-\#include <termio.h>'
31 endif
32 GHCFLAGS_src__Darcs__External.o += '-\#include <curses.h>' '-\#include <term.h>'
33 endif
35 SRC_DIRS := . $(shell find src/ -name sys -prune -o -type d -print)
37 MODULES_AUTOCONF :=\
38 Autoconf.lhs \
39 Context.hs \
41 MODULES_GENERAL :=\
42 ThisVersion.lhs \
43 CommandLine.lhs \
44 URL.hs HTTP.hs DateMatcher.lhs \
45 English.lhs Exec.lhs\
46 ByteStringUtils.hs UglyFileName.lhs IsoDate.lhs \
47 Lcs.lhs OldDate.lhs \
48 Printer.lhs \
49 RegChars.lhs \
50 SHA1.lhs Ssh.hs UTF8.lhs \
51 Workaround.hs \
53 MODULES_CRYPT := SHA256.hs
55 MODULES_DARCS :=\
56 ArgumentDefaults.lhs \
57 Arguments.lhs Bug.lhs \
58 CheckFileSystem.lhs \
59 ColorPrinter.lhs \
60 Commands.lhs CommandsAux.lhs RunCommand.lhs \
61 Compat.hs \
62 Diff.lhs Email.hs FilePathUtils.hs \
63 FilePathMonad.lhs \
64 External.hs \
65 Flags.lhs Global.lhs \
66 Hopefully.lhs \
67 IO.lhs Lock.lhs Ordered.lhs Patch.lhs \
68 Match.lhs \
69 Population.hs PopulationData.hs \
70 PrintPatch.lhs Progress.lhs \
71 RemoteApply.lhs RepoPath.hs \
72 Repository.lhs Resolution.lhs SignalHandler.lhs Test.lhs URL.hs \
73 Sealed.lhs Show.lhs \
74 SlurpDirectory.lhs \
75 SelectChanges.lhs TheCommands.lhs \
76 Utils.lhs \
78 MODULES_PATCH:=\
79 Apply.lhs Bundle.lhs \
80 Commute.lhs Core.lhs \
81 Choices.lhs \
82 Depends.lhs FileName.lhs \
83 Info.lhs Match.lhs MatchData.lhs \
84 Non.lhs \
85 Patchy.lhs Permutations.lhs \
86 Prim.lhs \
87 Read.lhs ReadMonads.hs Real.lhs Set.lhs Show.lhs \
88 TouchesFiles.lhs Viewing.lhs \
90 MODULES_REPOSITORY:=\
91 ApplyPatches.lhs \
92 Cache.lhs \
93 Checkpoint.lhs \
94 HashedIO.lhs HashedRepo.lhs \
95 Format.lhs Internal.lhs Repair.lhs \
96 InternalTypes.lhs \
97 Motd.lhs Prefs.lhs \
98 Pristine.lhs \
99 DarcsRepo.lhs \
101 MODULES_COMMANDS:=\
102 Add.lhs AmendRecord.lhs Annotate.lhs Apply.lhs \
103 Changes.lhs Check.lhs Convert.lhs Diff.lhs Dist.lhs \
104 Get.lhs Help.lhs Init.lhs MarkConflicts.lhs Mv.lhs Optimize.lhs \
105 Pull.lhs Push.lhs Put.lhs \
106 Record.lhs Remove.lhs Repair.lhs Replace.lhs \
107 Revert.lhs Rollback.lhs \
108 Send.lhs SetPref.lhs \
109 Show.lhs ShowAuthors.lhs ShowBug.lhs \
110 ShowContents.lhs ShowFiles.lhs ShowTags.lhs ShowRepo.lhs \
111 Tag.lhs TrackDown.lhs TransferMode.lhs \
112 Unrecord.lhs Unrevert.lhs WhatsNew.lhs \
114 witnesses: src/Darcs/Patch/Real.hi src/Darcs/Patch/Properties.hi src/Darcs/Patch.hi \
115 src/Darcs/Repository/ApplyPatches.hi src/Darcs/Patch/Bundle.hi \
116 src/Darcs/Patch/Match.hi src/Darcs/Repository/HashedRepo.hi \
117 src/Darcs/Resolution.hi src/Darcs/Patch/Check.hi \
118 src/Darcs/Repository/Pristine.hi src/Darcs/Repository/DarcsRepo.hi \
119 src/Darcs/Repository/Internal.hi \
120 src/Darcs/Commands/Unrevert.hi src/Darcs/Commands/WhatsNew.hi \
121 src/Darcs/Commands/Dist.hi src/Darcs/Commands/TransferMode.hi
123 DARCS_FILES := \
124 $(patsubst %,src/%,$(MODULES_AUTOCONF))\
125 $(patsubst %,src/%,$(MODULES_GENERAL))\
126 $(patsubst %,src/Crypt/%,$(MODULES_CRYPT))\
127 $(patsubst %,src/Darcs/%,$(MODULES_DARCS))\
128 $(patsubst %,src/Darcs/Patch/%,$(MODULES_PATCH))\
129 $(patsubst %,src/Darcs/Repository/%,$(MODULES_REPOSITORY))\
130 $(patsubst %,src/Darcs/Commands/%,$(MODULES_COMMANDS))
132 UNIT_FILES := $(DARCS_FILES) src/Darcs/Patch/Test.lhs src/Darcs/Patch/QuickCheck.lhs \
133 src/Darcs/Patch/Unit.lhs src/Darcs/Patch/Properties.lhs src/Darcs/Patch/Check.lhs
135 C_OBJS := $(patsubst %,src/%.o,c_compat maybe_relink atomic_create fpstring umask Crypt/sha2 hscurl hslibwww)
137 ifeq ($(SYS), windows)
138 GHCFLAGS += -isrc/win32 -Isrc/win32 -DWIN32
139 DARCS_FILES += src/win32/System/Posix.hs src/win32/System/Posix/Files.hs \
140 src/win32/System/Posix/IO.hs src/win32/CtrlC.hs
141 C_OBJS += src/win32/CtrlC_stub.o src/win32/CtrlC.o
142 UNIT_FILES += src/win32/System/Posix.hs src/win32/System/Posix/Files.hs \
143 src/win32/System/Posix/IO.hs
144 endif
146 ifeq ($(HAVE_MAPI),True)
147 C_OBJS += src/win32/send_email.o
148 CPPFLAGS += -Isrc/win32
149 GHCFLAGS += -DHAVE_MAPI
150 endif
152 DARCS_OBJS := $(patsubst %.hs,%.o,$(patsubst %.lhs,%.o,$(DARCS_FILES)))
153 UNIT_OBJS := $(patsubst %.hs,%.o,$(patsubst %.lhs,%.o,$(UNIT_FILES)))
156 .PHONY: all clean distclean maintainer-clean dist deb test check install \
157 test-franchise test-old test-hashed test-format2 \
158 darcs-nightly\
159 disttest slowdisttest \
160 bugs bugs-old bugs-hashed bugs-format2 \
161 installserver installdocs installbin windowsinstaller \
162 website witnesses\
163 api-doc-dir
165 config: configure autoconf.mk
167 copy:
168 $(MAKE) install prefix=$(destdir)/$(prefix) \
169 bindir=$(destdir)/$(bindir) \
170 libdir=$(destdir)/$(libdir) \
171 datadir=$(destdir)/$(datadir) \
172 libexecdir=$(destdir)/$(libexecdir)
174 installbin: all
175 test -d $(DESTDIR)$(bindir) || $(INSTALL) -d $(DESTDIR)$(bindir)
176 $(INSTALL) darcs $(DESTDIR)$(bindir)
178 test -d $(DESTDIR)$(sysconfdir)/bash_completion.d || \
179 $(INSTALL) -d $(DESTDIR)$(sysconfdir)/bash_completion.d
180 $(INSTALL_DATA) tools/darcs_completion $(DESTDIR)$(sysconfdir)/bash_completion.d/darcs
182 test -d $(DESTDIR)$(mandir)/man1 || \
183 $(INSTALL) -d $(DESTDIR)$(mandir)/man1
184 $(INSTALL_DATA) doc/darcs.1 $(DESTDIR)$(mandir)/man1/
186 installdocs: doc/manual/darcs.pdf doc/manual/patch-theory.pdf doc/manual/index.html
187 test -d $(DESTDIR)$(docdir)/manual || \
188 $(INSTALL) -d $(DESTDIR)$(docdir)/manual
189 $(INSTALL_DATA) doc/manual/*.pdf $(DESTDIR)$(docdir)/manual
190 $(INSTALL_DATA) doc/manual/*.png $(DESTDIR)$(docdir)/manual
191 $(INSTALL_DATA) doc/manual/*.html $(DESTDIR)$(docdir)/manual
193 test -d $(DESTDIR)$(docdir)/examples || \
194 $(INSTALL) -d $(DESTDIR)$(docdir)/examples
195 $(INSTALL_DATA) tools/zsh_completion_new $(DESTDIR)$(docdir)/examples/
196 $(INSTALL_DATA) tools/zsh_completion_old $(DESTDIR)$(docdir)/examples/
198 installserver: tools/cgi/darcs.cgi
199 test -d $(DESTDIR)$(libexecdir)/cgi-bin || \
200 $(INSTALL) -d $(DESTDIR)$(libexecdir)/cgi-bin
202 test -d $(DESTDIR)$(sysconfdir)/darcs || \
203 $(INSTALL) -d $(DESTDIR)$(sysconfdir)/darcs
204 test -e $(DESTDIR)$(sysconfdir)/darcs/cgi.conf || \
205 $(INSTALL_DATA) tools/cgi/cgi.conf $(DESTDIR)$(sysconfdir)/darcs/cgi.conf
206 $(INSTALL) tools/cgi/darcs.cgi $(DESTDIR)$(libexecdir)/cgi-bin/darcs.cgi
207 test -d $(DESTDIR)$(datadir)/darcs || \
208 $(INSTALL) -d $(DESTDIR)$(datadir)/darcs
209 test -d $(DESTDIR)$(datadir)/darcs/xslt || \
210 $(INSTALL) -d $(DESTDIR)$(datadir)/darcs/xslt
211 $(INSTALL_DATA) tools/cgi/xslt/*.xslt $(DESTDIR)$(datadir)/darcs/xslt/
212 $(INSTALL_DATA) tools/cgi/xslt/errors.xml $(DESTDIR)$(datadir)/darcs/xslt/
213 $(INSTALL_DATA) tools/cgi/xslt/styles.css $(DESTDIR)$(datadir)/darcs/xslt/styles.css
215 # Debian policy doesn't allow symlinks as configuration files.
216 # test -e $(DESTDIR)$(sysconfdir)/darcs/styles.css || \
217 # ln -s $(datadir)/darcs/xslt/styles.css \
218 # $(DESTDIR)$(sysconfdir)/darcs/styles.css
219 $(INSTALL) -m 644 tools/cgi/xslt/styles.css $(DESTDIR)$(sysconfdir)/darcs/styles.css
221 PREDIST_COPY_FILES := \
222 AUTHORS \
223 release/STATE \
224 src/Context.hs
226 DARCS_VERSION_WITH_PATCHES=$(shell sed -e 's/ (//' -e 's/ patches)//' -e 's/+ /+/' release/STATE)
227 darcs-nightly: darcs release/STATE
228 ln -sf darcs darcs-$(DARCS_VERSION_WITH_PATCHES)
230 dist: darcs $(PREDIST_COPY_FILES)
231 REPO_PATH="$$PWD" ./darcs dist --dist-name darcs-$(DARCS_VERSION)
232 ln -sf darcs-$(DARCS_VERSION).tar.gz darcs-latest.tar.gz
234 darcs-test.tar.gz: darcs $(PREDIST_COPY_FILES)
235 REPO_PATH="$$PWD" ./darcs dist --dist-name darcs-test
237 predist_copy:
238 for F in $(PREDIST_COPY_FILES); do \
239 cp "$$REPO_PATH/$$F" "$$F"; \
240 done
242 predist: predist_copy doc/manual/darcs.ps doc/darcs.1 doc/manual/index.html distclean
243 rm -fr release/debian
245 #ensure the directory exists for api documentation
246 api-doc-dir:
247 @echo "Creating api-doc directory"
248 @mkdir -p api-doc
250 #generate the api documentation
251 api-doc: api-doc-dir $(DARCS_FILES)
252 @test $(HADDOCK_VERSION) -lt 2 || { echo "You need haddock 2.0.0 or later to build the API documentation"; false; }
253 echo "Generating html"
254 haddock --ignore-all-exports --optghc=-I. --optghc=-I./src --optghc=-i./src -B `$(GHC) --print-libdir` -o api-doc -h $(filter-out %api-doc-dir,$^)
255 cp api-doc/index.html api-doc/modules-index.html
257 #generate the api documentation with links to colourised source code
258 api-doc-with-source: api-doc-dir colourised-source $(DARCS_FILES) src/darcs.lhs
259 @test $(HADDOCK_VERSION) -lt 2 || { echo "You need haddock 2.0.0 or later to build the API documentation"; false; }
260 echo "Generating haddock api docs"
261 haddock --no-warnings --ignore-all-exports --optghc=-I. --optghc=-I./src --optghc=-i./src -B `$(GHC) --print-libdir` -o api-doc -h --source-module=src-%{MODULE/./-}.html $(filter-out %api-doc-dir colourised-source,$^)
262 cp api-doc/index.html api-doc/modules-index.html
263 # --source-entity=src-%{MODULE/./-}.html#%N # awaiting http://code.google.com/p/ndmitchell/issues/detail?id=95
265 # munge haddock and hoogle into a rough but useful framed layout
266 # ensure that the hoogle cgi is built with base target "main"
267 api-doc-frames: api-doc-with-source hoogleweb
268 echo "Converting api docs to frames"
269 sed -i -e 's%^></head%><base target="main"></head%i' api-doc/modules-index.html
270 cp doc/misc/api-doc-frames.html api-doc/index.html
271 cp doc/misc/hoogle-small.html hoogle
273 colourised-source: api-doc-dir $(DARCS_FILES) src/darcs.lhs
274 echo "Generating colourised source"
275 for f in $(DARCS_FILES) src/darcs.lhs; do \
276 HsColour -css -anchor $$f -oapi-doc/`echo $$f | sed -e's%/%-%g' | sed -e's%\.l\?hs$$%.html%'` ; \
277 done
278 mv api-doc/src-darcs.html api-doc/src-Main.html
279 HsColour -print-css >api-doc/hscolour.css
281 #generate a hoogle index
282 #uses system "hoogle"
283 #works around http://code.google.com/p/ndmitchell/issues/detail?id=93
284 #usage: hoogle --data=api-doc/default ...
285 hoogleindex: $(DARCS_FILES) src/darcs.lhs
286 echo "Generating hoogle index"
287 mkdir -p hoogle
288 haddock --no-warnings --ignore-all-exports --optghc=-I. --optghc=-I./src --optghc=-i./src -B `$(GHC) --print-libdir` -o hoogle --hoogle $^
289 cd hoogle && sed -i -e 's/^(_/-- (_/' main.txt
290 cd hoogle && hoogle --convert=main.txt --output=default.hoo
292 #set up the hoogle web interface
293 #uses a hoogle source tree configured with --datadir=. and patched to fix haddock urls
294 HOOGLESRC=/usr/local/src/hoogle
295 HOOGLE=$(HOOGLESRC)/dist/build/hoogle/hoogle
296 HOOGLEVER=`$(HOOGLE) --version |tail -n 1 | sed -e 's/Version /hoogle-/'`
297 hoogleweb: hoogleindex
298 echo "Configuring hoogle web interface"
299 mkdir -p hoogle
300 ln -sf . hoogle/$(HOOGLEVER)
301 cp -r $(HOOGLESRC)/deploy/res/ hoogle/
302 cp -p $(HOOGLE) hoogle/index.cgi
303 touch log.txt
304 chmod 666 log.txt
306 windowsinstaller: darcs doc/manual/index.html release/darcs.nsi
307 echo "!define VERSION $(DARCS_VERSION)" > version.nsi
308 "$(MAKENSIS)" version.nsi release/darcs.nsi
309 rm -f version.nsi
311 darcs: $(DARCS_OBJS) src/darcs.lhs $(C_OBJS)
312 @echo Linking $@ ...
313 @rm -f Main.o Main.hi
314 ifdef VERBOSE
315 $(GHC) $(GHCFLAGS) $(OPTLLDFLAGS) -o $@ $^ $(OPTLLIBS)
316 else
317 @$(GHC) $(GHCFLAGS) $(OPTLLDFLAGS) -o $@ $^ $(OPTLLIBS)
318 endif
320 # rebuild whenever a module changes, using searchpath
321 # Requires a patched version: darcs get http://joyful.com/repos/searchpath
322 SP=sp --no-default-map --no-exts --sp-verbose 1
323 SPDARCSCMD="--version"
324 SPLAST=--run $(SPDARCSCMD)
325 continuous ci:
326 @$(SP) $(GHC) --make $(GHCFLAGS) $(OPTLLDFLAGS) -o darcs src/darcs.lhs $(C_OBJS) $(OPTLLIBS) $(SPLAST)
328 ghci: $(DARCS_FILES) $(C_OBJS)
329 ghci $(filter-out -Wall,$(GHCFLAGS)) $(OPTLLDFLAGS) src/darcs.lhs $(C_OBJS) $(OPTLLIBS)
330 .PHONY: ghci
332 darcsman: src/darcsman.hs $(C_OBJS) $(DARCS_OBJS)
333 list_authors: src/list_authors.hs $(C_OBJS) $(DARCS_OBJS)
334 microbench: src/microbench.hs $(C_OBJS) $(DARCS_OBJS)
335 unit: src/unit.lhs $(UNIT_OBJS) $(C_OBJS)
336 preproc: src/preproc.hs $(C_OBJS) $(DARCS_OBJS)
337 git-darcs-import: src/git-darcs-import.hs $(C_OBJS) $(DARCS_FILES) src/Git/*.hs
338 $(GHC) -o $@ $(GHCFLAGS) --make $(OPTLLDFLAGS) $< $(OPTLLIBS) $(C_OBJS) -optl-s
340 TEXSOURCES := preproc src/darcs.lhs src/features.tex \
341 src/switching.tex src/configuring_darcs.tex src/gpl.tex \
342 $(DARCS_FILES) src/building_darcs.tex \
343 src/best_practices.tex src/formats.tex
344 src/darcs.tex: $(TEXSOURCES)
345 ./preproc darcs.lhs $(PREPROCHTML) >$@
346 # The following is to prevent both being generated simultaneously, which
347 # confuses texlive:
348 src/darcs_print.pdf: src/darcs_print.ps
349 src/darcs_print.tex: $(TEXSOURCES)
350 ./preproc darcs.lhs >$@
351 src/patch-theory.tex: $(TEXSOURCES) $(UNIT_FILES)
352 ./preproc Darcs/Patch/Properties.lhs >$@
354 website: doc/manual/darcs.ps doc/manual/patch-theory.pdf doc/manual/index.html doc/manual/bigpage.html \
355 darcs doc/index.html
357 doc/manual/index.html: src/darcs.tex src/gpl.tex doc/darcs.css
358 $(MAKEMANUAL)
359 cp -f doc/darcs.css doc/manual/darcs.css
361 doc/manual/bigpage.html: src/darcs.tex src/gpl.tex doc/darcs.css
362 ln -sf darcs.tex src/bigpage.tex
363 latex2html -split 0 -external_file darcs -prefix big \
364 -no_auto_link -dir doc/manual src/bigpage.tex
365 rm src/bigpage.tex
366 cp -f doc/darcs.css doc/manual/bigpage.css
368 doc/manual/darcs.ps: src/darcs_print.ps
369 cp src/darcs_print.ps doc/manual/darcs.ps
370 doc/manual/darcs.pdf: src/darcs_print.pdf
371 cp src/darcs_print.pdf doc/manual/darcs.pdf
372 doc/manual/patch-theory.pdf: src/patch-theory.pdf
373 cp src/patch-theory.pdf doc/manual/
375 doc/darcs.1: darcsman
376 ./darcsman > $@
378 AUTHORS: list_authors
379 ./list_authors >$@
381 check test: test-old test-hashed test-format2
383 disttest:
384 @echo '**********************************************************************'
385 @echo Note: to prevent darcs from running tests by default, you can put
386 @echo the following entries in _darcs/prefs/defaults
387 @echo
388 @echo record no-test
389 @echo amend-record no-test
390 @echo
391 @echo It would be helpful if you ran the tests sometime before sending in
392 @echo your patches. You can do so by running darcs check.
393 @echo
394 @echo To run a faster subset of the tests, just run make check.
395 @echo '**********************************************************************'
396 @if ghc-pkg list QuickCheck | grep '\-2\..' > /dev/null ; then true; else \
397 echo "You need QuickCheck 2 to run the tests ( darcs get http://darcs.haskell.org/QuickCheck )";\
398 exit 1;\
400 @echo '*****************************'
401 @echo Get a clean copy of franchise
402 @echo '*****************************'
403 rm -rf franchise-test Distribution
404 darcs get http://darcs.net/repos/franchise franchise-test
405 cp -r franchise-test/Distribution .
406 @echo '*****************************'
407 @echo Test franchise build of darcs
408 @echo '*****************************'
409 runghc Setup.hs configure
410 runghc Setup.hs build -j4
411 runghc Setup.hs clean
412 $(call echo_without_wine,'**************************************')
413 $(call echo_without_wine,Not testing with older version of wine)
414 $(call echo_without_wine,'**************************************')
415 $(call echo_with_wine,'****************************************')
416 $(call echo_with_wine,Test franchise build of darcs under wine)
417 $(call echo_with_wine,'****************************************')
418 $(call with_wine,wine runghc Setup.hs configure)
419 $(call with_wine,wine runghc Setup.hs build -j4)
420 $(call with_wine,wine runghc Setup.hs clean)
421 @echo '**************************'
422 @echo Running old autoconf tests
423 @echo '**************************'
424 autoconf
425 ./configure --with-type-witnesses
426 $(MAKE) -j4 witnesses
427 $(MAKE) clean
428 ./configure
429 $(MAKE) -j4 all unit
430 $(MAKE) -j4 check test_network
432 slowdisttest: disttest test_unit
434 bugs: bugs-old bugs-hashed bugs-format2 \
436 TEST_FILTER_FILE := tests_to_run
437 SHELL_HARNESS := perl ../tests/shell_harness
439 define with_wine
440 @if test "wine-1.0" = `wine --version`; then echo "$1"; $1; fi
441 endef
443 define echo_with_wine
444 @if test "wine-1.0" = `wine --version`; then echo "$1"; fi
445 endef
447 define echo_without_wine
448 @if test !"wine-1.0" = `wine --version`; then echo "$1"; fi
449 endef
451 # $1 - description
452 # $2 - setup
453 define shell_harness
454 @echo Running tests on $1 repositories...
455 @chmod -R u+rwx tests-$1.dir 2>/dev/null || true
456 @rm -rf tests-$1.dir && cp -R tests tests-$1.dir
457 @cd tests-$1.dir && rm -rf .darcs; mkdir .darcs;\
458 $2;\
459 if [ -r $(TEST_FILTER_FILE) ];\
460 then grep "\.sh" $(TEST_FILTER_FILE) | grep -v '^#' | xargs $(SHELL_HARNESS); \
461 else printf %s\\n *.sh | sort -r | xargs $(SHELL_HARNESS); fi
462 @echo Done running tests on $1 repositories...
463 endef
465 define bug_harness
466 @echo Demonstrating bugs on $1 repositories...
467 @rm -rf bugs-$1.dir && cp -R bugs bugs-$1.dir
468 @cd bugs-$1.dir && rm -rf .darcs; mkdir .darcs;\
469 $2;\
470 if [ -r $(TEST_FILTER_FILE) ];\
471 then bugs=1 grep "\.sh" $(TEST_FILTER_FILE) | grep -v '^#' | xargs $(SHELL_HARNESS) || true; \
472 else bugs=1 printf %s\\n *.sh | sort -r | xargs $(SHELL_HARNESS) || true; fi
473 @echo Done demonstrating bugs on $1 repositories...
474 endef
476 test_network: darcs
477 @echo Running network tests ...
478 @rm -rf tests-network.dir && cp -R tests/network tests-network.dir
479 @cd tests-network.dir && rm -rf .darcs; mkdir .darcs;\
480 if [ -r $(TEST_FILTER_FILE) ];\
481 then bugs=1 grep "\.sh" $(TEST_FILTER_FILE) | grep -v '^#' | xargs $(SHELL_HARNESS); \
482 else bugs=1 ls *.sh | sort -r | xargs $(SHELL_HARNESS); fi
483 @echo Passed network tests.
485 hspwd: tests/hspwd.hs
486 ghc --make -o hspwd tests/hspwd.hs
488 test-old: darcs hspwd
489 $(call shell_harness,old-fashioned,\
490 echo ALL --old-fashioned-inventory >> .darcs/defaults)
492 # for the format2 tests, we skip the hashed_inventory.sh test, since explicitly
493 # creates the old-fashioned format that's incompatible with darcs-2.
494 test-format2: darcs hspwd
495 $(call shell_harness,darcs-2,\
496 echo ALL --darcs-2 >> .darcs/defaults)
498 test-hashed: darcs hspwd
499 $(call shell_harness,hashed,\
500 echo ALL --hashed >> .darcs/defaults)
502 bugs-old: darcs hspwd
503 $(call shell_bugs,old-fashioned,\
504 echo ALL --old-fashioned-inventory >> .darcs/defaults)
506 bugs-format2: darcs hspwd
507 $(call shell_bugs,format-2,\
508 echo ALL --darcs-2 >> .darcs/defaults)
510 bugs-hashed: darcs hspwd
511 $(call shell_bugs,hashed,\
512 echo ALL --hashed >> .darcs/defaults)
514 test_unit: darcs unit
515 ./unit
517 register:
519 clean:
520 rm -f $(foreach dir,$(SRC_DIRS),$(dir)/*.o $(dir)/*.hi)
521 rm -f unit diff darcs darcs_cgi
522 rm -f stringify
523 rm -f src/darcs.tex src/darcs.dvi src/darcs.aux
524 rm -f src/patch-theory.tex src/patch-theory.aux src/patch-theory.log
525 rm -f src/patch-theory.aux src/patch-theory.toc
526 rm -f src/darcs_print.tex src/darcs_print.log src/darcs_print.aux src/darcs_print.toc
527 rm -f preproc darcsman
528 rm -rf tests/temp* darcs.log darcs.toc
529 rm -f conftest* .depend.bak
530 rm -f src/win32/System/Posix/IO.hs src/win32/System/Posix/Files.hs
531 rm -f version.nsi
532 rm -f list_authors
533 rm -rf api-doc
534 rm -rf hoogle
535 #only remove src/Context.hs if we have a darcs inventory to rebuild it from
536 if test -f _darcs/inventory; then rm -f src/Context.hs; fi
537 rm -f TAGS tags
538 rm -f git-darcs-import
540 distclean: clean
541 rm -rf config.status config.log autoconf.mk config.cache autom4te.cache
542 rm -f doc/manual/darcs.ps doc/manual/darcs.pdf doc/manual/patch-theory.pdf src/Autoconf.lhs darcs.idv
543 rm -f src/ThisVersion.lhs tools/cgi/README tools/cgi/darcs.cgi tools/cgi/cgi.conf
544 rm -f config.command
546 maintainer-clean: distclean
547 @echo 'This command is intended for maintainers to use; it'
548 @echo 'deletes files that may need special tools to rebuild.'
549 rm -f configure doc/darcs.1 .depend AUTHORS
550 rm -f src/Context.hs
551 rm -f doc/manual/*.html doc/manual/darcs*.??? doc/manual/darcs.lg
552 rm -f doc/manual/darcs.xref c_context.c doc/darcs_print.ps
553 rm -rf tests/test_output
555 configure: configure.ac aclocal.m4
556 autoconf
558 autoconf.mk src/Autoconf.lhs tools/cgi/darcs.cgi : \
559 config.status autoconf.mk.in src/Autoconf.lhs.in tools/cgi/darcs.cgi.in
560 ./config.status
562 config.status: configure
563 @if test -x config.status; then \
564 ./config.status --recheck; \
565 else \
566 echo >&2 "Please run ./configure to setup the build system."; \
567 exit 1; \
570 .depend: $(DARCS_FILES) $(UNIT_FILES)
571 $(ANNOUNCE_GHC) $(GHCFLAGS) -M -optdep-f -optdep.depend $^
573 .depend: autoconf.mk
575 ifeq (,$(findstring disttest,$(MAKECMDGOALS)))
576 ifeq (,$(findstring clean,$(MAKECMDGOALS)))
577 ifneq (config,$(MAKECMDGOALS))
578 include .depend
579 endif
580 endif
581 endif
583 ETAGS = hasktags -e
584 CTAGS = hasktags -c
585 # This follows what autoconf does.
586 # Fixme: Generate correct list of .c files and depend on that.
587 .PHONY: CTAGS ctags tags
588 tags: TAGS
589 TAGS: $(DARCS_FILES)
590 $(ETAGS) $(DARCS_FILES) && etags -a src/*.c
591 ctags: CTAGS
592 CTAGS: $(DARCS_FILES)
593 $(CTAGS) $(DARCS_FILES) && ctags -a src/*.c
594 mv tags tags.unsorted
595 sort tags.unsorted > tags