Makefile
author Augie Fackler <augie@google.com>
Thu, 21 Apr 2016 10:05:14 -0400
branchstable
changeset 29003 c6b108555dfa
parent 28995 8b6b6513c09f
child 29004 145cdc45b0df
permissions -rw-r--r--
make: alter how we compute compiler flags for setup.py This is portable between BSD and GNU make. I'm not thrilled with how it worked out, but it's portable and solves the problem.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10134
821793e3049c Makefile: added instructions on how to override PREFIX
Martin Geisler <mg@lazybytes.net>
parents: 10073
diff changeset
     1
# If you want to change PREFIX, do not just edit it below. The changed
821793e3049c Makefile: added instructions on how to override PREFIX
Martin Geisler <mg@lazybytes.net>
parents: 10073
diff changeset
     2
# value wont get passed on to recursive make calls. You should instead
821793e3049c Makefile: added instructions on how to override PREFIX
Martin Geisler <mg@lazybytes.net>
parents: 10073
diff changeset
     3
# override the variable on the command like:
821793e3049c Makefile: added instructions on how to override PREFIX
Martin Geisler <mg@lazybytes.net>
parents: 10073
diff changeset
     4
#
821793e3049c Makefile: added instructions on how to override PREFIX
Martin Geisler <mg@lazybytes.net>
parents: 10073
diff changeset
     5
# % make PREFIX=/opt/ install
821793e3049c Makefile: added instructions on how to override PREFIX
Martin Geisler <mg@lazybytes.net>
parents: 10073
diff changeset
     6
2233
3840cefa5222 Added install target.
wilde@trapperkeeper.sha-bang.de
parents: 2207
diff changeset
     7
PREFIX=/usr/local
3840cefa5222 Added install target.
wilde@trapperkeeper.sha-bang.de
parents: 2207
diff changeset
     8
export PREFIX
1008
85272e96b96a Add Makefile for generating release tarballs.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     9
PYTHON=python
24194
00809c43d72c Makefile: introduce testpy-% target for testing with a specifc Python
Augie Fackler <augie@google.com>
parents: 23940
diff changeset
    10
$(eval HGROOT := $(shell pwd))
00809c43d72c Makefile: introduce testpy-% target for testing with a specifc Python
Augie Fackler <augie@google.com>
parents: 23940
diff changeset
    11
HGPYTHONS ?= $(HGROOT)/build/pythons
7706
0ae7f0b312ea use PURE option in Makefile
Martin Geisler <mg@daimi.au.dk>
parents: 7687
diff changeset
    12
PURE=
12816
61c73c9dce1d Makefile: remove underscore in var name
Martin Geisler <mg@lazybytes.net>
parents: 12806
diff changeset
    13
PYFILES:=$(shell find mercurial hgext doc -name '*.py')
12817
372370923b30 Makefile: var for documentation files
Martin Geisler <mg@lazybytes.net>
parents: 12816
diff changeset
    14
DOCFILES=mercurial/help/*.txt
19427
80983af366b5 doc: make i18n man and html
Takumi IINO <trot.thunder@gmail.com>
parents: 18598
diff changeset
    15
export LANGUAGE=C
80983af366b5 doc: make i18n man and html
Takumi IINO <trot.thunder@gmail.com>
parents: 18598
diff changeset
    16
export LC_ALL=C
24195
250d9cf97fb3 Makefile: allow setting HGTESTFLAGS in shell environment for TESTFLAGS
Augie Fackler <augie@google.com>
parents: 24194
diff changeset
    17
TESTFLAGS ?= $(shell echo $$HGTESTFLAGS)
1008
85272e96b96a Add Makefile for generating release tarballs.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    18
18056
7c9b07f0da73 makefile: allow local builds to work on windows/mingw32
Bryan O'Sullivan <bryano@fb.com>
parents: 17927
diff changeset
    19
# Set this to e.g. "mingw32" to use a non-default compiler.
7c9b07f0da73 makefile: allow local builds to work on windows/mingw32
Bryan O'Sullivan <bryano@fb.com>
parents: 17927
diff changeset
    20
COMPILER=
7c9b07f0da73 makefile: allow local builds to work on windows/mingw32
Bryan O'Sullivan <bryano@fb.com>
parents: 17927
diff changeset
    21
29003
c6b108555dfa make: alter how we compute compiler flags for setup.py
Augie Fackler <augie@google.com>
parents: 28995
diff changeset
    22
COMPILERFLAG_tmp_ =
c6b108555dfa make: alter how we compute compiler flags for setup.py
Augie Fackler <augie@google.com>
parents: 28995
diff changeset
    23
COMPILERFLAG_tmp_${COMPILER} ?= -c $(COMPILER)
c6b108555dfa make: alter how we compute compiler flags for setup.py
Augie Fackler <augie@google.com>
parents: 28995
diff changeset
    24
COMPILERFLAG=${COMPILERFLAG_tmp_${COMPILER}}
c6b108555dfa make: alter how we compute compiler flags for setup.py
Augie Fackler <augie@google.com>
parents: 28995
diff changeset
    25
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
    26
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
    27
	@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
    28
	@echo '  all          - build program and documentation'
20311
8824009d2704 makefile: add $ to environment variables in help message
Matt Mackall <mpm@selenic.com>
parents: 20121
diff changeset
    29
	@echo '  install      - install program and man pages to $$PREFIX ($(PREFIX))'
8824009d2704 makefile: add $ to environment variables in help message
Matt Mackall <mpm@selenic.com>
parents: 20121
diff changeset
    30
	@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
    31
	@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
    32
	@echo '  tests        - run all tests in the automatic test suite'
15379
3ca419fb435e Makefile: adjust example, test-merge1 is now test-merge1.t
Thomas Arendsen Hein <thomas@intevation.de>
parents: 14815
diff changeset
    33
	@echo '  test-foo     - run only specified tests (e.g. test-merge1.t)'
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
    34
	@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
    35
	@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
    36
	@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
    37
	@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
    38
	@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
    39
	@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
    40
	@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
    41
	@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
    42
	@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
    43
	@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
    44
76be4e66ddc8 Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2235
diff changeset
    45
all: build doc
2235
457e4247315d New make targets:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2234
diff changeset
    46
457e4247315d New make targets:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2234
diff changeset
    47
local:
18056
7c9b07f0da73 makefile: allow local builds to work on windows/mingw32
Bryan O'Sullivan <bryano@fb.com>
parents: 17927
diff changeset
    48
	$(PYTHON) setup.py $(PURE) \
7c9b07f0da73 makefile: allow local builds to work on windows/mingw32
Bryan O'Sullivan <bryano@fb.com>
parents: 17927
diff changeset
    49
	  build_py -c -d . \
29003
c6b108555dfa make: alter how we compute compiler flags for setup.py
Augie Fackler <augie@google.com>
parents: 28995
diff changeset
    50
	  build_ext $(COMPILERFLAG) -i \
c6b108555dfa make: alter how we compute compiler flags for setup.py
Augie Fackler <augie@google.com>
parents: 28995
diff changeset
    51
	  build_hgexe $(COMPILERFLAG) -i \
18056
7c9b07f0da73 makefile: allow local builds to work on windows/mingw32
Bryan O'Sullivan <bryano@fb.com>
parents: 17927
diff changeset
    52
	  build_mo
17927
9796d5437e72 makefile: don't use system hgrc when running hg in-place
Bryan O'Sullivan <bryano@fb.com>
parents: 17062
diff changeset
    53
	env HGRCPATH= $(PYTHON) hg version
1020
f1b052db3515 Add default make rule
mpm@selenic.com
parents: 1008
diff changeset
    54
2235
457e4247315d New make targets:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2234
diff changeset
    55
build:
29003
c6b108555dfa make: alter how we compute compiler flags for setup.py
Augie Fackler <augie@google.com>
parents: 28995
diff changeset
    56
	$(PYTHON) setup.py $(PURE) build $(COMPILERFLAG)
2235
457e4247315d New make targets:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2234
diff changeset
    57
26601
c5c7c686d6a6 makefile: add wheel build target
Nathan Goldbaum <ngoldbau@ucsc.edu>
parents: 26108
diff changeset
    58
wheel:
29003
c6b108555dfa make: alter how we compute compiler flags for setup.py
Augie Fackler <augie@google.com>
parents: 28995
diff changeset
    59
	FORCE_SETUPTOOLS=1 $(PYTHON) setup.py $(PURE) bdist_wheel $(COMPILERFLAG)
26601
c5c7c686d6a6 makefile: add wheel build target
Nathan Goldbaum <ngoldbau@ucsc.edu>
parents: 26108
diff changeset
    60
2235
457e4247315d New make targets:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2234
diff changeset
    61
doc:
457e4247315d New make targets:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2234
diff changeset
    62
	$(MAKE) -C doc
1008
85272e96b96a Add Makefile for generating release tarballs.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    63
85272e96b96a Add Makefile for generating release tarballs.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    64
clean:
8365
94e91205d9b6 Makefile: fix grammar in comment
Greg Ward <greg-hg@gerg.ca>
parents: 8273
diff changeset
    65
	-$(PYTHON) setup.py clean --all # ignore errors from this command
28975
1828f13b13b1 make: add forgotten hgext3rd to clean rule
Sean Farley <sean@farley.io>
parents: 28974
diff changeset
    66
	find contrib doc hgext hgext3rd i18n mercurial tests \
20007
23edc6673f0d make: restrict recursion in make clean
Matt Mackall <mpm@selenic.com>
parents: 19991
diff changeset
    67
		\( -name '*.py[cdo]' -o -name '*.so' \) -exec rm -f '{}' ';'
16460
d9e2f09d5488 Makefile: be more careful when cleaning up pure/ components
Matt Mackall <mpm@selenic.com>
parents: 16126
diff changeset
    68
	rm -f $(addprefix mercurial/,$(notdir $(wildcard mercurial/pure/[a-z]*.py)))
22375
308ab71207ff build: don't clean __version__.py on 'make clean' in release tarballs
J. Lewis Muir <jlmuir@anl.gov>
parents: 22358
diff changeset
    69
	rm -f MANIFEST MANIFEST.in hgext/__index__.py tests/*.err
28430
17b85d739b62 setup: create a module for the modulepolicy
timeless <timeless@mozdev.org>
parents: 27212
diff changeset
    70
	rm -f mercurial/__modulepolicy__.py
22375
308ab71207ff build: don't clean __version__.py on 'make clean' in release tarballs
J. Lewis Muir <jlmuir@anl.gov>
parents: 22358
diff changeset
    71
	if test -d .hg; then rm -f mercurial/__version__.py; fi
28976
9fb2e8c8f320 make: remove packages directory in clean rule
Sean Farley <sean@farley.io>
parents: 28975
diff changeset
    72
	rm -rf build packages mercurial/locale
1423
76239f0cb0dc Use $(MAKE) not make
levon@movementarian.org
parents: 1020
diff changeset
    73
	$(MAKE) -C doc clean
28974
ef5553fab197 make: add chg to clean rule
Sean Farley <sean@farley.io>
parents: 28457
diff changeset
    74
	$(MAKE) -C contrib/chg distclean
1008
85272e96b96a Add Makefile for generating release tarballs.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    75
2527
c51fad25e59e Split installation targets into install-bin and install-doc.
Sascha Wilde <wilde@sha-bang.de>
parents: 2244
diff changeset
    76
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
    77
c51fad25e59e Split installation targets into install-bin and install-doc.
Sascha Wilde <wilde@sha-bang.de>
parents: 2244
diff changeset
    78
install-bin: build
10961
ce6d56b95f2e Respect the DESTDIR variable during 'make install'
Dévai Tamás <devait@vnet.hu>
parents: 10134
diff changeset
    79
	$(PYTHON) setup.py $(PURE) install --root="$(DESTDIR)/" --prefix="$(PREFIX)" --force
2527
c51fad25e59e Split installation targets into install-bin and install-doc.
Sascha Wilde <wilde@sha-bang.de>
parents: 2244
diff changeset
    80
c51fad25e59e Split installation targets into install-bin and install-doc.
Sascha Wilde <wilde@sha-bang.de>
parents: 2244
diff changeset
    81
install-doc: doc
2235
457e4247315d New make targets:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2234
diff changeset
    82
	cd doc && $(MAKE) $(MFLAGS) install
457e4247315d New make targets:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2234
diff changeset
    83
2527
c51fad25e59e Split installation targets into install-bin and install-doc.
Sascha Wilde <wilde@sha-bang.de>
parents: 2244
diff changeset
    84
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
    85
c51fad25e59e Split installation targets into install-bin and install-doc.
Sascha Wilde <wilde@sha-bang.de>
parents: 2244
diff changeset
    86
install-home-bin: build
20614
1bc68ff4e0a2 setup: specify --prefix="" for install-home-bin to avoid badness with defaults
Augie Fackler <raf@durin42.com>
parents: 20358
diff changeset
    87
	$(PYTHON) setup.py $(PURE) install --home="$(HOME)" --prefix="" --force
2527
c51fad25e59e Split installation targets into install-bin and install-doc.
Sascha Wilde <wilde@sha-bang.de>
parents: 2244
diff changeset
    88
c51fad25e59e Split installation targets into install-bin and install-doc.
Sascha Wilde <wilde@sha-bang.de>
parents: 2244
diff changeset
    89
install-home-doc: doc
2235
457e4247315d New make targets:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2234
diff changeset
    90
	cd doc && $(MAKE) $(MFLAGS) PREFIX="$(HOME)" install
457e4247315d New make targets:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2234
diff changeset
    91
3872
9d7ac8613340 fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3865
diff changeset
    92
MANIFEST-doc:
9d7ac8613340 fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3865
diff changeset
    93
	$(MAKE) -C doc MANIFEST
9d7ac8613340 fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3865
diff changeset
    94
14558
2ce7dfe17bc5 distutils: Create MANIFEST.in instead of MANIFEST in Makefile
Stephen Thorne <stephen@thorne.id.au>
parents: 14315
diff changeset
    95
MANIFEST.in: MANIFEST-doc
2ce7dfe17bc5 distutils: Create MANIFEST.in instead of MANIFEST in Makefile
Stephen Thorne <stephen@thorne.id.au>
parents: 14315
diff changeset
    96
	hg manifest | sed -e 's/^/include /' > MANIFEST.in
2ce7dfe17bc5 distutils: Create MANIFEST.in instead of MANIFEST in Makefile
Stephen Thorne <stephen@thorne.id.au>
parents: 14315
diff changeset
    97
	echo include mercurial/__version__.py >> MANIFEST.in
2ce7dfe17bc5 distutils: Create MANIFEST.in instead of MANIFEST in Makefile
Stephen Thorne <stephen@thorne.id.au>
parents: 14315
diff changeset
    98
	sed -e 's/^/include /' < doc/MANIFEST >> MANIFEST.in
3872
9d7ac8613340 fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3865
diff changeset
    99
2234
9ea93ff67a73 New make target "dist-notests" to create tarballs without running tests first.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2233
diff changeset
   100
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
   101
14558
2ce7dfe17bc5 distutils: Create MANIFEST.in instead of MANIFEST in Makefile
Stephen Thorne <stephen@thorne.id.au>
parents: 14315
diff changeset
   102
dist-notests:	doc MANIFEST.in
3865
36a957364b1b Make make dist a bit quieter
Matt Mackall <mpm@selenic.com>
parents: 3864
diff changeset
   103
	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
   104
14172
1a919c3271bf add make check: tests rule
Johan Euphrosine <proppy@google.com>
parents: 13101
diff changeset
   105
check: tests
1a919c3271bf add make check: tests rule
Johan Euphrosine <proppy@google.com>
parents: 13101
diff changeset
   106
1008
85272e96b96a Add Makefile for generating release tarballs.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
   107
tests:
3969
edaf68032a27 add possibility to pass flags when testing with the Makefile
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3872
diff changeset
   108
	cd tests && $(PYTHON) run-tests.py $(TESTFLAGS)
1008
85272e96b96a Add Makefile for generating release tarballs.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
   109
1426
e84c69b43cdb add a target for running only one test
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1423
diff changeset
   110
test-%:
3969
edaf68032a27 add possibility to pass flags when testing with the Makefile
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3872
diff changeset
   111
	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
   112
24194
00809c43d72c Makefile: introduce testpy-% target for testing with a specifc Python
Augie Fackler <augie@google.com>
parents: 23940
diff changeset
   113
testpy-%:
00809c43d72c Makefile: introduce testpy-% target for testing with a specifc Python
Augie Fackler <augie@google.com>
parents: 23940
diff changeset
   114
	@echo Looking for Python $* in $(HGPYTHONS)
00809c43d72c Makefile: introduce testpy-% target for testing with a specifc Python
Augie Fackler <augie@google.com>
parents: 23940
diff changeset
   115
	[ -e $(HGPYTHONS)/$*/bin/python ] || ( \
00809c43d72c Makefile: introduce testpy-% target for testing with a specifc Python
Augie Fackler <augie@google.com>
parents: 23940
diff changeset
   116
	cd $$(mktemp --directory --tmpdir) && \
00809c43d72c Makefile: introduce testpy-% target for testing with a specifc Python
Augie Fackler <augie@google.com>
parents: 23940
diff changeset
   117
        $(MAKE) -f $(HGROOT)/contrib/Makefile.python PYTHONVER=$* PREFIX=$(HGPYTHONS)/$* python )
00809c43d72c Makefile: introduce testpy-% target for testing with a specifc Python
Augie Fackler <augie@google.com>
parents: 23940
diff changeset
   118
	cd tests && $(HGPYTHONS)/$*/bin/python run-tests.py $(TESTFLAGS)
00809c43d72c Makefile: introduce testpy-% target for testing with a specifc Python
Augie Fackler <augie@google.com>
parents: 23940
diff changeset
   119
18598
4723ccb62282 check-code: add Makefile target to run check-code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 18056
diff changeset
   120
check-code:
4723ccb62282 check-code: add Makefile target to run check-code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 18056
diff changeset
   121
	hg manifest | xargs python contrib/check-code.py
4723ccb62282 check-code: add Makefile target to run check-code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 18056
diff changeset
   122
7893
606723f4a327 enhance Makefile for language translators
Tobias Bell <tobias.bell@gmail.com>
parents: 7791
diff changeset
   123
update-pot: i18n/hg.pot
606723f4a327 enhance Makefile for language translators
Tobias Bell <tobias.bell@gmail.com>
parents: 7791
diff changeset
   124
20358
4276c906d90e Makefile: hg.pot depends on the scripts generating it
Simon Heimberg <simohe@besonet.ch>
parents: 20311
diff changeset
   125
i18n/hg.pot: $(PYFILES) $(DOCFILES) i18n/posplit i18n/hggettext
8542
de150a942ec8 i18n: accurately generate hg.pot
Martin Geisler <mg@lazybytes.net>
parents: 8365
diff changeset
   126
	$(PYTHON) i18n/hggettext mercurial/commands.py \
16126
0c4bec9596d8 filemerge: create detail of internal merge tools from documentation string
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 15379
diff changeset
   127
	  hgext/*.py hgext/*/__init__.py \
0c4bec9596d8 filemerge: create detail of internal merge tools from documentation string
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 15379
diff changeset
   128
	  mercurial/fileset.py mercurial/revset.py \
14815
5b7dc16b331b i18n-ru: translated missing strings for commands, some typos corrected
Alexander Sauta <demosito@gmail.com>
parents: 14705
diff changeset
   129
	  mercurial/templatefilters.py mercurial/templatekw.py \
24601
d80819f67d59 templater: tell hggettext to collect help of template functions
Yuya Nishihara <yuya@tcha.org>
parents: 24195
diff changeset
   130
	  mercurial/templater.py \
16126
0c4bec9596d8 filemerge: create detail of internal merge tools from documentation string
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 15379
diff changeset
   131
	  mercurial/filemerge.py \
24859
64e3f97bdf08 i18n: extract doc string of each web commands as translatable one
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 24601
diff changeset
   132
	  mercurial/hgweb/webcommands.py \
20121
2af9e1d40dc7 Makefile: temporary copy of hg.pot is hg.pot.tmp instead of hg.pot~
Simon Heimberg <simohe@besonet.ch>
parents: 20120
diff changeset
   133
	  $(DOCFILES) > i18n/hg.pot.tmp
7710
88326ee85a1b i18n: extract strings with xgettext
Martin Geisler <mg@daimi.au.dk>
parents: 7706
diff changeset
   134
        # All strings marked for translation in Mercurial contain
88326ee85a1b i18n: extract strings with xgettext
Martin Geisler <mg@daimi.au.dk>
parents: 7706
diff changeset
   135
        # ASCII characters only. But some files contain string
88326ee85a1b i18n: extract strings with xgettext
Martin Geisler <mg@daimi.au.dk>
parents: 7706
diff changeset
   136
        # literals like this '\037\213'. xgettext thinks it has to
8273
a9c1172a025e Makefile: fixed comment
Martin Geisler <mg@lazybytes.net>
parents: 8272
diff changeset
   137
        # parse them even though they are not marked for translation.
a9c1172a025e Makefile: fixed comment
Martin Geisler <mg@lazybytes.net>
parents: 8272
diff changeset
   138
        # Extracting with an explicit encoding of ISO-8859-1 will make
a9c1172a025e Makefile: fixed comment
Martin Geisler <mg@lazybytes.net>
parents: 8272
diff changeset
   139
        # xgettext "parse" and ignore them.
12816
61c73c9dce1d Makefile: remove underscore in var name
Martin Geisler <mg@lazybytes.net>
parents: 12806
diff changeset
   140
	echo $(PYFILES) | xargs \
9278
3d9f77c03105 Makefile: remove non-default wrapping of hg.pot strings
Martin Geisler <mg@lazybytes.net>
parents: 9079
diff changeset
   141
	  xgettext --package-name "Mercurial" \
8272
79983cfa7efe Makefile: add more meta data to hg.pot
Martin Geisler <mg@lazybytes.net>
parents: 7893
diff changeset
   142
	  --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
   143
	  --copyright-holder "Matt Mackall <mpm@selenic.com> and others" \
12806
57b9fd75b6f8 i18n: extract comments marked for translator hints
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 12500
diff changeset
   144
	  --from-code ISO-8859-1 --join --sort-by-file --add-comments=i18n: \
20121
2af9e1d40dc7 Makefile: temporary copy of hg.pot is hg.pot.tmp instead of hg.pot~
Simon Heimberg <simohe@besonet.ch>
parents: 20120
diff changeset
   145
	  -d hg -p i18n -o hg.pot.tmp
2af9e1d40dc7 Makefile: temporary copy of hg.pot is hg.pot.tmp instead of hg.pot~
Simon Heimberg <simohe@besonet.ch>
parents: 20120
diff changeset
   146
	$(PYTHON) i18n/posplit i18n/hg.pot.tmp
20080
c845b1a95eed Makefile: intermediate steps work with temporary copy of hg.pot
Simon Heimberg <simohe@besonet.ch>
parents: 20007
diff changeset
   147
        # The target file is not created before the last step. So it never is in
c845b1a95eed Makefile: intermediate steps work with temporary copy of hg.pot
Simon Heimberg <simohe@besonet.ch>
parents: 20007
diff changeset
   148
        # an intermediate state.
20121
2af9e1d40dc7 Makefile: temporary copy of hg.pot is hg.pot.tmp instead of hg.pot~
Simon Heimberg <simohe@besonet.ch>
parents: 20120
diff changeset
   149
	mv -f i18n/hg.pot.tmp i18n/hg.pot
1008
85272e96b96a Add Makefile for generating release tarballs.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
   150
7893
606723f4a327 enhance Makefile for language translators
Tobias Bell <tobias.bell@gmail.com>
parents: 7791
diff changeset
   151
%.po: i18n/hg.pot
19991
ce5d711475a3 Makefile: do update on a temporary copy of a po file
Simon Heimberg <simohe@besonet.ch>
parents: 19427
diff changeset
   152
        # work on a temporary copy for never having a half completed target
ce5d711475a3 Makefile: do update on a temporary copy of a po file
Simon Heimberg <simohe@besonet.ch>
parents: 19427
diff changeset
   153
	cp $@ $@.tmp
ce5d711475a3 Makefile: do update on a temporary copy of a po file
Simon Heimberg <simohe@besonet.ch>
parents: 19427
diff changeset
   154
	msgmerge --no-location --update $@.tmp $^
20120
872f81de2865 Makefile: fix po file updating by using same file name everywhere
Simon Heimberg <simohe@besonet.ch>
parents: 20080
diff changeset
   155
	mv -f $@.tmp $@
7893
606723f4a327 enhance Makefile for language translators
Tobias Bell <tobias.bell@gmail.com>
parents: 7791
diff changeset
   156
21255
62a2749895e4 build: initial support for in-tree autobuilding recipes
Matt Mackall <mpm@selenic.com>
parents: 21229
diff changeset
   157
# Packaging targets
62a2749895e4 build: initial support for in-tree autobuilding recipes
Matt Mackall <mpm@selenic.com>
parents: 21229
diff changeset
   158
21559
9a9de26ad99a make: add a basic osx mpkg target
Matt Mackall <mpm@selenic.com>
parents: 21255
diff changeset
   159
osx:
23932
d7a90949fc18 osx: use bdist_mpkg.script_bdist_mpkg module instead of bdist_mpkg command
Mads Kiilerich <madski@unity3d.com>
parents: 23931
diff changeset
   160
	python -c 'import bdist_mpkg.script_bdist_mpkg' || \
21559
9a9de26ad99a make: add a basic osx mpkg target
Matt Mackall <mpm@selenic.com>
parents: 21255
diff changeset
   161
	   (echo "Missing bdist_mpkg (easy_install bdist_mpkg)"; false)
22358
198e2da3ee20 osx: create dmg with installer instead of zip
Mads Kiilerich <madski@unity3d.com>
parents: 22308
diff changeset
   162
	rm -rf dist/mercurial-*.mpkg
23932
d7a90949fc18 osx: use bdist_mpkg.script_bdist_mpkg module instead of bdist_mpkg command
Mads Kiilerich <madski@unity3d.com>
parents: 23931
diff changeset
   163
	python -m bdist_mpkg.script_bdist_mpkg setup.py --
23940
d0ef40776999 osx: patch .pax.gz files in pkg bundles so they extract as root (issue4081)
Mads Kiilerich <madski@unity3d.com>
parents: 23932
diff changeset
   164
	python contrib/fixpax.py dist/mercurial-*.mpkg/Contents/Packages/*.pkg/Contents/Archive.pax.gz
21560
a9e1ab2da30d packaging: move output directory from build/ to packages/
Matt Mackall <mpm@selenic.com>
parents: 21559
diff changeset
   165
	mkdir -p packages/osx
22358
198e2da3ee20 osx: create dmg with installer instead of zip
Mads Kiilerich <madski@unity3d.com>
parents: 22308
diff changeset
   166
	N=`cd dist && echo mercurial-*.mpkg | sed 's,\.mpkg$$,,'` && hdiutil create -srcfolder dist/$$N.mpkg/ -scrub -volname "$$N" -ov packages/osx/$$N.dmg
21559
9a9de26ad99a make: add a basic osx mpkg target
Matt Mackall <mpm@selenic.com>
parents: 21255
diff changeset
   167
	rm -rf dist/mercurial-*.mpkg
9a9de26ad99a make: add a basic osx mpkg target
Matt Mackall <mpm@selenic.com>
parents: 21255
diff changeset
   168
26088
3375ae1e7d0b makefile: rename debian-jessie to deb
Augie Fackler <augie@google.com>
parents: 24973
diff changeset
   169
deb:
27212
ef9301ce6046 builddeb: read default distribution and codename from lsb_release
Anton Shestakov <av6@dwimlabs.net>
parents: 27210
diff changeset
   170
	contrib/builddeb
24971
ab75baaf81d5 builddeb: new script for building a deb package
Augie Fackler <augie@google.com>
parents: 24859
diff changeset
   171
28995
8b6b6513c09f make: add rule for building an ubuntu ppa
Sean Farley <sean@farley.io>
parents: 28976
diff changeset
   172
ppa:
8b6b6513c09f make: add rule for building an ubuntu ppa
Sean Farley <sean@farley.io>
parents: 28976
diff changeset
   173
	contrib/builddeb --source-only
8b6b6513c09f make: add rule for building an ubuntu ppa
Sean Farley <sean@farley.io>
parents: 28976
diff changeset
   174
24973
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents: 24971
diff changeset
   175
docker-debian-jessie:
26089
01d8db874abf docker-debian-jessie: fix errant mkdir
Augie Fackler <augie@google.com>
parents: 26088
diff changeset
   176
	mkdir -p packages/debian-jessie
27210
9b86d29867a5 builddeb: add --distid option to specify Distributor ID
Anton Shestakov <av6@dwimlabs.net>
parents: 27209
diff changeset
   177
	contrib/dockerdeb debian jessie
24973
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents: 24971
diff changeset
   178
28457
e6310cdcc4d0 dockerdeb: add Ubuntu Trusty
Anton Shestakov <av6@dwimlabs.net>
parents: 28430
diff changeset
   179
docker-ubuntu-trusty:
e6310cdcc4d0 dockerdeb: add Ubuntu Trusty
Anton Shestakov <av6@dwimlabs.net>
parents: 28430
diff changeset
   180
	mkdir -p packages/ubuntu-trusty
e6310cdcc4d0 dockerdeb: add Ubuntu Trusty
Anton Shestakov <av6@dwimlabs.net>
parents: 28430
diff changeset
   181
	contrib/dockerdeb ubuntu trusty
e6310cdcc4d0 dockerdeb: add Ubuntu Trusty
Anton Shestakov <av6@dwimlabs.net>
parents: 28430
diff changeset
   182
22442
77da9c03be60 docker: use stable tags for fedora and centos
Mads Kiilerich <madski@unity3d.com>
parents: 22375
diff changeset
   183
fedora20:
77da9c03be60 docker: use stable tags for fedora and centos
Mads Kiilerich <madski@unity3d.com>
parents: 22375
diff changeset
   184
	mkdir -p packages/fedora20
21640
4bfb721de6dd buildrpm: remove prompt for uncommitted changes - it was a bad idea
Mads Kiilerich <madski@unity3d.com>
parents: 21560
diff changeset
   185
	contrib/buildrpm
22442
77da9c03be60 docker: use stable tags for fedora and centos
Mads Kiilerich <madski@unity3d.com>
parents: 22375
diff changeset
   186
	cp rpmbuild/RPMS/*/* packages/fedora20
77da9c03be60 docker: use stable tags for fedora and centos
Mads Kiilerich <madski@unity3d.com>
parents: 22375
diff changeset
   187
	cp rpmbuild/SRPMS/* packages/fedora20
21255
62a2749895e4 build: initial support for in-tree autobuilding recipes
Matt Mackall <mpm@selenic.com>
parents: 21229
diff changeset
   188
	rm -rf rpmbuild
62a2749895e4 build: initial support for in-tree autobuilding recipes
Matt Mackall <mpm@selenic.com>
parents: 21229
diff changeset
   189
22442
77da9c03be60 docker: use stable tags for fedora and centos
Mads Kiilerich <madski@unity3d.com>
parents: 22375
diff changeset
   190
docker-fedora20:
77da9c03be60 docker: use stable tags for fedora and centos
Mads Kiilerich <madski@unity3d.com>
parents: 22375
diff changeset
   191
	mkdir -p packages/fedora20
77da9c03be60 docker: use stable tags for fedora and centos
Mads Kiilerich <madski@unity3d.com>
parents: 22375
diff changeset
   192
	contrib/dockerrpm fedora20
21255
62a2749895e4 build: initial support for in-tree autobuilding recipes
Matt Mackall <mpm@selenic.com>
parents: 21229
diff changeset
   193
23882
272b1cc3e83e docker: support Fedora 21
Mads Kiilerich <madski@unity3d.com>
parents: 23125
diff changeset
   194
fedora21:
272b1cc3e83e docker: support Fedora 21
Mads Kiilerich <madski@unity3d.com>
parents: 23125
diff changeset
   195
	mkdir -p packages/fedora21
272b1cc3e83e docker: support Fedora 21
Mads Kiilerich <madski@unity3d.com>
parents: 23125
diff changeset
   196
	contrib/buildrpm
272b1cc3e83e docker: support Fedora 21
Mads Kiilerich <madski@unity3d.com>
parents: 23125
diff changeset
   197
	cp rpmbuild/RPMS/*/* packages/fedora21
272b1cc3e83e docker: support Fedora 21
Mads Kiilerich <madski@unity3d.com>
parents: 23125
diff changeset
   198
	cp rpmbuild/SRPMS/* packages/fedora21
272b1cc3e83e docker: support Fedora 21
Mads Kiilerich <madski@unity3d.com>
parents: 23125
diff changeset
   199
	rm -rf rpmbuild
272b1cc3e83e docker: support Fedora 21
Mads Kiilerich <madski@unity3d.com>
parents: 23125
diff changeset
   200
272b1cc3e83e docker: support Fedora 21
Mads Kiilerich <madski@unity3d.com>
parents: 23125
diff changeset
   201
docker-fedora21:
272b1cc3e83e docker: support Fedora 21
Mads Kiilerich <madski@unity3d.com>
parents: 23125
diff changeset
   202
	mkdir -p packages/fedora21
272b1cc3e83e docker: support Fedora 21
Mads Kiilerich <madski@unity3d.com>
parents: 23125
diff changeset
   203
	contrib/dockerrpm fedora21
272b1cc3e83e docker: support Fedora 21
Mads Kiilerich <madski@unity3d.com>
parents: 23125
diff changeset
   204
22443
d8818616c45e docker: add CentOS 5
Mads Kiilerich <madski@unity3d.com>
parents: 22442
diff changeset
   205
centos5:
d8818616c45e docker: add CentOS 5
Mads Kiilerich <madski@unity3d.com>
parents: 22442
diff changeset
   206
	mkdir -p packages/centos5
d8818616c45e docker: add CentOS 5
Mads Kiilerich <madski@unity3d.com>
parents: 22442
diff changeset
   207
	contrib/buildrpm --withpython
d8818616c45e docker: add CentOS 5
Mads Kiilerich <madski@unity3d.com>
parents: 22442
diff changeset
   208
	cp rpmbuild/RPMS/*/* packages/centos5
d8818616c45e docker: add CentOS 5
Mads Kiilerich <madski@unity3d.com>
parents: 22442
diff changeset
   209
	cp rpmbuild/SRPMS/* packages/centos5
d8818616c45e docker: add CentOS 5
Mads Kiilerich <madski@unity3d.com>
parents: 22442
diff changeset
   210
d8818616c45e docker: add CentOS 5
Mads Kiilerich <madski@unity3d.com>
parents: 22442
diff changeset
   211
docker-centos5:
d8818616c45e docker: add CentOS 5
Mads Kiilerich <madski@unity3d.com>
parents: 22442
diff changeset
   212
	mkdir -p packages/centos5
d8818616c45e docker: add CentOS 5
Mads Kiilerich <madski@unity3d.com>
parents: 22442
diff changeset
   213
	contrib/dockerrpm centos5 --withpython
d8818616c45e docker: add CentOS 5
Mads Kiilerich <madski@unity3d.com>
parents: 22442
diff changeset
   214
21255
62a2749895e4 build: initial support for in-tree autobuilding recipes
Matt Mackall <mpm@selenic.com>
parents: 21229
diff changeset
   215
centos6:
21560
a9e1ab2da30d packaging: move output directory from build/ to packages/
Matt Mackall <mpm@selenic.com>
parents: 21559
diff changeset
   216
	mkdir -p packages/centos6
21640
4bfb721de6dd buildrpm: remove prompt for uncommitted changes - it was a bad idea
Mads Kiilerich <madski@unity3d.com>
parents: 21560
diff changeset
   217
	contrib/buildrpm
21560
a9e1ab2da30d packaging: move output directory from build/ to packages/
Matt Mackall <mpm@selenic.com>
parents: 21559
diff changeset
   218
	cp rpmbuild/RPMS/*/* packages/centos6
a9e1ab2da30d packaging: move output directory from build/ to packages/
Matt Mackall <mpm@selenic.com>
parents: 21559
diff changeset
   219
	cp rpmbuild/SRPMS/* packages/centos6
21255
62a2749895e4 build: initial support for in-tree autobuilding recipes
Matt Mackall <mpm@selenic.com>
parents: 21229
diff changeset
   220
62a2749895e4 build: initial support for in-tree autobuilding recipes
Matt Mackall <mpm@selenic.com>
parents: 21229
diff changeset
   221
docker-centos6:
21560
a9e1ab2da30d packaging: move output directory from build/ to packages/
Matt Mackall <mpm@selenic.com>
parents: 21559
diff changeset
   222
	mkdir -p packages/centos6
21255
62a2749895e4 build: initial support for in-tree autobuilding recipes
Matt Mackall <mpm@selenic.com>
parents: 21229
diff changeset
   223
	contrib/dockerrpm centos6
62a2749895e4 build: initial support for in-tree autobuilding recipes
Matt Mackall <mpm@selenic.com>
parents: 21229
diff changeset
   224
23033
1d354814ff4d docker: add centos7 target for CentOS / Red Hat 7 support
Mads Kiilerich <madski@unity3d.com>
parents: 22443
diff changeset
   225
centos7:
1d354814ff4d docker: add centos7 target for CentOS / Red Hat 7 support
Mads Kiilerich <madski@unity3d.com>
parents: 22443
diff changeset
   226
	mkdir -p packages/centos7
1d354814ff4d docker: add centos7 target for CentOS / Red Hat 7 support
Mads Kiilerich <madski@unity3d.com>
parents: 22443
diff changeset
   227
	contrib/buildrpm
1d354814ff4d docker: add centos7 target for CentOS / Red Hat 7 support
Mads Kiilerich <madski@unity3d.com>
parents: 22443
diff changeset
   228
	cp rpmbuild/RPMS/*/* packages/centos7
1d354814ff4d docker: add centos7 target for CentOS / Red Hat 7 support
Mads Kiilerich <madski@unity3d.com>
parents: 22443
diff changeset
   229
	cp rpmbuild/SRPMS/* packages/centos7
1d354814ff4d docker: add centos7 target for CentOS / Red Hat 7 support
Mads Kiilerich <madski@unity3d.com>
parents: 22443
diff changeset
   230
1d354814ff4d docker: add centos7 target for CentOS / Red Hat 7 support
Mads Kiilerich <madski@unity3d.com>
parents: 22443
diff changeset
   231
docker-centos7:
1d354814ff4d docker: add centos7 target for CentOS / Red Hat 7 support
Mads Kiilerich <madski@unity3d.com>
parents: 22443
diff changeset
   232
	mkdir -p packages/centos7
1d354814ff4d docker: add centos7 target for CentOS / Red Hat 7 support
Mads Kiilerich <madski@unity3d.com>
parents: 22443
diff changeset
   233
	contrib/dockerrpm centos7
1d354814ff4d docker: add centos7 target for CentOS / Red Hat 7 support
Mads Kiilerich <madski@unity3d.com>
parents: 22443
diff changeset
   234
2527
c51fad25e59e Split installation targets into install-bin and install-doc.
Sascha Wilde <wilde@sha-bang.de>
parents: 2244
diff changeset
   235
.PHONY: help all local build doc clean install install-bin install-doc \
23125
a5d6a609752b Makefile: update .PHONY
Mads Kiilerich <madski@unity3d.com>
parents: 23033
diff changeset
   236
	install-home install-home-bin install-home-doc \
a5d6a609752b Makefile: update .PHONY
Mads Kiilerich <madski@unity3d.com>
parents: 23033
diff changeset
   237
	dist dist-notests check tests check-code update-pot \
23882
272b1cc3e83e docker: support Fedora 21
Mads Kiilerich <madski@unity3d.com>
parents: 23125
diff changeset
   238
	osx fedora20 docker-fedora20 fedora21 docker-fedora21 \
23125
a5d6a609752b Makefile: update .PHONY
Mads Kiilerich <madski@unity3d.com>
parents: 23033
diff changeset
   239
	centos5 docker-centos5 centos6 docker-centos6 centos7 docker-centos7