Makefile
author Martin Geisler <mg@lazybytes.net>
Thu, 21 May 2009 23:43:13 +0200
changeset 8542 de150a942ec8
parent 8365 94e91205d9b6
child 8625 34754aa62cd8
permissions -rw-r--r--
i18n: accurately generate hg.pot
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2233
3840cefa5222 Added install target.
wilde@trapperkeeper.sha-bang.de
parents: 2207
diff changeset
     1
PREFIX=/usr/local
3840cefa5222 Added install target.
wilde@trapperkeeper.sha-bang.de
parents: 2207
diff changeset
     2
export PREFIX
1008
85272e96b96a Add Makefile for generating release tarballs.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     3
PYTHON=python
7706
0ae7f0b312ea use PURE option in Makefile
Martin Geisler <mg@daimi.au.dk>
parents: 7687
diff changeset
     4
PURE=
7893
606723f4a327 enhance Makefile for language translators
Tobias Bell <tobias.bell@gmail.com>
parents: 7791
diff changeset
     5
PYTHON_FILES:=$(shell find mercurial hgext doc -name '*.py')
1008
85272e96b96a Add Makefile for generating release tarballs.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     6
2244
76be4e66ddc8 Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2235
diff changeset
     7
help:
76be4e66ddc8 Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2235
diff changeset
     8
	@echo 'Commonly used make targets:'
76be4e66ddc8 Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2235
diff changeset
     9
	@echo '  all          - build program and documentation'
76be4e66ddc8 Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2235
diff changeset
    10
	@echo '  install      - install program and man pages to PREFIX ($(PREFIX))'
76be4e66ddc8 Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2235
diff changeset
    11
	@echo '  install-home - install with setup.py install --home=HOME ($(HOME))'
4706
f0aa759b8f93 Makefile: change "make local" to build a fully working local version.
Markus F.X.J. Oberhumer <markus@oberhumer.com>
parents: 3969
diff changeset
    12
	@echo '  local        - build for inplace usage'
2244
76be4e66ddc8 Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2235
diff changeset
    13
	@echo '  tests        - run all tests in the automatic test suite'
76be4e66ddc8 Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2235
diff changeset
    14
	@echo '  test-foo     - run only specified tests (e.g. test-merge1)'
76be4e66ddc8 Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2235
diff changeset
    15
	@echo '  dist         - run all tests and create a source tarball in dist/'
76be4e66ddc8 Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2235
diff changeset
    16
	@echo '  clean        - remove files created by other targets'
76be4e66ddc8 Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2235
diff changeset
    17
	@echo '                 (except installed files or dist source tarball)'
7648
02e358a3a8a7 i18n: let Makefile generate i18n/hg.pot
Martin Geisler <mg@daimi.au.dk>
parents: 4707
diff changeset
    18
	@echo '  update-pot   - update i18n/hg.pot'
2244
76be4e66ddc8 Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2235
diff changeset
    19
	@echo
76be4e66ddc8 Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2235
diff changeset
    20
	@echo 'Example for a system-wide installation under /usr/local:'
76be4e66ddc8 Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2235
diff changeset
    21
	@echo '  make all && su -c "make install" && hg version'
76be4e66ddc8 Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2235
diff changeset
    22
	@echo
76be4e66ddc8 Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2235
diff changeset
    23
	@echo 'Example for a local installation (usable in this directory):'
76be4e66ddc8 Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2235
diff changeset
    24
	@echo '  make local && ./hg version'
76be4e66ddc8 Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2235
diff changeset
    25
76be4e66ddc8 Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2235
diff changeset
    26
all: build doc
2235
457e4247315d New make targets:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2234
diff changeset
    27
457e4247315d New make targets:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2234
diff changeset
    28
local:
7706
0ae7f0b312ea use PURE option in Makefile
Martin Geisler <mg@daimi.au.dk>
parents: 7687
diff changeset
    29
	$(PYTHON) setup.py $(PURE) build_py -c -d . build_ext -i build_mo
4706
f0aa759b8f93 Makefile: change "make local" to build a fully working local version.
Markus F.X.J. Oberhumer <markus@oberhumer.com>
parents: 3969
diff changeset
    30
	$(PYTHON) hg version
1020
f1b052db3515 Add default make rule
mpm@selenic.com
parents: 1008
diff changeset
    31
2235
457e4247315d New make targets:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2234
diff changeset
    32
build:
7706
0ae7f0b312ea use PURE option in Makefile
Martin Geisler <mg@daimi.au.dk>
parents: 7687
diff changeset
    33
	$(PYTHON) setup.py $(PURE) build
2235
457e4247315d New make targets:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2234
diff changeset
    34
457e4247315d New make targets:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2234
diff changeset
    35
doc:
457e4247315d New make targets:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2234
diff changeset
    36
	$(MAKE) -C doc
1008
85272e96b96a Add Makefile for generating release tarballs.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    37
85272e96b96a Add Makefile for generating release tarballs.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    38
clean:
8365
94e91205d9b6 Makefile: fix grammar in comment
Greg Ward <greg-hg@gerg.ca>
parents: 8273
diff changeset
    39
	-$(PYTHON) setup.py clean --all # ignore errors from this command
4707
3fd4dde37628 Makefile: remove *.pyd files on "make clean".
Markus F.X.J. Oberhumer <markus@oberhumer.com>
parents: 4706
diff changeset
    40
	find . -name '*.py[cdo]' -exec rm -f '{}' ';'
2244
76be4e66ddc8 Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2235
diff changeset
    41
	rm -f MANIFEST mercurial/__version__.py mercurial/*.so tests/*.err
7791
089cb73f8ecc Makefile: remove locale folder during clean
Brodie Rao <me+hg@dackz.net>
parents: 7710
diff changeset
    42
	rm -rf locale
1423
76239f0cb0dc Use $(MAKE) not make
levon@movementarian.org
parents: 1020
diff changeset
    43
	$(MAKE) -C doc clean
1008
85272e96b96a Add Makefile for generating release tarballs.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    44
2527
c51fad25e59e Split installation targets into install-bin and install-doc.
Sascha Wilde <wilde@sha-bang.de>
parents: 2244
diff changeset
    45
install: install-bin install-doc
c51fad25e59e Split installation targets into install-bin and install-doc.
Sascha Wilde <wilde@sha-bang.de>
parents: 2244
diff changeset
    46
c51fad25e59e Split installation targets into install-bin and install-doc.
Sascha Wilde <wilde@sha-bang.de>
parents: 2244
diff changeset
    47
install-bin: build
7706
0ae7f0b312ea use PURE option in Makefile
Martin Geisler <mg@daimi.au.dk>
parents: 7687
diff changeset
    48
	$(PYTHON) setup.py $(PURE) install --prefix="$(PREFIX)" --force
2527
c51fad25e59e Split installation targets into install-bin and install-doc.
Sascha Wilde <wilde@sha-bang.de>
parents: 2244
diff changeset
    49
c51fad25e59e Split installation targets into install-bin and install-doc.
Sascha Wilde <wilde@sha-bang.de>
parents: 2244
diff changeset
    50
install-doc: doc
2235
457e4247315d New make targets:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2234
diff changeset
    51
	cd doc && $(MAKE) $(MFLAGS) install
457e4247315d New make targets:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2234
diff changeset
    52
2527
c51fad25e59e Split installation targets into install-bin and install-doc.
Sascha Wilde <wilde@sha-bang.de>
parents: 2244
diff changeset
    53
install-home: install-home-bin install-home-doc
c51fad25e59e Split installation targets into install-bin and install-doc.
Sascha Wilde <wilde@sha-bang.de>
parents: 2244
diff changeset
    54
c51fad25e59e Split installation targets into install-bin and install-doc.
Sascha Wilde <wilde@sha-bang.de>
parents: 2244
diff changeset
    55
install-home-bin: build
7706
0ae7f0b312ea use PURE option in Makefile
Martin Geisler <mg@daimi.au.dk>
parents: 7687
diff changeset
    56
	$(PYTHON) setup.py $(PURE) install --home="$(HOME)" --force
2527
c51fad25e59e Split installation targets into install-bin and install-doc.
Sascha Wilde <wilde@sha-bang.de>
parents: 2244
diff changeset
    57
c51fad25e59e Split installation targets into install-bin and install-doc.
Sascha Wilde <wilde@sha-bang.de>
parents: 2244
diff changeset
    58
install-home-doc: doc
2235
457e4247315d New make targets:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2234
diff changeset
    59
	cd doc && $(MAKE) $(MFLAGS) PREFIX="$(HOME)" install
457e4247315d New make targets:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2234
diff changeset
    60
3872
9d7ac8613340 fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3865
diff changeset
    61
MANIFEST-doc:
9d7ac8613340 fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3865
diff changeset
    62
	$(MAKE) -C doc MANIFEST
9d7ac8613340 fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3865
diff changeset
    63
9d7ac8613340 fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3865
diff changeset
    64
MANIFEST: MANIFEST-doc
9d7ac8613340 fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3865
diff changeset
    65
	hg manifest > MANIFEST
9d7ac8613340 fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3865
diff changeset
    66
	echo mercurial/__version__.py >> MANIFEST
9d7ac8613340 fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3865
diff changeset
    67
	cat doc/MANIFEST >> MANIFEST
9d7ac8613340 fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3865
diff changeset
    68
2234
9ea93ff67a73 New make target "dist-notests" to create tarballs without running tests first.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2233
diff changeset
    69
dist:	tests dist-notests
9ea93ff67a73 New make target "dist-notests" to create tarballs without running tests first.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2233
diff changeset
    70
3872
9d7ac8613340 fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3865
diff changeset
    71
dist-notests:	doc MANIFEST
3865
36a957364b1b Make make dist a bit quieter
Matt Mackall <mpm@selenic.com>
parents: 3864
diff changeset
    72
	TAR_OPTIONS="--owner=root --group=root --mode=u+w,go-w,a+rX-s" $(PYTHON) setup.py -q sdist
1008
85272e96b96a Add Makefile for generating release tarballs.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    73
85272e96b96a Add Makefile for generating release tarballs.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    74
tests:
3969
edaf68032a27 add possibility to pass flags when testing with the Makefile
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3872
diff changeset
    75
	cd tests && $(PYTHON) run-tests.py $(TESTFLAGS)
1008
85272e96b96a Add Makefile for generating release tarballs.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    76
1426
e84c69b43cdb add a target for running only one test
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1423
diff changeset
    77
test-%:
3969
edaf68032a27 add possibility to pass flags when testing with the Makefile
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3872
diff changeset
    78
	cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) $@
1426
e84c69b43cdb add a target for running only one test
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1423
diff changeset
    79
7893
606723f4a327 enhance Makefile for language translators
Tobias Bell <tobias.bell@gmail.com>
parents: 7791
diff changeset
    80
update-pot: i18n/hg.pot
606723f4a327 enhance Makefile for language translators
Tobias Bell <tobias.bell@gmail.com>
parents: 7791
diff changeset
    81
606723f4a327 enhance Makefile for language translators
Tobias Bell <tobias.bell@gmail.com>
parents: 7791
diff changeset
    82
i18n/hg.pot: $(PYTHON_FILES)
7648
02e358a3a8a7 i18n: let Makefile generate i18n/hg.pot
Martin Geisler <mg@daimi.au.dk>
parents: 4707
diff changeset
    83
	mkdir -p i18n
8542
de150a942ec8 i18n: accurately generate hg.pot
Martin Geisler <mg@lazybytes.net>
parents: 8365
diff changeset
    84
	$(PYTHON) i18n/hggettext mercurial/commands.py \
de150a942ec8 i18n: accurately generate hg.pot
Martin Geisler <mg@lazybytes.net>
parents: 8365
diff changeset
    85
	  hgext/*.py hgext/*/__init__.py > i18n/hg.pot
7710
88326ee85a1b i18n: extract strings with xgettext
Martin Geisler <mg@daimi.au.dk>
parents: 7706
diff changeset
    86
        # All strings marked for translation in Mercurial contain
88326ee85a1b i18n: extract strings with xgettext
Martin Geisler <mg@daimi.au.dk>
parents: 7706
diff changeset
    87
        # ASCII characters only. But some files contain string
88326ee85a1b i18n: extract strings with xgettext
Martin Geisler <mg@daimi.au.dk>
parents: 7706
diff changeset
    88
        # literals like this '\037\213'. xgettext thinks it has to
8273
a9c1172a025e Makefile: fixed comment
Martin Geisler <mg@lazybytes.net>
parents: 8272
diff changeset
    89
        # parse them even though they are not marked for translation.
a9c1172a025e Makefile: fixed comment
Martin Geisler <mg@lazybytes.net>
parents: 8272
diff changeset
    90
        # Extracting with an explicit encoding of ISO-8859-1 will make
a9c1172a025e Makefile: fixed comment
Martin Geisler <mg@lazybytes.net>
parents: 8272
diff changeset
    91
        # xgettext "parse" and ignore them.
7893
606723f4a327 enhance Makefile for language translators
Tobias Bell <tobias.bell@gmail.com>
parents: 7791
diff changeset
    92
	echo $^ | xargs \
8272
79983cfa7efe Makefile: add more meta data to hg.pot
Martin Geisler <mg@lazybytes.net>
parents: 7893
diff changeset
    93
	  xgettext --package-name "Mercurial" \
79983cfa7efe Makefile: add more meta data to hg.pot
Martin Geisler <mg@lazybytes.net>
parents: 7893
diff changeset
    94
	  --msgid-bugs-address "<mercurial-devel@selenic.com>" \
79983cfa7efe Makefile: add more meta data to hg.pot
Martin Geisler <mg@lazybytes.net>
parents: 7893
diff changeset
    95
	  --copyright-holder "Matt Mackall <mpm@selenic.com> and others" \
79983cfa7efe Makefile: add more meta data to hg.pot
Martin Geisler <mg@lazybytes.net>
parents: 7893
diff changeset
    96
	  --from-code ISO-8859-1 --join --sort-by-file \
7710
88326ee85a1b i18n: extract strings with xgettext
Martin Geisler <mg@daimi.au.dk>
parents: 7706
diff changeset
    97
	  -d hg -p i18n -o hg.pot
1008
85272e96b96a Add Makefile for generating release tarballs.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    98
7893
606723f4a327 enhance Makefile for language translators
Tobias Bell <tobias.bell@gmail.com>
parents: 7791
diff changeset
    99
%.po: i18n/hg.pot
606723f4a327 enhance Makefile for language translators
Tobias Bell <tobias.bell@gmail.com>
parents: 7791
diff changeset
   100
	msgmerge --no-location --update $@ $^
606723f4a327 enhance Makefile for language translators
Tobias Bell <tobias.bell@gmail.com>
parents: 7791
diff changeset
   101
2527
c51fad25e59e Split installation targets into install-bin and install-doc.
Sascha Wilde <wilde@sha-bang.de>
parents: 2244
diff changeset
   102
.PHONY: help all local build doc clean install install-bin install-doc \
7648
02e358a3a8a7 i18n: let Makefile generate i18n/hg.pot
Martin Geisler <mg@daimi.au.dk>
parents: 4707
diff changeset
   103
	install-home install-home-bin install-home-doc dist dist-notests tests \
02e358a3a8a7 i18n: let Makefile generate i18n/hg.pot
Martin Geisler <mg@daimi.au.dk>
parents: 4707
diff changeset
   104
	update-pot