initialise flags before starting git-fast-import
[git-darcs-import.git] / GNUmakefile
blob7f24e1d9c1bf2f55eb6c439f020a452125e344de
2 # Build darcs
4 ifeq (,$(findstring clean,$(MAKECMDGOALS)))
5 ifneq (config,$(MAKECMDGOALS))
6 include autoconf.mk
7 endif
8 endif
10 ifneq (,$(RTSFLAGS))
11 GHCFLAGS += +RTS $(RTSFLAGS) -RTS
12 endif
14 GHCFLAGS += -Wall -Werror -I. -I./src -i./src
15 GHCFLAGS_src__Darcs__Commands__Record.o = $(filter-out -auto-all,$(GHCFLAGS))
16 GHCFLAGS_src__Darcs__SelectChanges.o = $(filter-out -auto-all,$(GHCFLAGS))
17 GHCFLAGS_src__SHA1.o = $(GHCFLAGS) -no-auto-all -funfolding-use-threshold20
18 ifeq ($(HAVE_CURSES),True)
19 GHCFLAGS_src__Darcs__External.o = $(GHCFLAGS)
20 ifeq ($(HAVE_TERMIO_H),True)
21 # This termio bit is a grim hack for Solaris 10 (at least).
22 # Without it, SGTTY isn't declared. Something in the ghc C headers
23 # which get included before term.h in the generated C is clobbering
24 # it. (If you edit that C and put the curses.h and term.h first, the
25 # error goes away.)
26 GHCFLAGS_src__Darcs__External.o += '-\#include <termio.h>'
27 endif
28 GHCFLAGS_src__Darcs__External.o += '-\#include <curses.h>' '-\#include <term.h>'
29 endif
31 SRC_DIRS:=. ./src ./src/Crypt\
32 ./src/Darcs\
33 ./src/Darcs/Commands\
34 ./src/Darcs/Repository\
35 ./src/Darcs/Patch\
36 ./src/win32\
37 ./src/win32/System\
38 ./src/win32/System/Posix\
39 ./src/Git\
41 MODULES_AUTOCONF :=\
42 Autoconf.lhs \
43 Context.hs \
44 Workaround.hs \
46 MODULES_GENERAL :=\
47 ThisVersion.lhs \
48 CommandLine.lhs \
49 URL.hs HTTP.hs DateMatcher.lhs \
50 English.lhs Exec.lhs\
51 FastPackedString.hs FileName.lhs FileSystem.hs IsoDate.lhs \
52 Lcs.lhs OldDate.lhs OldFastPackedString.hs \
53 Printer.lhs \
54 RegChars.lhs \
55 SHA1.lhs Ssh.hs UTF8.lhs \
57 MODULES_CRYPT := SHA256.hs
59 MODULES_DARCS :=\
60 ArgumentDefaults.lhs \
61 Arguments.lhs Bug.lhs \
62 CheckFileSystem.lhs \
63 ColorPrinter.lhs \
64 Commands.lhs CommandsAux.lhs Compat.hs \
65 Diff.lhs Email.hs FilePathUtils.hs \
66 FilePathMonad.lhs \
67 External.hs \
68 Flags.lhs Global.lhs \
69 Hopefully.lhs HopefullyPrivate.lhs \
70 IO.lhs Lock.lhs Patch.lhs \
71 Match.lhs \
72 Population.lhs PopulationData.lhs \
73 PrintPatch.lhs Progress.lhs \
74 RemoteApply.lhs RepoPath.hs \
75 Repository.lhs Resolution.lhs SignalHandler.lhs Test.lhs URL.hs \
76 Sealed.lhs Show.lhs \
77 SlurpDirectory.lhs \
78 SelectChanges.lhs TheCommands.lhs \
79 Utils.lhs \
81 MODULES_PATCH:=\
82 Apply.lhs Bundle.lhs \
83 Commute.lhs Core.lhs \
84 Choices.lhs \
85 Depends.lhs Info.lhs Match.lhs MatchData.lhs \
86 Non.lhs \
87 Ordered.lhs \
88 Patchy.lhs Permutations.lhs \
89 Prim.lhs \
90 Read.lhs ReadMonads.hs Real.lhs Set.lhs Show.lhs \
91 TouchesFiles.lhs Viewing.lhs \
93 MODULES_REPOSITORY:=\
94 ApplyPatches.lhs \
95 Checkpoint.lhs \
96 HashedIO.lhs HashedRepo.lhs \
97 Format.lhs Internal.lhs \
98 InternalTypes.lhs \
99 Motd.lhs Prefs.lhs \
100 Pristine.lhs \
101 DarcsRepo.lhs \
103 MODULES_COMMANDS:=\
104 Add.lhs AmendRecord.lhs Annotate.lhs Apply.lhs \
105 Changes.lhs Check.lhs Convert.lhs Diff.lhs Dist.lhs \
106 Get.lhs Help.lhs Init.lhs MarkConflicts.lhs Mv.lhs Optimize.lhs \
107 Pull.lhs Push.lhs Put.lhs \
108 Record.lhs Remove.lhs Repair.lhs Replace.lhs \
109 Revert.lhs Rollback.lhs \
110 Send.lhs SetPref.lhs \
111 Show.lhs ShowAuthors.lhs ShowBug.lhs \
112 ShowContents.lhs ShowFiles.lhs ShowTags.lhs ShowRepo.lhs \
113 Tag.lhs TrackDown.lhs TransferMode.lhs \
114 Unrecord.lhs Unrevert.lhs WhatsNew.lhs \
116 witnesses: src/Darcs/Patch/Real.hi src/Darcs/Patch/Properties.hi src/Darcs/Patch.hi \
117 src/Darcs/Repository/ApplyPatches.hi src/Darcs/Patch/Bundle.hi \
118 src/Darcs/Patch/Match.hi src/Darcs/Repository/HashedRepo.hi \
119 src/Darcs/Resolution.hi src/Darcs/Patch/Check.hi \
120 src/Darcs/Repository/Pristine.hi src/Darcs/Repository/DarcsRepo.hi
122 DARCS_FILES := $(DARCS_FILES_DEPS)\
123 $(patsubst %,src/%,$(MODULES_AUTOCONF))\
124 $(patsubst %,src/%,$(MODULES_GENERAL))\
125 $(patsubst %,src/Crypt/%,$(MODULES_CRYPT))\
126 $(patsubst %,src/Darcs/%,$(MODULES_DARCS))\
127 $(patsubst %,src/Darcs/Patch/%,$(MODULES_PATCH))\
128 $(patsubst %,src/Darcs/Repository/%,$(MODULES_REPOSITORY))\
129 $(patsubst %,src/Darcs/Commands/%,$(MODULES_COMMANDS))
131 UNIT_FILES := $(DARCS_FILES) src/Darcs/Patch/Test.lhs src/Darcs/Patch/QuickCheck.lhs \
132 src/Darcs/Patch/Unit.lhs src/Darcs/Patch/Properties.lhs src/Darcs/Patch/Check.lhs
134 C_OBJS := $(patsubst %,src/%,c_compat.o maybe_relink.o atomic_create.o fpstring.o umask.o) \
135 src/Crypt/sha2.o src/hscurl.o src/hslibwww.o
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_shell test_shell_hashed test_shell_format2 \
158 test_perl test_perl_hashed test_perl_format2 \
159 bugs bugs_shell bugs_shell_hashed bugs_shell_format2 \
160 bugs_perl bugs_perl_hashed bugs_perl_format2 \
161 installserver installdocs installbin windowsinstaller \
162 website slowtest 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.ps 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/* $(DESTDIR)$(docdir)/manual
191 test -d $(DESTDIR)$(docdir)/examples || \
192 $(INSTALL) -d $(DESTDIR)$(docdir)/examples
193 $(INSTALL_DATA) tools/zsh_completion_new $(DESTDIR)$(docdir)/examples/
194 $(INSTALL_DATA) tools/zsh_completion_old $(DESTDIR)$(docdir)/examples/
196 installserver: tools/cgi/darcs.cgi
197 test -d $(DESTDIR)$(libexecdir)/cgi-bin || \
198 $(INSTALL) -d $(DESTDIR)$(libexecdir)/cgi-bin
200 test -d $(DESTDIR)$(sysconfdir)/darcs || \
201 $(INSTALL) -d $(DESTDIR)$(sysconfdir)/darcs
202 test -e $(DESTDIR)$(sysconfdir)/darcs/cgi.conf || \
203 $(INSTALL_DATA) tools/cgi/cgi.conf $(DESTDIR)$(sysconfdir)/darcs/cgi.conf
204 $(INSTALL) tools/cgi/darcs.cgi $(DESTDIR)$(libexecdir)/cgi-bin/darcs.cgi
205 test -d $(DESTDIR)$(datadir)/darcs || \
206 $(INSTALL) -d $(DESTDIR)$(datadir)/darcs
207 test -d $(DESTDIR)$(datadir)/darcs/xslt || \
208 $(INSTALL) -d $(DESTDIR)$(datadir)/darcs/xslt
209 $(INSTALL_DATA) tools/cgi/xslt/*.xslt $(DESTDIR)$(datadir)/darcs/xslt/
210 $(INSTALL_DATA) tools/cgi/xslt/errors.xml $(DESTDIR)$(datadir)/darcs/xslt/
211 $(INSTALL_DATA) tools/cgi/xslt/styles.css $(DESTDIR)$(datadir)/darcs/xslt/styles.css
213 # Debian policy doesn't allow symlinks as configuration files.
214 # test -e $(DESTDIR)$(sysconfdir)/darcs/styles.css || \
215 # ln -s $(datadir)/darcs/xslt/styles.css \
216 # $(DESTDIR)$(sysconfdir)/darcs/styles.css
217 $(INSTALL) -m 644 tools/cgi/xslt/styles.css $(DESTDIR)$(sysconfdir)/darcs/styles.css
219 PREDIST_COPY_FILES := \
220 ChangeLog \
221 AUTHORS \
222 release/STATE \
223 src/Context.hs
225 dist: darcs $(PREDIST_COPY_FILES)
226 REPO_PATH="$$PWD" ./darcs dist --dist-name darcs-$(DARCS_VERSION)
227 ln -sf darcs-$(DARCS_VERSION).tar.gz darcs-latest.tar.gz
229 predist_copy:
230 for F in $(PREDIST_COPY_FILES); do \
231 cp -v "$$REPO_PATH/$$F" .; \
232 done
234 predist: predist_copy doc/manual/darcs.ps doc/darcs.1 doc/manual/index.html distclean
235 rm -fr release/debian
237 deb: darcs
238 rm -rf /tmp/darcs-deb_temp && \
239 ./darcs dist --dist-name darcs-deb_temp && \
240 mv darcs-deb_temp.tar.gz /tmp && \
241 cd /tmp && tar zxf darcs-deb_temp.tar.gz && \
242 cd darcs-deb_temp && debuild && \
243 rm -rf /tmp/darcs-deb_temp
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 @if test $(HADDOCK_VERSION) -lt 2 ; then \
253 echo "You need haddock 2.0.0 or later to build the API documentation" ; \
254 exit 1 ; \
255 else \
256 echo "Generating html" ; \
257 haddock --ignore-all-exports --optghc=-I. --optghc=-I./src --optghc=-i./src --optghc=-D__HADDOCK__ -B `$(GHC) --print-libdir` -o api-doc -h $(filter-out %api-doc-dir,$^) ; \
260 windowsinstaller: darcs doc/manual/index.html release/darcs.nsi
261 echo "!define VERSION $(DARCS_VERSION)" > version.nsi
262 "$(MAKENSIS)" version.nsi release/darcs.nsi
263 rm -f version.nsi
265 darcs: $(DARCS_OBJS) src/darcs.lhs $(C_OBJS)
266 @echo Linking $@ ...
267 @rm -f Main.o Main.hi
268 ifdef VERBOSE
269 $(GHC) $(GHCFLAGS) $(OPTLLDFLAGS) -o $@ $^ $(OPTLLIBS)
270 else
271 @$(GHC) $(GHCFLAGS) $(OPTLLDFLAGS) -o $@ $^ $(OPTLLIBS)
272 endif
274 ghci: $(DARCS_FILES) $(C_OBJS)
275 ghci $(filter-out -Wall,$(GHCFLAGS)) $(OPTLLDFLAGS) src/darcs.lhs $(C_OBJS) $(OPTLLIBS)
276 .PHONY: ghci
278 darcsman: src/darcsman.hs $(C_OBJS) $(DARCS_OBJS)
279 list_authors: src/list_authors.hs $(C_OBJS) $(DARCS_OBJS)
280 microbench: src/microbench.hs $(C_OBJS) $(DARCS_OBJS)
281 make_changelog: src/make_changelog.hs $(C_OBJS) $(DARCS_OBJS)
282 unit: src/unit.lhs $(UNIT_OBJS) $(C_OBJS)
283 preproc: src/preproc.hs $(C_OBJS) $(DARCS_OBJS)
284 git-darcs-import: src/git-darcs-import.hs $(C_OBJS) $(DARCS_FILES) src/Git/*.hs
285 $(GHC) -o $@ $(GHCFLAGS) --make $(OPTLLDFLAGS) $< $(OPTLLIBS) $(C_OBJS) -optl-s
287 TEXSOURCES := preproc src/darcs.lhs src/features.tex \
288 src/switching.tex src/configuring_darcs.tex src/gpl.tex \
289 $(DARCS_FILES) src/building_darcs.tex \
290 src/best_practices.tex
291 src/darcs.tex: $(TEXSOURCES)
292 ./preproc darcs.lhs $(PREPROCHTML) > src/darcs.tex
293 # The following is to prevent both being generated simultaneously, which
294 # confuses texlive:
295 src/darcs_print.pdf: src/darcs_print.ps
296 src/darcs_print.tex: $(TEXSOURCES)
297 ./preproc darcs.lhs > src/darcs_print.tex
298 src/patch-theory.tex: $(TEXSOURCES) $(UNIT_FILES)
299 ./preproc Darcs/Patch/Properties.lhs > src/patch-theory.tex
301 website: doc/manual/darcs.ps doc/manual/patch-theory.pdf doc/manual/index.html doc/manual/bigpage.html \
302 darcs doc/index.html
304 doc/manual/index.html: src/darcs.tex src/gpl.tex doc/darcs.css
305 $(MAKEMANUAL)
306 cp -f doc/darcs.css doc/manual/darcs.css
308 doc/manual/bigpage.html: src/darcs.tex src/gpl.tex doc/darcs.css
309 ln -sf darcs.tex src/bigpage.tex
310 latex2html -split 0 -external_file darcs -prefix big \
311 -no_auto_link -dir doc/manual src/bigpage.tex
312 rm src/bigpage.tex
313 cp -f doc/darcs.css doc/manual/bigpage.css
315 doc/manual/darcs.ps: src/darcs_print.ps
316 cp src/darcs_print.ps doc/manual/darcs.ps
317 doc/manual/darcs.pdf: src/darcs_print.pdf
318 cp src/darcs_print.pdf doc/manual/darcs.pdf
319 doc/manual/patch-theory.pdf: src/patch-theory.pdf
320 cp src/patch-theory.pdf doc/manual/
322 doc/darcs.1: darcsman
323 ./darcsman > $@
325 AUTHORS: list_authors
326 ./list_authors > AUTHORS
328 ChangeLog: make_changelog changelog.in/ChangeLog.old $(wildcard changelog.in/entries/*)
330 set -e; \
331 echo; \
332 rm -f changelog.in/entries/*~; \
333 ./make_changelog $(wildcard changelog.in/entries/*); \
334 echo; \
335 sed -n '/^darcs (1\.0\.2)$$/,$$p' changelog.in/ChangeLog.old; \
336 ) > $@.tmp
337 mv $@.tmp $@
339 test check: \
340 test_shell_hashed test_shell test_shell_format2 \
341 test_perl test_perl_hashed test_perl_format2 \
342 bugs
344 bugs: bugs_shell_hashed bugs_shell bugs_shell_format2 \
345 bugs_perl bugs_perl_hashed bugs_perl_format2
347 TEST_FILTER_FILE := tests_to_run
348 PERL_HARNESS := perl ../tests/bin/prove --nocolor
349 SHELL_HARNESS := perl ../tests/shell_harness
351 # $1 - description
352 # $2 - setup
353 # $3 - discard
354 # $4 - type
355 # $5 - extension
356 # $6 - harness
357 define harness
358 @echo Running $4 tests on $1 repositories...
359 @chmod -R u+rwx tests-$4-$1.dir || true
360 @rm -rf tests-$4-$1.dir && cp -R tests tests-$4-$1.dir
361 @cd tests-$4-$1.dir && rm -rf .darcs; mkdir .darcs;\
362 $2;\
363 if [ -r $(TEST_FILTER_FILE) ];\
364 then grep "\.$5" $(TEST_FILTER_FILE) | grep -v '^#' | $3 | xargs $6; \
365 else ls *.$5 | sort -r | $3 | xargs $6; fi
366 @echo Done running tests on $1 repositories...
367 endef
369 define bug_harness
370 @echo Demonstrating $4 bugs on $1 repositories...
371 @rm -rf bugs-$4-$1.dir && cp -R bugs bugs-$4-$1.dir
372 @cd bugs-$4-$1.dir && rm -rf .darcs; mkdir .darcs;\
373 $2;\
374 if [ -r $(TEST_FILTER_FILE) ];\
375 then bugs=1 grep "\.$5" $(TEST_FILTER_FILE) | grep -v '^#' | $3 | xargs $6 || true; \
376 else bugs=1 ls *.$5 | sort -r | $3 | xargs $6 || true; fi
377 @echo Done demonstrating bugs on $1 repositories...
378 endef
380 # $1 - description
381 # $2 - setup
382 # $3 - discard
383 shell_harness=$(call harness,$1,$2,$3,shell,sh,$(SHELL_HARNESS))
384 perl_harness=$(call harness,$1,$2,$3,perl,pl,$(PERL_HARNESS))
385 shell_bugs=$(call bug_harness,$1,$2,$3,shell,sh,$(SHELL_HARNESS))
386 perl_bugs=$(call bug_harness,$1,$2,$3,perl,pl,$(PERL_HARNESS))
388 test_network: darcs
389 @echo Running network tests ...
390 @rm -rf tests-network.dir && cp -R tests/network tests-network.dir
391 @cd tests-network.dir && rm -rf .darcs; mkdir .darcs;\
392 if [ -r $(TEST_FILTER_FILE) ];\
393 then bugs=1 grep "\.sh" $(TEST_FILTER_FILE) | grep -v '^#' | xargs $(SHELL_HARNESS); \
394 else bugs=1 ls *.sh | sort -r | xargs $(SHELL_HARNESS); fi
395 @echo Passed network tests.
397 test_shell: darcs
398 $(call shell_harness,old-fashioned,:,cat)
400 # for the format2 tests, we skip the hashed_inventory.sh test, since explicitly
401 # creates the old-fashioned format that's incompatible with darcs-2.
402 test_shell_format2: darcs
403 $(call shell_harness,darcs-2,\
404 echo ALL --darcs-2 >> .darcs/defaults,\
405 grep -v hashed_inventory.sh)
407 test_shell_hashed: darcs
408 $(call shell_harness,hashed,\
409 echo ALL --hashed >> .darcs/defaults,cat)
411 # skip test known to fail on this repo format
412 test_perl: darcs
413 $(call perl_harness,old-fashioned,:,cat)
415 test_perl_format2: darcs
416 $(call perl_harness,darcs-2,\
417 echo ALL --darcs-2 >> .darcs/defaults,cat)
419 test_perl_hashed: darcs
420 $(call perl_harness,hashed,\
421 echo ALL --hashed >> .darcs/defaults,grep -v conflict-doppleganger.pl)
423 bugs_shell: darcs
424 $(call shell_bugs,old-fashioned,:,cat)
426 bugs_shell_format2: darcs
427 $(call shell_bugs,format-2,\
428 echo ALL --darcs-2 >> .darcs/defaults,\
429 grep -v hashed_inventory.sh)
431 bugs_shell_hashed: darcs
432 $(call shell_bugs,hashed,\
433 echo ALL --hashed >> .darcs/defaults,cat)
435 bugs_perl: darcs
436 $(call perl_bugs,old-fashioned,:,cat)
438 bugs_perl_format2: darcs
439 $(call perl_bugs,darcs-2,\
440 echo ALL --darcs-2 >> .darcs/defaults,cat)
442 bugs_perl_hashed: darcs
443 $(call perl_bugs,hashed,\
444 echo ALL --hashed >> .darcs/defaults,cat)
446 test_unit: darcs unit
447 ./unit
449 register:
451 clean:
452 rm -f $(foreach dir,$(SRC_DIRS),$(dir)/*.o $(dir)/*.hi)
453 rm -f unit diff darcs darcs_cgi
454 rm -f stringify
455 rm -f src/darcs.tex src/darcs.dvi src/darcs.aux
456 rm -f src/patch-theory.tex src/patch-theory.aux src/patch-theory.log
457 rm -f src/patch-theory.aux src/patch-theory.toc
458 rm -f src/darcs_print.tex src/darcs_print.log src/darcs_print.aux src/darcs_print.toc
459 rm -f preproc darcsman
460 rm -rf tests/temp* darcs.log darcs.toc
461 rm -f conftest* .depend.bak
462 rm -f src/win32/System/Posix/IO.hs src/win32/System/Posix/Files.hs
463 rm -f version.nsi
464 rm -f list_authors make_changelog
465 rm -rf api-doc
466 #only remove src/Context.hs if we have a darcs inventory to rebuild it from
467 if test -f _darcs/inventory; then rm -f src/Context.hs; fi
468 rm -f TAGS tags
469 rm -f git-darcs-import
471 distclean: clean
472 rm -rf config.status config.log autoconf.mk config.cache autom4te.cache
473 rm -f doc/manual/darcs.ps doc/manual/darcs.pdf doc/manual/patch-theory.pdf src/Autoconf.lhs Workaround.hs darcs.idv
474 rm -f src/ThisVersion.lhs tools/cgi/README tools/cgi/darcs.cgi tools/cgi/cgi.conf
475 rm -f config.command
477 maintainer-clean: distclean
478 @echo 'This command is intended for maintainers to use; it'
479 @echo 'deletes files that may need special tools to rebuild.'
480 rm -f configure doc/darcs.1 .depend AUTHORS ChangeLog
481 rm -f src/Context.hs
482 rm -f doc/manual/*.html doc/manual/darcs*.??? doc/manual/darcs.lg
483 rm -f doc/manual/darcs.xref c_context.c doc/darcs_print.ps
484 rm -rf tests/test_output
486 configure: configure.ac aclocal.m4
487 autoconf
489 autoconf.mk src/Autoconf.lhs tools/cgi/darcs.cgi : \
490 config.status autoconf.mk.in src/Autoconf.lhs.in tools/cgi/darcs.cgi.in
491 ./config.status
493 config.status: configure
494 @if test -x config.status; then \
495 ./config.status --recheck; \
496 else \
497 echo >&2 "Please run ./configure to setup the build system."; \
498 exit 1; \
501 .depend: $(DARCS_FILES) $(UNIT_FILES)
502 @echo Rebuild dependencies ...
503 @$(GHC) $(GHCFLAGS) -M -optdep-f -optdep.depend $^
505 .depend: autoconf.mk
507 ifeq (,$(findstring clean,$(MAKECMDGOALS)))
508 ifneq (config,$(MAKECMDGOALS))
509 include .depend
510 endif
511 endif
513 ETAGS = hasktags -e
514 CTAGS = hasktags -c
515 # This follows what autoconf does.
516 # Fixme: Generate correct list of .c files and depend on that.
517 .PHONY: CTAGS ctags tags
518 tags: TAGS
519 TAGS: $(DARCS_FILES)
520 $(ETAGS) $(DARCS_FILES) && etags -a src/*.c
521 ctags: CTAGS
522 CTAGS: $(DARCS_FILES)
523 $(CTAGS) $(DARCS_FILES) && ctags -a src/*.c
524 mv tags tags.unsorted
525 sort tags.unsorted > tags