monotone

monotone Mtn Source Tree

Root/Makefile.am

1# Copyright (C) 2003 Graydon Hoare <graydon@pobox.com>
2# 2014 Markus Wanner <markus@bluegap.ch>
3#
4# This program is made available under the GNU GPL version 2.0 or
5# greater. See the accompanying file COPYING for details.
6#
7# This program is distributed WITHOUT ANY WARRANTY; without even the
8# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9# PURPOSE.
10
11# Makefile for monotone
12
13AUTOMAKE_OPTIONS = subdir-objects -Wno-portability
14ACLOCAL_AMFLAGS = -I m4
15
16SUBDIRS = doc
17
18CMD_SOURCES =\
19src/cmd.hh src/cmd.cc src/cmd_netsync.cc src/cmd_list.cc \
20src/cmd_packet.cc src/cmd_key_cert.cc src/cmd_merging.cc \
21src/cmd_db.cc src/cmd_diff_log.cc src/cmd_ws_commit.cc \
22src/cmd_othervcs.cc src/cmd_automate.cc src/cmd_files.cc\
23src/cmd_conflicts.cc
24
25SANITY_CORE_SOURCES =\
26src/sanity.cc src/sanity.hh src/quick_alloc.hh src/vector.hh \
27src/base.hh src/simplestring_xform.cc src/simplestring_xform.hh\
28src/constants.cc src/constants.hh src/numeric_vocab.hh\
29src/platform.hh src/origin_type.hh
30
31LUAEXT_SOURCES = \
32src/vocab.hh src/vocab.cc src/vocab_terms.hh\
33src/vocab_macros.hh src/vocab_cast.hh src/charset.cc\
34src/charset.hh src/paths.cc src/paths.hh src/interner.hh\
35src/vocab_hash.hh src/luaext_mkstemp.cc\
36src/luaext_parse_basic_io.cc src/luaext_guess_binary.cc\
37src/luaext_platform.cc src/luaext_globish.cc src/lua.cc\
38src/lua.hh src/mkstemp.cc src/file_io.cc src/file_io.hh\
39src/globish.cc src/globish.hh src/basic_io.cc src/basic_io.hh\
40src/char_classifiers.hh
41
42MOST_SOURCES = \
43$(SANITY_CORE_SOURCES) $(LUAEXT_SOURCES)\
44src/platform-wrapped.hh src/rev_types.hh src/mtn-sanity.cc\
45src/mtn-sanity.hh src/ui.cc src/ui.hh src/app_state.cc\
46src/app_state.hh src/automate_ostream.hh\
47src/automate_ostream_demuxed.hhsrc/automate_reader.hh\
48src/automate_reader.cc src/automate_stdio_helpers.hh\
49src/botan_pipe_cache.hhsrc/cache_logger.hh src/cache_logger.cc\
50src/commands.cc src/commands.hh $(CMD_SOURCES)\
51src/colorizer.cc src/colorizer.hh\
52src/diff_output.cc src/diff_output.hh\
53src/lua_hooks.cc src/lua_hooks.hh \
54src/transforms.cc src/transforms.hh\
55src/update.cc src/update.hh\
56src/work.cc src/migrate_work.cc src/work.hh\
57src/cert.cc src/cert.hh\
58src/cow_trie.hh\
59src/project.cc src/project.hh\
60src/outdated_indicator.cc src/outdated_indicator.hh\
61src/database.cc src/database.hh\
62src/key_store.cc src/key_store.hh\
63src/ssh_agent.cc src/ssh_agent.hh\
64src/keys.cc src/keys.hh\
65src/packet.cc src/packet.hh\
66src/key_packet.cc src/key_packet.hh\
67src/rcs_file.cc src/rcs_file.hh\
68src/xdelta.cc src/xdelta.hh\
69src/migration.hh src/migrate_schema.cc src/migrate_ancestry.cc\
70src/refiner.cc src/refiner.hh\
71src/enumerator.cc src/enumerator.hh\
72src/netsync.hh src/netsync.cc \
73src/network/automate_session.hh src/network/automate_session.cc\
74src/network/connection_info.hh src/network/connection_info.cc\
75src/network/listener_base.hh src/network/listener_base.cc\
76src/network/listener.hh src/network/listener.cc\
77src/network/make_server.hh src/network/make_server.cc\
78src/network/netsync_session.hh src/network/netsync_session.cc\
79src/network/reactable.hh src/network/reactable.cc\
80src/network/reactor.hh src/network/reactor.cc\
81src/network/session.hh src/network/session.cc\
82src/network/session_base.hh src/network/session_base.cc\
83src/network/wrapped_session.hh src/network/wrapped_session.cc\
84src/netxx_pipe.cc src/netxx_pipe.hh\
85src/netcmd.cc src/netcmd.hh\
86src/merkle_tree.cc src/merkle_tree.hh \
87src/lcs.cc src/lcs.hh\
88src/rcs_import.cc src/rcs_import.hh\
89src/git_change.cc src/git_change.hh src/git_export.cc\
90src/git_export.hh\
91src/revision.cc src/ancestry.cc src/revision.hh\
92src/cset.cc src/cset.hh\
93src/roster.cc src/roster.hh \
94src/mt_version.cc src/mt_version.hh\
95src/automate.cc\
96src/database_check.cc\
97src/epoch.cc src/epoch.hh\
98src/gzip.cc src/gzip.hh\
99src/inodeprint.cc src/inodeprint.hh\
100src/selectors.cc src/selectors.hh\
101src/annotate.cc src/annotate.hh\
102src/restrictions.cc src/restrictions.hh\
103src/hmac.cc src/hmac.hh\
104src/string_queue.hh\
105src/maybe_workspace_updater.cc src/maybe_workspace_updater.hh\
106src/merge_roster.cc src/merge_conflict.cc src/merge_roster.hh\
107src/merge_content.cc src/merge_3way.cc src/merge_content.hh\
108src/legacy.cc src/legacy.hh src/uri.cc src/uri.hh\
109src/graph.cc src/graph.hh\
110src/roster_delta.cc src/roster_delta.hh\
111src/sha1.cc\
112src/pcrewrap.cc src/pcrewrap.hh\
113src/rev_height.cc src/rev_height.hh\
114src/rev_output.cc src/rev_output.hh\
115src/asciik.cc src/asciik.hh\
116src/dates.cc src/dates.hh src/date_format.hh\
117\
118src/lru_writeback_cache.hh src/hybrid_map.hh src/lazy_rng.hh\
119\
120src/cleanup.hh src/cycle_detector.hh src/adler32.hh\
121src/netio.hh src/gettext.h\
122src/option.cc src/option.hh src/options.cc src/options.hh\
123src/options_list.hh src/options_applicator.hh\
124src/options_applicator.cc src/option_reset_info.hh\
125src/specialized_lexical_cast.cc src/lexical_cast.hh\
126src/parallel_iter.hh src/safe_map.hh src/pch.hh\
127src/current_exception.hh
128
129NETXX_SOURCES =\
130src/netxx/accept.cxx src/netxx/accept.h src/netxx/address.cxx\
131src/netxx/common.h src/netxx/compat.h src/netxx/datagram.cxx\
132src/netxx/datagramserver.cxx src/netxx/osutil.cxx\
133src/netxx/osutil.h src/netxx/peer.cxx src/netxx/probe.cxx \
134src/netxx/probe_impl.h src/netxx/probe_select.cxx \
135src/netxx/recvfrom.cxx src/netxx/recvfrom.h src/netxx/resolve.h\
136src/netxx/serverbase.cxx src/netxx/serverbase.h\
137src/netxx/sockaddr.cxx src/netxx/sockaddr.h\
138src/netxx/socket.cxx src/netxx/socket.h src/netxx/sockopt.cxx \
139src/netxx/stream.cxx src/netxx/streambase.cxx \
140src/netxx/streamserver.cxx src/netxx/address.h \
141src/netxx/datagram.h src/netxx/datagramserver.h \
142src/netxx/netbuf.h src/netxx/netxx.h src/netxx/peer.h \
143src/netxx/probe.h src/netxx/probeinfo.h src/netxx/sockopt.h \
144src/netxx/stream.h src/netxx/streambase.h \
145src/netxx/streamserver.h src/netxx/timeout.h src/netxx/types.h
146
147UNIX_PLATFORM_SOURCES =\
148src/unix/read_password.cc src/unix/get_system_flavour.cc\
149src/unix/process.cc src/unix/terminal.cc src/unix/inodeprint.cc\
150src/unix/fs.cc src/unix/make_io_binary.cc\
151src/unix/os_strerror.cc src/unix/cputime.cc \
152src/unix/ssh_agent_platform.cc src/unix/ssh_agent_platform.hh\
153src/unix/parse_date.cc
154
155WIN32_PLATFORM_SOURCES =\
156src/win32/read_password.cc src/win32/get_system_flavour.cc\
157src/win32/process.cc src/win32/terminal.cc\
158src/win32/inodeprint.ccsrc/win32/fs.cc \
159src/win32/make_io_binary.cc src/win32/os_strerror.cc\
160src/win32/cputime.cc src/win32/ssh_agent_platform.cc\
161src/win32/ssh_agent_platform.hh src/win32/parse_date.cc
162
163# these files (part of the main program) contain code subject to unit testing
164
165UNIT_TESTEES =\
166src/basic_io.cc src/charset.cc src/commands.cc src/cset.cc \
167src/git_change.cc src/globish.cc src/graph.cc src/merge_3way.cc\
168src/merge_roster.cc src/mkstemp.cc src/netcmd.cc \
169src/netxx_pipe.cc src/option.cc src/outdated_indicator.cc\
170src/pcrewrap.cc src/refiner.cc src/restrictions.cc\
171src/revision.cc src/simplestring_xform.cc src/transforms.cc \
172src/uri.cc src/vocab.cc src/xdelta.cc
173
174# these files contain the actual unit tests
175# yes, we have to list them all explicitly, with directory prefix, or
176# automake gets very confused
177UNIT_TESTERS =\
178test/unit/tests/basic_io.cc test/unit/tests/charset.cc\
179test/unit/tests/commands.cc test/unit/tests/cset.cc\
180test/unit/tests/git_change.cc test/unit/tests/globish.cc\
181test/unit/tests/graph.cc test/unit/tests/merge_3way.cc\
182test/unit/tests/merge_roster.cc test/unit/tests/mkstemp.cc\
183test/unit/tests/netcmd.cc test/unit/tests/netxx_pipe.cc\
184test/unit/tests/option.cc test/unit/tests/outdated_indicator.cc\
185test/unit/tests/pcrewrap.cc test/unit/tests/refiner.cc \
186test/unit/tests/restrictions.cc test/unit/tests/revision.cc\
187test/unit/tests/simplestring_xform.cc\
188test/unit/tests/transforms.cc\
189test/unit/tests/uri.cc test/unit/tests/vocab.cc\
190test/unit/tests/xdelta.cc test/unit/tests/numeric_vocab.cc\
191test/unit/tests/sha1.cc test/unit/tests/string_queue.cc\
192test/unit/unit_tester.cc
193
194# these files contain unit tests that need access to private interfaces
195# of the code under test, so they #include the code under test. thus,
196# to avoid multiple-definition errors, for these files the code under
197# test is not part of UNIT_TESTEES.
198
199UNIT_TESTERS_PRIV =\
200test/unit/tests/dates.cc test/unit/tests/key_packet.cc \
201test/unit/tests/packet.cc test/unit/tests/paths.cc \
202test/unit/tests/rev_height.cc test/unit/tests/roster.cc
203
204# these files do not contain unit tests, but are required for unit testing
205# note that some are and some aren't part of the main program
206UNIT_TEST_SUPPORT =\
207src/constants.cc src/file_io.cc src/gzip.cc src/hmac.cc \
208src/lcs.cc src/merkle_tree.cc src/roster_delta.cc \
209src/sanity.cc src/specialized_lexical_cast.cc\
210test/unit/randomfile.hh test/unit/unit_tests.hh\
211test/unit/randomizer.hh test/unit/randomizer.cc\
212test/unit/roster_tests.hh
213
214# primaries
215
216bin_PROGRAMS = mtn
217mtn_SOURCES = $(MOST_SOURCES) src/monotone.cc
218nodist_mtn_SOURCES = src/std_hooks.cc src/schema.cc src/package_revision.cc src/package_full_revision.cc
219
220noinst_PROGRAMS = util/txt2c
221util_txt2c_SOURCES = util/txt2c.cc
222
223EXTRA_PROGRAMS =
224
225bin_SCRIPTS = mtnopt
226dist_bin_SCRIPTS = extra/bin/mtn-cleanup
227noinst_SCRIPTS = extra/building/dump-test-logs.sh
228
229check_PROGRAMS = test/bin/unit_tester test/bin/tester test/bin/check_net
230test_bin_unit_tester_SOURCES = $(UNIT_TESTERS) $(UNIT_TESTERS_PRIV) \
231$(UNIT_TESTEES) $(UNIT_TEST_SUPPORT)
232test_bin_tester_SOURCES = test/src/tester.cc test/src/tester-plaf.hh src/transforms.cc src/gzip.cc \
233$(SANITY_CORE_SOURCES) $(LUAEXT_SOURCES) src/pcrewrap.cc \
234src/specialized_lexical_cast.cc
235nodist_test_bin_tester_SOURCES = test/src/testlib.cc
236
237noinst_LIBRARIES = src/libplatform.a src/lib3rdparty.a
238src_libplatform_a_SOURCES = src/platform.hh
239src_lib3rdparty_a_SOURCES = $(NETXX_SOURCES)
240
241bashcompdir = $(sysconfdir)/bash_completion.d
242bashcomp_DATA = extra/shell/monotone.bash_completion
243
244monotonedir = $(datadir)/monotone
245
246mtnhooksdir = $(monotonedir)/hooks
247dist_mtnhooks_DATA = \
248extra/mtn-hooks/authorize_remote_automate.lua\
249extra/mtn-hooks/get_passphrase_from_file.lua\
250extra/mtn-hooks/monotone-buildbot.lua\
251extra/mtn-hooks/monotone-ciabot.lua\
252extra/mtn-hooks/monotone-cluster-push.lua\
253extra/mtn-hooks/monotone-cvs-ignore.lua\
254extra/mtn-hooks/monotone-mail-notify.lua
255
256mtnscriptsdir = $(monotonedir)/scripts
257dist_mtnscripts_SCRIPTS = \
258extra/mtn-hooks/monotone-ciabot.py\
259extra/mtn-hooks/monotone-mail-notify
260
261# Some of the smaller programs do not have --help or --version,
262# make them exempt of the check for those. This specially applies
263# to programs intended to be called by mtn hooks, for which these
264# options aren't necessary.
265# NOTE: in the expansion of this variable, each filename MUST be
266# surrounded by one space before and after. Having a tab between
267# two file names will guarantee that they won't be exempt. This
268# is really a small but serious bug in the automake templates.
269# backslash+newline+whitespace will be reinterpreted as whitespace
270# by make.
271AM_INSTALLCHECK_STD_OPTIONS_EXEMPT = \
272extra/bin/mtn-cleanup extra/mtn-hooks/monotone-ciabot.py \
273extra/mtn-hooks/monotone-mail-notify
274
275# flags
276
277# sets DEFS for just this object (autoconf's -DHAVE_CONFIG_H is useless)
278# the variable prevents this from overriding automake's unix/fs.o rule
279DEFS =
280UNIX=src/unix/
281$(UNIX)fs.$(OBJEXT) : DEFS += -DLOCALEDIR="\"$(localedir)\""
282
283if BUILD_PCH
284
285PCH_SOURCE = $(srcdir)/pch.hh
286# the .gch file only will be seen if it's in the same dir as the .hh file,
287# so need to copy it for separate build directories
288PCH_BUILD = pch-build.hh
289PCH_FLAGS = -Winvalid-pch -include $(PCH_BUILD)
290PCH_FILE = $(PCH_BUILD).gch
291sinclude $(PCH_FILE).dep
292
293*.o *.lo *.obj: $(PCH_FILE)
294
295$(PCH_BUILD): $(PCH_SOURCE)
296cp $(PCH_SOURCE) $(PCH_BUILD)
297
298$(PCH_FILE): $(PCH_BUILD)
299$(MAKE) PCH_FLAGS= pch-file
300
301pch-file:
302$(CXXCOMPILE) -x c++-header $(PCH_BUILD) -o $(PCH_FILE) \
303-MT $(PCH_FILE) -MD -MP -MF "./$(PCH_FILE).Tdep" \
304&& mv "./$(PCH_FILE).Tdep" "./$(PCH_FILE).dep" \
305|| rm "./$(PCH_FILE).Tdep"
306endif
307AM_CXXFLAGS = $(PCH_FLAGS)
308
309SUFFIXES = .gch .merged.po .gmo
310
311AM_CPPFLAGS = $(intl_CFLAGS) $(pcre_CFLAGS) $(botan_CFLAGS)\
312 $(lua_CFLAGS) $(sqlite3_CFLAGS) $(idn_CFLAGS)
313
314LDADD = src/libplatform.a src/lib3rdparty.a $(intl_LIBS) $(pcre_LIBS)\
315$(botan_LIBS) $(lua_LIBS) $(sqlite3_LIBS) $(idn_LIBS)
316
317if WIN32_PLATFORM
318 src_libplatform_a_SOURCES += $(WIN32_PLATFORM_SOURCES)
319 mtn_SOURCES += src/win32/main.cc
320 test_bin_tester_SOURCES += test/src/win32/tester-plaf.cc
321 test_bin_check_net_SOURCES = test/src/win32/tester-check-net.cc
322 AM_CPPFLAGS += -DWIN32
323 LDADD += -lshfolder -lws2_32 -liconv -liphlpapi
324else
325 src_libplatform_a_SOURCES += $(UNIX_PLATFORM_SOURCES)
326 mtn_SOURCES += src/unix/main.cc
327 test_bin_tester_SOURCES += test/src/unix/tester-plaf.cc
328 test_bin_check_net_SOURCES = test/src/unix/tester-check-net.cc
329endif
330
331if MISSING_INET_PTON
332 src_lib3rdparty_a_SOURCES += src/netxx/inet_pton.cxx src/netxx/inet_pton.h
333 AM_CPPFLAGS += -DNETXX_NO_PTON
334endif
335
336if MISSING_INET_NTOP
337 src_lib3rdparty_a_SOURCES += src/netxx/inet_ntop.cxx src/netxx/inet_ntop.h
338 AM_CPPFLAGS += -DNETXX_NO_NTOP
339endif
340
341if MISSING_GETADDRINFO
342 src_lib3rdparty_a_SOURCES += src/netxx/resolve_gethostbyname.cxx \
343 src/netxx/resolve_getservbyname.cxx
344else
345 src_lib3rdparty_a_SOURCES += src/netxx/resolve_getaddrinfo.cxx
346endif
347
348if MISSING_INET6
349 AM_CPPFLAGS += -DNETXX_NO_INET6
350endif
351
352# extra files
353
354contribdir = $(docdir)/contrib
355contrib_prefix = contrib
356contrib_data = $(shell cd $(srcdir); find $(contrib_prefix) | sed -e 's,^\./,,')
357
358examplesdir = $(docdir)/examples
359examples_prefix = examples
360examples_data =\
361examples/000README.txt\
362examples/mirror.rc examples/push.rc examples/read-permissions\
363examples/write-permissions\
364\
365examples/server-setup/README examples/server-setup/serverrc\
366examples/server-setup/monotone.init\
367examples/server-setup/monotone.run\
368\
369examples/user-setup/README examples/user-setup/monotonerc
370
371EXTRA_DIST =\
372HACKING INSTALL INSTALL_windows_cygwin.txt\
373INSTALL_windows_mingw.txt INSTALL_windows_msvc.txt UPGRADE\
374util/audit-includes util/do-editor-vars.sh\
375$(wildcard $(srcdir)/m4/*.m4)\
376\
377src/schema.sql src/unix/README src/std_hooks.lua\
378src/util/mtnopt.in\
379\
380test/common\
381test/func test/func-testsuite.lua\
382test/tester test/tester-testsuite.lua\
383$(wildcard $(srcdir)/test/unit/*.cc)\
384$(wildcard $(srcdir)/test/unit/*.hh)\
385$(wildcard $(srcdir)/test/unit/tests/*.cc)\
386test/unit-testsuite.lua\
387test/extra test/extra-testsuite.lua\
388test/src/testlib.lua\
389\
390src/package_revision.txt src/package_full_revision_dist.txt\
391\
392extra/README extra/building/dump-test-logs.sh.in\
393extra/shell/monotone.bash_completion.in\
394extra/shell/monotone_gen_bash_completion_table.pl\
395\
396innosetup/README.txt\
397innosetup/monotone.iss.in innosetup/modpath.iss \
398innosetup/monotone.bmp innosetup/dlls.sh\
399\
400mac/readme-mac.txt mac/package-intro.rtf\
401mac/monotone.pmproj mac/monotone-pkg-logo.gif\
402\
403cygport/README.txt\
404cygport/monotone.cygwin.patch\
405cygport/monotone.cygport\
406\
407notes/release-checklist.txt\
408notes/README.testing notes/tester.txt notes/testsuite.txt\
409\
410visualc/monotone.sln\
411visualc/monotone.vcproj visualc/botan.vcproj visualc/lua.vcproj\
412visualc/netxx.vcproj visualc/pcre.vcproj visualc/sqlite3.vcproj\
413visualc/stringprep.vcproj visualc/txt2c.vcproj\
414visualc/tester.vcproj visualc/unit_tester.vcproj\
415visualc/runtests.bat\
416visualc/config.h visualc/mt-stdint.h visualc/stdint.h\
417visualc/unistd.h\
418visualc/unknown_package.txt\
419\
420$(contrib_data) $(examples_data)
421
422# Message translation support
423# INST_LINGUAS is set by configure, based on the po/LINGUAS file and
424# the user's LINGUAS env. variable. Additional settings are in
425# po/Makevars.
426#
427# Only the foo.po-update target will overwrite a file in the source
428# po/ directory.
429
430include $(srcdir)/po/Makevars
431ALL_POFILES := $(wildcard $(srcdir)/po/*.po)
432ALL_LINGUAS := $(basename $(notdir $(ALL_POFILES)))
433ALL_POREADMES := $(addprefix po/README.,$(ALL_LINGUAS))
434ALL_GMOFILES := $(addprefix po/,$(addsuffix .gmo, $(ALL_LINGUAS)))
435CLEAN_POFILES := $(addprefix po/,$(addsuffix .merged.po, $(ALL_LINGUAS))) \
436 po/$(PACKAGE).pot
437DISTCLEAN_GMOFILES:= $(ALL_GMOFILES)
438
439EXTRA_DIST += $(ALL_POFILES) $(ALL_POREADMES) po/LINGUAS po/README
440
441.PHONY: all-nls install-nls uninstall-nls
442if USE_NLS
443# for installation
444GMOFILES := $(addprefix po/,$(addsuffix .gmo, $(INST_LINGUAS)))
445
446all-nls: $(GMOFILES)
447
448install-nls: all-nls
449@linguas='$(INST_LINGUAS)'; set -e; for lang in $$linguas; do \
450 dir=$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES; \
451 echo " $(MKDIR_P) '$$dir'"; \
452 $(MKDIR_P) $$dir; \
453 echo " $(INSTALL_DATA) po/$$lang.gmo '$$dir/$(PACKAGE).mo'"; \
454 $(INSTALL_DATA) po/$$lang.gmo $$dir/$(PACKAGE).mo; \
455done
456
457uninstall-nls:
458@linguas='$(INST_LINGUAS)'; set -e; for lang in $$linguas; do \
459 echo " rm -f '$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE).mo'"; \
460 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE).mo; \
461 echo " rmdir '$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES'; \
462 rmdir $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES || :; \
463 echo " rmdir '$(DESTDIR)$(localedir)/$$lang'; \
464 rmdir $(DESTDIR)$(localedir)/$$lang || :; \
465done
466else
467# We need to provide these targets because all-local, install-data-local
468# and uninstall-local expects them as dependencies, further down.
469all-nls:
470@:
471install-nls:
472@:
473uninstall-nls:
474@:
475endif
476
477.PHONY: dist-nls
478if REBUILD_NLS
479po/%.gmo: po/%.merged.po
480$(V_msgfmt)$(MSGFMT) -c --statistics -o $@ $<
481
482po/%.merged.po: $(srcdir)/po/%.po po/$(PACKAGE).pot
483$(V_msgmerge)$(MSGMERGE) $^ -q -o $@
484
485# for translators' use
486UPDATEPOFILES = $(addprefix po/,$(addsuffix .po-update, $(ALL_LINGUAS)))
487
488po/%.po-update: $(srcdir)/po/%.po po/$(PACKAGE).pot
489$(MSGMERGE) --update $^
490
491update-po: $(UPDATEPOFILES)
492
493update-gmo: update-po $(ALL_GMOFILES)
494
495# for the template file
496POTFILES = $(filter-out package_%, $(MOST_SOURCES)) \
497$(UNIX_PLATFORM_SOURCES) $(WIN32_PLATFORM_SOURCES) \
498src/monotone.cc src/std_hooks.lua
499
500po/$(PACKAGE).pot: $(POTFILES)
501[ -d po ] || mkdir -p po
502$(V_xgettext)$(XGETTEXT) -o$@.in -D. -D$(top_srcdir) -cTRANSLATORS: \
503 --copyright-holder='$(COPYRIGHT_HOLDER)' \
504 --msgid-bugs-address='$(PACKAGE_BUGREPORT)' \
505 $(XGETTEXT_PKG_OPTS) $(XGETTEXT_OPTS) \
506 $(POTFILES)
507 YEAR=$(word 1, $(subst -, ,$(BUILD_DATE)))
508sed -e 's/FIRST AUTHOR <EMAIL@ADDRESS>, YEAR./Please see po\/README.<lang> for individual copyrights./' \
509 -e 's/(C) YEAR/(C) 2003 - $(YEAR)/' -e 's/PACKAGE/$(PACKAGE)/' \
510 -e 's/SOME DESCRIPTIVE TITLE/monotone message string catalogue/' < $@.in > $@
511rm $@.in
512
513dist-nls: $(ALL_GMOFILES)
514cp $(ALL_GMOFILES) $(distdir)/po
515else
516
517po/%.gmo: $(srcdir)/po/%.gmo
518#Some versions of gmake just drop the argument, but still
519#execute the rule. Therefore, we check if the source is not
520#empty.
521[[ -z $< ]] || cp $< $@
522
523dist-nls:
524@echo "*** Cannot 'make dist' without xgettext" >&2; exit 1
525
526endif
527
528_install_data = \
529list='$(1)'; test -n "$(3)" || list=; \
530for p in $$list; do \
531 if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \
532 src="$$d$$p"; \
533 dest="`if [ "$$p" != "$(2)" ]; then echo $$p | sed -e 's,$(2)/,,'; fi`"; \
534 if test -d "$$src"; then \
535 echo " $(MKDIR_P) '$(DESTDIR)$(3)/$$dest'"; \
536 $(MKDIR_P) "$(DESTDIR)$(3)/$$dest" || exit $$?; \
537 else \
538 destd="`dirname $$dest`"; \
539 if ! test -d "$(DESTDIR)$(3)/$$destd"; then \
540 echo " $(MKDIR_P) '$(DESTDIR)$(3)/$$destd'"; \
541 $(MKDIR_P) "$(DESTDIR)$(3)/$$destd" || exit $$?; \
542 fi; \
543 echo " $(INSTALL_DATA) $$src '$(DESTDIR)$(3)/$$dest'"; \
544 $(INSTALL_DATA) $$src "$(DESTDIR)$(3)/$$dest" || exit $$?; \
545 fi; \
546done
547_uninstall_data = \
548list='$(1)'; test -n "$(3)" || list=; \
549dirs_rev=; \
550for p in $$list; do \
551 to_rm="`if [ "$$p" != "$(2)" ]; then echo $$p | sed -e 's,$(2)/,,'; fi`"; \
552 if [ -n "$$to_rm" ]; then \
553 if test -d "$(DESTDIR)$(3)/$$to_rm"; then \
554 dirs_rev="echo '$$to_rm';$${dirs_rev}"; \
555 else \
556 echo " rm -f '$(DESTDIR)$(3)/$$to_rm'"; \
557 rm -f $$src "$(DESTDIR)$(3)/$$to_rm" || exit $$?; \
558 fi; \
559 fi; \
560done; \
561eval "$$dirs_rev" | while read to_rmdir; do \
562 echo " rmdir '$(DESTDIR)$(3)/$$to_rmdir'"; \
563 rmdir "$(DESTDIR)$(3)/$$to_rmdir" || exit $$?; \
564done
565
566install-contrib-data: $(contrib_data)
567@$(call _install_data,$(contrib_data),$(contrib_prefix),$(contribdir))
568uninstall-contrib-data:
569@$(call _uninstall_data,$(contrib_data),$(contrib_prefix),$(contribdir))
570
571install-examples-data: $(examples_data)
572@$(call _install_data,$(examples_data),$(examples_prefix),$(examplesdir))
573uninstall-examples-data:
574@$(call _uninstall_data,$(examples_data),$(examples_prefix),$(examplesdir))
575
576# Another attempt at working around abs_topbuilddir not being defined
577# or not absolute.
578abs_topbuilddir=$(shell cd $(top_builddir); pwd)
579
580# build an OS X installer
581# requires sudo since packagemaker just looks at directory permissions.
582PKG_INST_ROOT = $(abs_topbuilddir)/pkg_inst_root
583monotone-$(PACKAGE_VERSION).pkg: doc/monotone.pdf doc/html
584sudo rm -rf $(PKG_INST_ROOT)
585rm -rf "$@"
586$(MAKE) install-strip DESTDIR=$(PKG_INST_ROOT)
587mkdir -p $(PKG_INST_ROOT)/Developer/Documentation/monotone
588cp doc/monotone.pdf $(PKG_INST_ROOT)/Developer/Documentation/monotone/
589cp -r doc/html $(PKG_INST_ROOT)/Developer/Documentation/monotone/html
590plutil -convert xml1 -o monotone-xml.pmproj.in $(srcdir)/mac/monotone.pmproj
591sed "s/__MONOTONE_VERSION__/$(PACKAGE_VERSION)/g" \
592< monotone-xml.pmproj.in > monotone-xml.pmproj
593cp $(srcdir)/mac/monotone-pkg-logo.gif $(srcdir)/mac/package-intro.rtf .
594cp $(srcdir)/COPYING COPYING.txt
595chmod -R o-w,g-w,a+rX $(PKG_INST_ROOT)
596sudo chown -R root:wheel $(PKG_INST_ROOT)/usr
597sudo chown -R root:admin $(PKG_INST_ROOT)/Developer
598/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker \
599-build -proj monotone-xml.pmproj -p "$@"
600
601# build an OS X distribution disk image
602dmg: monotone-$(PACKAGE_VERSION).dmg
603
604monotone-$(PACKAGE_VERSION).dmg: monotone-$(PACKAGE_VERSION).pkg
605rm -rf $(top_builddir)/dmg_root "$@"
606mkdir $(top_builddir)/dmg_root
607cp -R $^ $(top_builddir)/dmg_root/
608chmod -R a+rX $(top_builddir)/dmg_root
609hdiutil create -srcfolder "$(top_builddir)/dmg_root" \
610"$@" -format UDZO -scrub -imagekey zlib-level=9 \
611-volname monotone-$(PACKAGE_VERSION)
612
613# build win32 installer using INNO setup
614ISCC=@ISCC@
615
616win32-installer: monotone-$(PACKAGE_VERSION)-setup.exe
617
618monotone-$(PACKAGE_VERSION)-setup.exe: mtn-stripped.exe html info $(ALL_GMOFILES) linguas.iss dlls.iss monotone.iss
619$(ISCC) monotone.iss
620
621mtn-stripped.exe: mtn.exe
622strip $< -o $@
623
624dlls.iss: mtn-stripped.exe ${top_srcdir}/Makefile.am
625rm -f $@
626for DLL in $$( ${top_srcdir}/innosetup/dlls.sh mtn-stripped.exe | xargs cmd //c echo) ; do \
627 echo "Source: \"$$DLL\"; DestDir: \"{app}\"" >> $@ ; \
628done
629
630linguas.iss: ${top_srcdir}/Makefile.am
631rm -rf $@
632for LANG in $(INST_LINGUAS) ; do \
633echo "Source: \"{#BUILDDIR}\\po\\$${LANG}.gmo\"; DestDir: \"{app}\\locale\\$${LANG}\\LC_MESSAGES\"; DestName: \"monotone.mo\"; Flags: ignoreversion" >> $@ ; \
634done
635
636
637# testsuite stuff (could this possibly be more ugly?) To get
638# parallelism, we cannot use Automake's TESTS feature at all. The
639# shell script embedded in the 'check-testers' rule is partially
640# borrowed from automake 1.9's check.am
641
642.PHONY: check-testers
643check-testers: test/tester.status test/unit.status test/func.status test/extra.status
644@all=0; failed=0; error=0; \
645for f in $^; do \
646 all=`expr $$all + 1`; \
647 if test -f $$f; then \
648 s=`cat $$f`; \
649 if test "$$s" = 0; then \
650 :; \
651 elif test "$$s" = 1; then \
652 failed=`expr $$failed + 1`; \
653 else \
654 error=`expr $$error + 1`; \
655 fi; \
656 else \
657 error=`expr $$error + 1`; \
658 fi; \
659done; \
660if test "$$failed" = 0 && test "$$error" = 0; then \
661 exit=0; \
662 report=""; \
663 banner="All $$all test suites passed"; \
664else \
665 exit=1; \
666 report="Please report to $(PACKAGE_BUGREPORT)"; \
667 if test "$$error" = 0; then \
668 banner="$$failed of $$all test suites failed"; \
669 elif test "$$failed" = 0; then \
670 banner="$$error of $$all test suites malfunctioned"; \
671 else \
672 banner="$$failed of $$all test suites failed" \
673 banner="$$banner and $$error malfunctioned"; \
674 fi; \
675fi; \
676rl=`echo $$report | wc -c`; \
677bl=`echo $$banner | wc -c`; \
678if test $$rl -gt $$bl; then \
679 dashes=`echo "$$report" | sed s/./=/g`; \
680else \
681 dashes=`echo "$$banner" | sed s/./=/g`; \
682fi; \
683echo $$dashes; \
684echo $$banner; \
685test -z "$$report" || echo "$$report"; \
686exit $$exit
687
688run_%_tests: Makefile
689$(AM_V_GEN){ echo '#!/bin/sh'; \
690 echo 'export LANG=C'; \
691 echo 'PATH="$(abs_topbuilddir):$(abs_topbuilddir)/test/bin:$$PATH"'; \
692 echo '$(top_builddir)/test/bin/tester "$(srcdir)/test/$*-testsuite.lua" "$$@"';\
693 echo 'echo $$? > $(top_builddir)/test/$*.status'; \
694 echo 'exit 0'; } > $@ && \
695chmod 755 $@
696
697# The leading + causes Make to treat this as a recursive invocation,
698# allowing it to participate in the jobserver protocol.
699test/%.status: test/%-testsuite.lua test/bin/tester$(EXEEXT) FORCE
700+$(AM_V_at)LANG=C PATH="$(abs_topbuilddir):$(abs_topbuilddir)/test/bin:$$PATH"\
701"$(top_builddir)/test/bin/tester"\
702"$(srcdir)/test/$*-testsuite.lua";\
703echo $$? > $@
704test/unit.status : test/bin/unit_tester$(EXEEXT)
705test/func.status : mtn$(EXEEXT) test/bin/check_net$(EXEEXT)
706
707# Creates the needed artifacts for manual test execution
708.PHONY: testers
709testers: mtn$(EXEEXT) $(check_PROGRAMS) \
710run_tester_tests run_unit_tests run_func_tests run_extra_tests
711
712# We want the tests re-run even if the .status files already exist.
713# .PHONY does not work for that (bad interaction with pattern rules),
714# but the FORCE hack does.
715.PHONY: FORCE
716FORCE:
717.PRECIOUS: run_tester_tests run_unit_tests run_func_tests run_extra_tests
718
719# FIXME: if it annoys anybody, we could clean dvi, pdf and info files
720# only in a separate maintainer-clean target as suggested by
721# automake's man page
722.PHONY: mostlyclean-tests
723mostlyclean-tests:
724rm -rf test/work
725@ls test/unit/tests/*/__driver__.lua 2>/dev/null | while read d; do \
726 echo " rm -f '$$d'"; \
727 rm -f $$d; \
728 echo " rmdir '$${d%/*}'"; \
729 rmdir $${d%/*} || :; \
730done
731
732# With the MacOS X toolchain, some stuff may be generated in the form of subdirs
733.PHONY: mostlyclean-util
734mostlyclean-util:
735rm -rf util/txt2c.dSYM
736
737MOSTLYCLEANFILES = mtn.1 \
738run_tester_tests run_func_tests run_unit_tests run_extra_tests \
739test/tester.status test/func.status test/unit.status test/extra.status
740
741# we generate some source files to copy data into the executable
742# note that the only things that should go in BUILT_SRCS are things
743# that need to be generated early on 'make all'; this is _not_ true of
744# generated source files, but it is true for the PCH if used.
745
746# package_revision.txt and package_full_revision_dist.txt are shipped
747# in the distribution, so don't delete them here
748CLEAN_SRCS = $(nodist_mtn_SOURCES) $(nodist_test_bin_tester_SOURCES)\
749src/package_revision.cc src/package_full_revision.cc\
750src/package_revision_raw.txt\
751src/package_full_revision.txt src/package_full_revision_raw.txt
752
753BUILT_SOURCES = $(PCH_FILE) $(PCH_BUILD)
754
755CLEANFILES = $(bin_SCRIPTS) $(noinst_SCRIPTS) $(bashcomp_DATA) \
756$(CLEAN_SRCS) $(CLEAN_POFILES)
757
758DISTCLEANFILES = src/xgettext.opts src/pch-build.hh.gch.dep\
759$(DISTCLEAN_GMOFILES)
760
761# a maintainer might still want to get rid of src/package_revision.txt and
762# src/package_full_revision_dist.txt to rebuild them.
763
764MAINTAINERCLEANFILES = \
765src/package_revision.txt src/package_full_revision_dist.txt
766
767# automake provides no nice way to build a helper program to execute
768# on the build machine, so we need our own rule. almost all the
769# standard flags variables are inappropriate.
770
771util/txt2c$(EXEEXT): util/txt2c.cc
772$(V_bcxx)$(CXX_FOR_BUILD) $(CXXFLAGS) -o $@ $^
773
774# files generated using txt2c
775src/std_hooks.cc: src/std_hooks.lua util/txt2c$(EXEEXT)
776$(V_txt2c)./util/txt2c std_hooks $< $@
777
778src/schema.cc: src/schema.sql util/txt2c$(EXEEXT)
779$(V_txt2c)./util/txt2c schema $< $@
780
781src/package_revision.cc: src/package_revision.txt util/txt2c$(EXEEXT)
782$(V_txt2c)./util/txt2c --strip-trailing package_revision $< $@
783
784src/package_full_revision.cc: src/package_full_revision.txt util/txt2c$(EXEEXT)
785$(V_txt2c)./util/txt2c package_full_revision $< $@
786
787test/src/testlib.cc: test/src/testlib.lua util/txt2c$(EXEEXT)
788$(V_txt2c)./util/txt2c testlib $< $@
789
790# Support for scripts and extras
791do_subst = sed -e 's,[@]PACKAGE_VERSION[@],$(PACKAGE_VERSION),' \
792-e 's,[@]sysconfdir[@],$(sysconfdir),'
793
794mtnopt: src/util/mtnopt.in Makefile
795$(V_subst)$(do_subst) < $< > $@ && chmod +x $@
796
797extra/shell/monotone.bash_completion: extra/shell/monotone.bash_completion.in \
798$(bin_PROGRAMS) extra/shell/monotone_gen_bash_completion_table.pl \
799Makefile
800$(MKDIR_P) extra/shell
801( sed -e '/^[@]generated-command-list[@]$$/,$$d' < $<; \
802 MTN=./mtn$(EXEEXT) \
803 perl $(srcdir)/extra/shell/monotone_gen_bash_completion_table.pl; \
804 sed -e '1,/^[@]generated-command-list[@]$$/d' < $< ) | \
805 $(do_subst) > $@
806
807extra/building/dump-test-logs.sh: extra/building/dump-test-logs.sh.in Makefile
808$(MKDIR_P) extra/building
809$(V_subst)$(do_subst) < $< > $@ && chmod +x $@
810
811# This is phony, so that we always try to rebuild it. If it succeeds
812# in calculating changes, it produces its target; otherwise, its
813# target does not exist.
814.PHONY: src/package_revision_raw.txt
815# if both attempts fail, then we need to remove the empty file that >
816# creates, and also make sure that the shell command exits
817# successfully; the rm -f ensures both
818src/package_revision_raw.txt:
819$(AM_V_GEN)REAL_BLDDIR=$(abs_topbuilddir); \
820(cd $(srcdir) && $$REAL_BLDDIR/mtn --root=. automate get_base_revision_id) 2>/dev/null >$@ \
821|| (cd $(srcdir) && mtn --root=. automate get_base_revision_id) 2>/dev/null >$@ \
822|| rm -f $@
823src/package_revision.txt: src/package_revision_raw.txt
824$(AM_V_GEN)set -e; if [ -f $< ]; then \
825 cp $< $@; \
826fi; \
827if [ ! -f $@ -a -f $(srcdir)/$@ ]; then \
828 cp $(srcdir)/$@ $@; \
829fi; \
830[ -f $@ ] || echo "unknown" > $@
831
832# To avoid a dependency loop here, what we do is:
833# calculate changes
834# |
835# package_full_revision_raw.txt
836# | \ <-- add "generated from cached data" text
837# | package_full_revision_dist.txt
838# | /
839# package_full_revision.txt
840
841# See above comment.
842.PHONY: src/package_full_revision_raw.txt
843src/package_full_revision_raw.txt:
844$(AM_V_GEN)REAL_BLDDIR=$(abs_topbuilddir); \
845(cd $(srcdir) && $$REAL_BLDDIR/mtn --root=. automate get_current_revision) 2>/dev/null >$@ \
846|| (cd $(srcdir) && mtn --root=. automate get_current_revision) 2>/dev/null >$@ \
847|| rm -f $@
848# See above comment -- the file this depends on may or may not exist.
849# This file, however, must always exist, so that 'make dist' can
850# include it in the tarball it generates. So there are three cases:
851# -- if the raw file does not exist, then
852# -- if the dist file exists, then we leave it alone
853# -- if the dist file does not exist, then we say "unknown"
854# -- if the raw file does exist, then we regenerate the dist file
855src/package_full_revision_dist.txt: src/package_full_revision_raw.txt
856$(AM_V_GEN)set -e; if [ -f $< ]; then \
857 cp -f $< $@ \
858 && (echo ''; \
859 echo ' Generated from data cached in the distribution;'; \
860 echo ' further changes may have been made.') >> $@; \
861fi; \
862if [ ! -f $@ -a -f $(srcdir)/$@ ]; then \
863 cp $(srcdir)/$@ $@; \
864fi; \
865[ -f $@ ] || echo "unknown" > $@
866# The raw file may not exist, but the dist file definitely does; we
867# just take the first dependency that exists.
868src/package_full_revision.txt: src/package_full_revision_raw.txt src/package_full_revision_dist.txt
869$(AM_V_GEN)rm -f $@; \
870for SRC in $^; do \
871 ([ -f $$SRC -a ! -f $@ ] && cp -f $$SRC $@) || true; \
872done
873
874# This is a magic directive copy-and-pasted, then modified, from the
875# automake 1.9 manual, section 13.4, "Checking the distribution".
876# Normally, 'distcheck' does a clean build, and then afterwards runs
877# 'distclean', and 'distclean' is supposed to remove everything that
878# the build created. However, we have some targets
879# (package_revision.txt, package_full_revision_dist.txt) that we
880# distribute, but then always attempt to rebuild optimistically, and
881# then if that fails fall back on the distributed versions. This
882# means that 'distclean' should _not_ remove those files, since they
883# are distributed, yet building the package will generate those files,
884# thus automake thinks that 'distclean' _should_ remove those files,
885# and 'distcheck' gets cranky if we don't. So basically what this
886# line does is tell 'distcheck' to shut up and ignore those two files.
887distcleancheck_listfiles = find . -type f -a ! -name package_revision.txt -a ! -name package_full_revision_dist.txt
888
889# the distcheck-base.hh checks for errors in the use of base.hh.
890# It's being used by distcheck-hook further down.
891.PHONY: distcheck-base.hh
892distcheck-base.hh:
893cd $(srcdir) && $(SHELL) util/audit-includes \
894$(sort $(mtn_SOURCES) $(test_bin_unit_tester_SOURCES) $(test_bin_tester_SOURCES) \
895 $(UNIX_PLATFORM_SOURCES) $(WIN32_PLATFORM_SOURCES) \
896 src/win32/main.cc src/unix/main.cc)
897
898man1_MANS = mtn.1
899dist_man1_MANS = src/util/mtnopt.1 extra/bin/mtn-cleanup.1
900
901# All local variants of automake-supported targets here, depending on all
902# the things we want to do. This is to support multiple things to do in
903# each of them, as dependencies.
904all-local: all-nls
905install-data-local: install-nls \
906install-contrib-data install-examples-data
907uninstall-local: uninstall-nls \
908uninstall-contrib-data uninstall-examples-data
909mostlyclean-local: mostlyclean-tests mostlyclean-util
910check-local: check-testers
911
912# All hooks supported by automake here, depending on all the things we want
913# to hook in. This is to support multiple things into the same hook, as
914# dependencies.
915distcheck-hook: distcheck-base.hh
916dist-hook: dist-nls
917# Kill off any backup files that got pulled in by one of the
918# recursive subdirectory includes in EXTRA_DIST
919# note use of slightly non-portable "-delete" action
920find $(distdir) \( -name '*.bak' -o -name '*.orig' -o -name '*.rej' \
921 -o -name '*~' -o -name '#*#' -o -name '*.swp' \) -delete
922
923mtn.1: mtn$(EXEEXT)
924$(AM_V_GEN)REAL_BLDDIR=$(abs_topbuilddir); \
925(cd $(srcdir) && $$REAL_BLDDIR/mtn manpage --norc) 2>/dev/null >$@ || rm -f $@
926
927doc/monotone.dvi: dvi
928doc/monotone.pdf: pdf
929doc/monotone.ps: ps
930doc/html doc/monotone.html: html
931
932# Not really phony, but the only way to make sure we wander into
933# the subdirectory and do the build with dependencies and all.
934.PHONY: doc/monotone.dvi doc/monotone.pdf doc/monotone.ps doc/monotone.html \
935doc/html
936
937# Verbosity goo.
938V_bcxx = $(V_bcxx_$(V))
939V_bcxx_ = $(V_bcxx_$(AM_DEFAULT_VERBOSITY))
940V_bcxx_0 = @echo " BCXX " $@;
941
942V_txt2c = $(V_txt2c_$(V))
943V_txt2c_ = $(V_txt2c_$(AM_DEFAULT_VERBOSITY))
944V_txt2c_0 = @echo " TXT2C " $@;
945
946V_subst = $(V_subst_$(V))
947V_subst_ = $(V_subst_$(AM_DEFAULT_VERBOSITY))
948V_subst_0 = @echo " SUBST " $@;
949
950V_xgettext = $(V_xgettext_$(V))
951V_xgettext_ = $(V_xgettext_$(AM_DEFAULT_VERBOSITY))
952V_xgettext_0 = @echo "XGETTEXT" $@;
953
954V_msgfmt = $(V_msgfmt_$(V))
955V_msgfmt_ = $(V_msgfmt_$(AM_DEFAULT_VERBOSITY))
956V_msgfmt_0 = @echo " MSGFMT" $@;
957
958V_msgmerge = $(V_msgmerge_$(V))
959V_msgmerge_ = $(V_msgmerge_$(AM_DEFAULT_VERBOSITY))
960V_msgmerge_0 = @echo "MSGMERGE" $@;
961
962V_makeinfo = $(V_makeinfo_$(V))
963V_makeinfo_ = $(V_makeinfo_$(AM_DEFAULT_VERBOSITY))
964V_makeinfo_0 = @echo "MAKEINFO" $@;

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status