#
# Makefile.in:  template Makefile for Subversion
#
# ====================================================================
# Copyright (c) 2000-2004 CollabNet.  All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.  The terms
# are also available at http://subversion.tigris.org/license-1.html.
# If newer versions of this license are posted there, you may use a
# newer version instead, at your option.
#
# This software consists of voluntary contributions made by many
# individuals.  For exact contribution history, see the revision
# history and logs, available at http://subversion.tigris.org/.
# ====================================================================
#

top_builddir = .
top_srcdir = @top_srcdir@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
VPATH = @top_srcdir@

SVN_RA_LIB_DEPS = @SVN_RA_LIB_DEPS@
SVN_RA_LIB_INSTALL_DEPS = @SVN_RA_LIB_INSTALL_DEPS@
SVN_RA_LIB_LINK = @SVN_RA_LIB_LINK@

SVN_FS_LIB_DEPS = @SVN_FS_LIB_DEPS@
SVN_FS_LIB_INSTALL_DEPS = @SVN_FS_LIB_INSTALL_DEPS@
SVN_FS_LIB_LINK = @SVN_FS_LIB_LINK@

DOC_DIRS = doc/programmer/design doc/misc-docs

SWIG_SRC_DIR = $(abs_srcdir)/subversion/bindings/swig
SWIG_BUILD_DIR = $(abs_builddir)/subversion/bindings/swig

EXTERNAL_PROJECT_DIRS = @SVN_SUBDIRS@

NEON_LIBS = @NEON_LIBS@
SVN_APR_LIBS = @SVN_APR_LIBS@
SVN_APRUTIL_LIBS = @SVN_APRUTIL_LIBS@
SVN_DB_LIBS =

LIBS = @LIBS@

prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
fsmod_libdir = @libdir@
ramod_libdir = @libdir@
dav_libdir = @libdir@
bdb_libdir = @libdir@
bindir = @bindir@
includedir = @includedir@
mandir = @mandir@
srcdir = @srcdir@
infodir = @infodir@
datadir = @datadir@
docdir = @docdir@
localedir = @localedir@

# where to install libsvn_swig_*
swig_py_libdir = @libdir@
swig_pl_libdir = @libdir@
swig_rb_libdir = @libdir@

### these possibly need further discussion
swig_pydir = @libdir@/svn-python/libsvn
swig_pydir_extra = @libdir@/svn-python/svn
swig_pldir = @libdir@/svn-perl
swig_rbdir = $(SWIG_RB_SITE_ARCH_DIR)/svn/ext

javahl_javadir = @libdir@/svn-javahl
javahl_javahdir = @libdir@/svn-javahl/include
javahl_libdir = @libdir@

### should search for these...
MAKEINFO = @MAKEINFO@
TEXI2DVI = texi2dvi
DVIPS = dvips
DVIPDF = dvipdf
MSGFMT = @MSGFMT@
MSGFMTFLAGS = @MSGFMTFLAGS@
MSGMERGE = @MSGMERGE@
XGETTEXT = @XGETTEXT@

PACKAGE_NAME=@PACKAGE_NAME@
PACKAGE_VERSION=@PACKAGE_VERSION@

CC = @CC@
CXX = @CXX@
EXEEXT = @EXEEXT@

SHELL = @SHELL@
LIBTOOL = @SVN_LIBTOOL@
LTFLAGS = @SVN_LT_CCTAG@ --silent
LTCXXFLAGS = @SVN_LT_CXXTAG@ --silent
LT_LDFLAGS = @LT_LDFLAGS@
LT_NO_UNDEFINED = @LT_NO_UNDEFINED@
LT_CXX_LIBADD = @LT_CXX_LIBADD@

INCLUDES = @SVN_EXTRA_INCLUDES@ @SVN_NEON_INCLUDES@                    \
           @SVN_APR_INCLUDES@ @SVN_APRUTIL_INCLUDES@

APACHE_INCLUDES = @APACHE_INCLUDES@
APACHE_TARGET = @APACHE_TARGET@
APACHE_LIBEXECDIR = $(DESTDIR)@APACHE_LIBEXECDIR@

SWIG = @SWIG@
SWIG_VERSION = @SWIG_VERSION@
SWIG_LIBSWIG_DIR = @SWIG_LIBSWIG_DIR@
SWIG_INCLUDES = -I$(SWIG_SRC_DIR) \
                -I$(abs_srcdir)/subversion/include \
                -I$(SWIG_LIBSWIG_DIR) \
                -DSVN_SWIG_VERSION=$(SWIG_VERSION) \
                -DSWIG_TABLE_TYPE=subversion \
                $(SVN_APR_INCLUDES) $(SVN_APRUTIL_INCLUDES)
SWIG_NORUNTIME_FLAG = @SWIG_NORUNTIME_FLAG@
SWIG_LDFLAGS = @SWIG_LDFLAGS@
SWIG_PY_INCLUDES = @SWIG_PY_INCLUDES@ -I$(SWIG_SRC_DIR)/python/libsvn_swig_py
SWIG_PY_COMPILE = @SWIG_PY_COMPILE@
SWIG_PY_LINK = @SWIG_PY_LINK@
SWIG_PY_LIBS = @SWIG_PY_LIBS@
SWIG_PL_INCLUDES = @SWIG_PL_INCLUDES@
SWIG_RB_INCLUDES = @SWIG_RB_INCLUDES@ -I$(SWIG_SRC_DIR)/ruby/libsvn_swig_ruby
SWIG_RB_COMPILE = @SWIG_RB_COMPILE@
SWIG_RB_LINK = @SWIG_RB_LINK@
SWIG_RB_SITE_LIB_DIR = @SWIG_RB_SITE_LIB_DIR@
SWIG_RB_SITE_ARCH_DIR = @SWIG_RB_SITE_ARCH_DIR@
LSWIGPL = @LSWIGPL@
LSWIGPY = @LSWIGPY@

JAVAHL_INCLUDES= @JNI_INCLUDES@ -I$(abs_builddir)/subversion/bindings/java/javahl/include

SVN_APR_INCLUDES = @SVN_APR_INCLUDES@
SVN_APR_PREFIX = @SVN_APR_PREFIX@
SVN_APRUTIL_INCLUDES = @SVN_APRUTIL_INCLUDES@
SVN_APRUTIL_PREFIX = @SVN_APRUTIL_PREFIX@

MKDIR = @MKDIR@

# the EXTRA_ exist so that extra flags can be passed at 'make' time
CFLAGS = @CFLAGS@ $(EXTRA_CFLAGS)
CPPFLAGS = @CPPFLAGS@ $(EXTRA_CPPFLAGS)
LDFLAGS = @LDFLAGS@ $(EXTRA_LDFLAGS)

COMPILE = $(CC) $(CPPFLAGS) $(CFLAGS) $(INCLUDES)
COMPILE_CXX = $(CXX) $(CPPFLAGS) $(CFLAGS) $(CXXFLAGS) $(INCLUDES)
LT_COMPILE = $(LIBTOOL) $(LTFLAGS) --mode=compile $(COMPILE)

# special compilation for files destined for mod_dav_svn
COMPILE_APACHE_MOD = $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) $(APACHE_INCLUDES) $(INCLUDES) -o $@ -c

# special compilation for files destined for libsvn_swig_* (e.g. swigutil_*.c)
COMPILE_SWIG_PY = $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) $(CPPFLAGS) -DSWIGPYTHON $(CFLAGS) $(SWIG_PY_INCLUDES) $(INCLUDES) -o $@ -c
COMPILE_SWIG_PL = $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) $(SWIG_PL_INCLUDES) $(INCLUDES) -o $@ -c
COMPILE_SWIG_RB = $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) $(SWIG_RB_INCLUDES) $(INCLUDES) -o $@ -c

# special compilation for files destined for javahl (i.e. C++)
COMPILE_JAVAHL_CXX = $(LIBTOOL) $(LTCXXFLAGS) --mode=compile $(COMPILE_CXX) $(JAVAHL_INCLUDES) -o $@ -c
COMPILE_JAVAHL_JAVAC = $(JAVAC) $(JAVAC_FLAGS)
COMPILE_JAVAHL_JAVAH = $(JAVAH)

LINK = $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(LT_LDFLAGS) $(CFLAGS) $(LDFLAGS) -rpath $(libdir)

# special link rule for mod_dav_svn
LINK_APACHE_MOD = $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(LT_LDFLAGS) $(CFLAGS) $(LDFLAGS) -rpath $(APACHE_LIBEXECDIR) -avoid-version -module

# these commands run SWIG to generate wrapper source files (*.c)
### should we protect against swig not being available?
RUN_SWIG_PY = $(SWIG) $(SWIG_NORUNTIME_FLAG) -python $(SWIG_INCLUDES) $(SWIG_PY_INCLUDES) -o $@
RUN_SWIG_RB = $(SWIG) -ruby $(SWIG_INCLUDES) $(SWIG_RB_INCLUDES) -o $@

# Compilation of SWIG-generated C source code
COMPILE_PY_WRAPPER = $(LIBTOOL) $(LTFLAGS) --mode=compile $(SWIG_PY_COMPILE) $(CPPFLAGS) $(SWIG_INCLUDES) $(SWIG_PY_INCLUDES) -prefer-pic -c -o $@
COMPILE_RB_WRAPPER = $(LIBTOOL) $(LTFLAGS) --mode=compile $(SWIG_RB_COMPILE) $(CPPFLAGS) $(SWIG_INCLUDES) $(SWIG_RB_INCLUDES) -prefer-pic -c -o $@

# these commands link the wrapper objects into an extension library/module
LINK_PY_WRAPPER = $(LIBTOOL) $(LTFLAGS) --mode=link $(SWIG_PY_LINK) $(SWIG_LDFLAGS) -rpath $(swig_pydir) -avoid-version -module
LINK_RB_WRAPPER = $(LIBTOOL) $(LTFLAGS) --mode=link $(SWIG_RB_LINK) $(SWIG_LDFLAGS) -rpath $(swig_rbdir) -avoid-version -module

LINK_JAVAHL_CXX = $(LIBTOOL) $(LTCXXFLAGS) --mode=link $(CXX) $(LT_LDFLAGS) $(CFLAGS) $(LDFLAGS) $(LT_CXX_LIBADD) -rpath $(libdir)

INSTALL = @INSTALL@
INSTALL_LIB = $(LIBTOOL) --mode=install $(INSTALL)
INSTALL_FSMOD_LIB = $(INSTALL_LIB)
INSTALL_RAMOD_LIB = $(INSTALL_LIB)
INSTALL_BDB_LIB = $(INSTALL_LIB)
INSTALL_DAV_LIB = $(INSTALL_LIB)
INSTALL_BIN = $(LIBTOOL) --mode=install $(INSTALL)
INSTALL_INCLUDE = $(INSTALL) -m 644
INSTALL_MOD_SHARED = @APXS@ -i -S LIBEXECDIR="$(APACHE_LIBEXECDIR)" @MOD_ACTIVATION@
INSTALL_MOD_STATIC = $(INSTALL) -m 644
INSTALL_DATA = $(INSTALL) -m 644
INSTALL_LOCALE = $(INSTALL_DATA)

### this isn't correct yet
INSTALL_SWIG_PY = $(INSTALL_LIB)
INSTALL_SWIG_PY_LIB = $(INSTALL_LIB)
INSTALL_SWIG_PL_LIB = $(INSTALL_LIB)
INSTALL_SWIG_RB = $(INSTALL_LIB)
INSTALL_SWIG_RB_LIB = $(INSTALL_LIB)

INSTALL_JAVAHL_LIB = $(INSTALL_LIB)

# additional installation rules for the SWIG wrappers
INSTALL_EXTRA_SWIG_PY=\
   $(top_srcdir)/build/copy-swig-py.sh "$(PYTHON)" "$(INSTALL_DATA)" "${SWIG_SRC_DIR}/python" "$(swig_pydir)" "$(DESTDIR)"; \
   $(top_srcdir)/build/copy-swig-py.sh "$(PYTHON)" "$(INSTALL_DATA)" "${SWIG_SRC_DIR}/python/svn" "$(swig_pydir_extra)" "$(DESTDIR)"; \
   if test $(abs_srcdir) != $(abs_builddir); then \
       $(top_srcdir)/build/copy-swig-py.sh "$(PYTHON)" "$(INSTALL_DATA)" "${SWIG_BUILD_DIR}/python" "$(swig_pydir)" "$(DESTDIR)"; \
   fi

# The path to generated and complementary source files for the SWIG
# bindings.
SWIG_PL_DIR = $(abs_builddir)/subversion/bindings/swig/perl
SWIG_RB_DIR = $(abs_builddir)/subversion/bindings/swig/ruby

### Automate JAR creation using Makefile generator's javahl-java.jar
### property.  Enhance generator to support JAR installation.
INSTALL_EXTRA_JAVAHL_JAVA=\
	$(JAR) cf subversion/bindings/java/javahl/svn-javahl.jar -C subversion/bindings/java/javahl/classes org; \
	$(INSTALL_DATA) subversion/bindings/java/javahl/svn-javahl.jar $(DESTDIR)$(javahl_javadir);

INSTALL_EXTRA_JAVAHL_LIB=@INSTALL_EXTRA_JAVAHL_LIB@

INSTALL_EXTRA_SWIG_RB=\
  @echo $(MKDIR) $(DESTDIR)$(SWIG_RB_SITE_LIB_DIR)/svn; \
  $(MKDIR) $(DESTDIR)$(SWIG_RB_SITE_LIB_DIR)/svn; \
  for i in $(abs_srcdir)/subversion/bindings/swig/ruby/svn/*.rb; do \
    echo $(INSTALL_DATA) "$$i" $(DESTDIR)$(SWIG_RB_SITE_LIB_DIR)/svn; \
    $(INSTALL_DATA) "$$i" $(DESTDIR)$(SWIG_RB_SITE_LIB_DIR)/svn; \
  done

APXS = @APXS@ 

PYTHON = @PYTHON@
PERL = @PERL@

JDK = @JDK@
JAVA = @JAVA@
JAVAC = @JAVAC@
JAVAC_FLAGS = @JAVAC_FLAGS@
JAVAH = @JAVAH@
JAR = @JAR@

JAVA_CLASSPATH=@JAVA_CLASSPATH@
javahl_java_CLASSPATH=$(JAVA_CLASSPATH)
javahl_tests_CLASSPATH=$(JAVA_CLASSPATH)

RUBY = @RUBY@

ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@

TESTS = $(TEST_PROGRAMS) @BDB_TEST_PROGRAMS@

all: external-all local-all
clean: external-clean local-clean
distclean: external-distclean local-distclean
extraclean: external-extraclean local-extraclean
install: external-install local-install revision-install

@INCLUDE_OUTPUTS@

local-all: @BUILD_RULES@

locale-gnu-pot:
	(cd $(abs_srcdir)/subversion/ ; \
	 find . \
	  -name .svn -prune -or \
	  -name tests -prune -or \
	  -name bindings -prune -or \
	  -name "*.c" -print -or \
	  -name "svn_error_codes.h" -print | \
	 $(XGETTEXT) --sort-by-file -k_ -kN_ -kSVN_ERRDEF:3 \
	  --msgid-bugs-address=dev@subversion.tigris.org \
	  --add-comments --files-from=- -o po/subversion.pot )

# "make locale-gnu-po-update" updates all translations.
# "make locale-gnu-po-update PO=ll" updates only the ll.po file.
locale-gnu-po-update: locale-gnu-pot
	@if test "$(PO)" = "" ; then \
	  PO='*' ; \
	fi ; \
	(cd $(abs_srcdir)/subversion/po ; \
	 for i in $$PO.po ; do \
	   $(MSGMERGE) --sort-by-file --update $$i subversion.pot ; \
	 done )

# clean everything but the bulky test output, returning the system back
# to before 'make' was run.
fast-clean: doc-clean
	@list='$(BUILD_DIRS)'; for i in $$list; do                   \
            echo "Cleaning $$i ..." ;                                \
            (cd $$i && rm -f *.o *.lo *.la *.la-a *.spo *.mo && \
             rm -rf .libs) ; \
        done
	rm -f $(CLEAN_FILES)

# clean all but bulky test output, returning to before './configure' was run.
fast-distclean: fast-clean
	rm -f Makefile config.cache config.log config.status libtool \
              svn_private_config.h svn-config

# clean everything out, returning to before './autogen.sh' was run.
local-extraclean: local-distclean
	rm -f build-outputs.mk svn_private_config.h.in configure \
              ac-helpers/config.guess ac-helpers/config.sub      \
              ac-helpers/libtool.m4 ac-helpers/ltconfig          \
              ac-helpers/ltmain.sh

# clean everything, including test output.
local-clean: fast-clean check-clean @SWIG_CLEAN_RULES@ 

# clean everything, including test output.
local-distclean: fast-distclean check-clean

local-install: @INSTALL_RULES@

### HACK!! Find a better way to do this
revision-install:
	subversion/svnversion/svnversion $(top_srcdir) /repos/svn/trunk > $(DESTDIR)$(includedir)/subversion-1/svn-revision.txt

install-static: @INSTALL_STATIC_RULES@

# JavaHL target aliases
javahl: javahl-java javahl-javah javahl-lib @JAVAHL_TESTS_TARGET@
install-javahl: install-javahl-java install-javahl-javah install-javahl-lib
check-javahl: javahl
	@FIX_JAVAHL_LIB@
	$(JAVA) -Djava.library.path=@JAVAHL_OBJDIR@:$(libdir) -classpath $(javahl_tests_PATH):$(javahl_tests_CLASSPATH) org.tigris.subversion.javahl.tests.BasicTests

# "make check CLEANUP=true" will clean up directories for successful tests.
# "make check TESTS=subversion/tests/clients/cmdline/basic_tests.py"
#  will perform only basic tests (likewise for other tests).
check: $(TEST_DEPS) @BDB_TEST_DEPS@
	@if test "$(PYTHON)" != "none"; then                                 \
	  flags="--verbose";                                                 \
	  if test "$(CLEANUP)" != ""; then                                   \
	    flags="--cleanup $$flags";                                       \
	  fi;                                                                \
	  if test "$(BASE_URL)" != ""; then                                  \
	    flags="--url $(BASE_URL) $$flags";                               \
	  fi;                                                                \
	  if test "$(FS_TYPE)" != ""; then                                   \
	    flags="--fs-type $(FS_TYPE) $$flags";                            \
	  fi;                                                                \
	  $(PYTHON) $(top_srcdir)/build/run_tests.py $$flags                 \
		    '$(abs_srcdir)' '$(abs_builddir)' $(TESTS);              \
	else                                                                 \
	  echo "make check: Python 2.0 or greater is required,";             \
	  echo "            but was not detected during configure";          \
	  exit 1;                                                            \
	fi;

# First, set up Apache as documented in
# subversion/tests/clients/cmdline/README.
davcheck: 
	@$(MAKE) check BASE_URL=http://localhost

# Automatically configure and run Apache httpd on a random port, and then
# run make check.
davautocheck: 
	@sh $(top_srcdir)/subversion/tests/clients/cmdline/davautocheck.sh

# First, run:
#   subversion/svnserve/svnserve -d -r `pwd`/subversion/tests/clients/cmdline
svncheck: 
	@$(MAKE) check BASE_URL=svn://localhost

# First, run:
#   subversion/svnserve/svnserve --listen-host "::1" -d -r `pwd`/subversion/tests/clients/cmdline

svncheck6: 
	@$(MAKE) check BASE_URL=svn://\[::1\]

# First make sure you can ssh to localhost and that "svnserve" is in
# the path of the resulting shell.
svnsshcheck:
	@$(MAKE) check \
	  BASE_URL=svn+ssh://localhost`pwd`/subversion/tests/clients/cmdline

fsfscheck:
	@$(MAKE) check FS_TYPE=fsfs

check-clean:
	rm -rf subversion/tests/clients/cmdline/repositories   \
               subversion/tests/clients/cmdline/working_copies \
               subversion/tests/clients/cmdline/local_tmp      \
               subversion/tests/libsvn_fs_base/test-repo-*     \
               subversion/tests/libsvn_repos/test-repo-*       \
               subversion/tests/libsvn_subr/z                  \
               tests.log

mkdir-init:
	@list='$(BUILD_DIRS) $(DOC_DIRS)';                  \
        for i in $$list doc; do                         \
            if [ ! -d $$i ]; then                       \
                echo "mkdir $$i" ;                      \
                $(MKDIR) $$i ;                          \
            fi;                                         \
        done

# recursive targets to handle external projects (e.g. APR, Neon)
external-all external-install:
	@target=`echo $@ | sed s/external-//`;          \
        list='$(EXTERNAL_PROJECT_DIRS)';                \
        for i in $$list; do                             \
            echo "------ making $$target in $$i";       \
            (cd $$i && $(MAKE) $$target) || exit 1;     \
            echo "------ completed $$target in $$i";    \
        done;

### apr-util relies on generated files in apr, so reverse the
### list so that it is cleaned before apr.
external-clean external-distclean:
	@target=`echo $@ | sed s/external-//`;          \
        list='$(EXTERNAL_PROJECT_DIRS)';                \
        for i in $$list; do                             \
            revlist="$$i $$revlist";                    \
        done;                                           \
        for i in $$revlist; do                          \
            echo "------ making $$target in $$i";       \
            (cd $$i && $(MAKE) $$target) || exit 1;     \
            echo "------ completed $$target in $$i";    \
        done;

### temporary hack. Neon does not have an "extraclean" and neither does db
### If we don't have extraclean -- do the next best thing.
external-extraclean:
	@list='$(EXTERNAL_PROJECT_DIRS)';                                \
        for i in $$list; do                                              \
            revlist="$$i $$revlist";                                     \
        done;                                                            \
        for i in $$revlist; do                                           \
            if test "$$i" = "neon" || test "$$i" = "db/dist"; then       \
                echo "------ making distclean(no extraclean) in $$i";    \
                (cd $$i && $(MAKE) distclean) || exit 1;                 \
                echo "------ completed distclean(no extraclean) in $$i"; \
            else                                                         \
                echo "------ making extraclean in $$i";                  \
                (cd $$i && $(MAKE) extraclean) || exit 1;                \
                echo "------ completed extraclean in $$i";               \
            fi;                                                          \
        done;


# DOCUMENTATION RULES

# Every single document in every format.
doc: doc-design doc-misc-docs

# Build all types of a certain doc.
doc-misc-docs: doc-misc-docs-html doc-misc-docs-pdf doc-misc-docs-ps
doc-design: doc-design-info doc-design-html doc-design-txt

# Build all docs of a certain type.
doc-all-html: doc-design-html doc-misc-docs-html
doc-all-pdf: doc-design-pdf doc-misc-docs-pdf
doc-all-ps: doc-design-ps doc-misc-docs-ps
doc-all-info: doc-design-info

# Different outputs for the 'design' document, written in texinfo.
# Assumes you have {makeinfo, texi2dvi, dvips, dvipdf} installed.
doc-design-info: doc/programmer/design/svn-design.info
doc-design-html: doc/programmer/design/svn-design.html
doc-design-txt: doc/programmer/design/svn-design.txt
doc-design-dvi: doc/programmer/design/svn-design.dvi
doc-design-ps: doc/programmer/design/svn-design.ps
doc-design-pdf: doc/programmer/design/svn-design.pdf

# Different outputs for the misc docs.
# Assumes you have {xsltproc, fop, stylesheets} installed.
doc-misc-docs-html:
	cd $(top_srcdir)/doc && $(MAKE) misc-docs-html
doc-misc-docs-pdf:
	cd $(top_srcdir)/doc && $(MAKE) misc-docs-pdf
doc-misc-docs-ps:
	cd $(top_srcdir)/doc && $(MAKE) misc-docs-ps


doc-clean:
	for d in $(DOC_DIRS);                               \
        do                                                  \
            (cd $$d;                                        \
             rm -f *.info *.info-[1-9]                      \
                   *.aux *.cp *.fn *.ky *.log *.pg *.toc    \
                   *.tp *.vr                                \
                   *.dvi *.txt *.html *.ps *.pdf *.fo);     \
        done

#
# Implicit rules for creating outputs from input files
#
.SUFFIXES:
.SUFFIXES: .c .lo .o .la-a .la .texi .info .dvi .txt .html .ps .pdf \
           .po .spo .mo

.c.o:
	$(COMPILE) -o $@ -c $<

.c.lo:
	$(LT_COMPILE) -o $@ -c $<

.la.la-a:
	sed "/library_names/s/'.*'/''/" $< > $@


.texi.info:
	$(MAKEINFO) -I `dirname $<` -o $@ $< 

.texi.dvi:
	wd=`pwd` ; cd `dirname $@` ; $(TEXI2DVI) $$wd/$<

.texi.txt:
	$(MAKEINFO) -I `dirname $<` --no-headers -o $@ $<

.texi.html:
	$(MAKEINFO) -I `dirname $<` --no-split --html -o $@ $<

.dvi.ps:
	$(DVIPS) $< -o $@

.dvi.pdf:
	$(DVIPDF) $< $@

# Strip the Content-Type: header from the po file if we don't have a
# gettext that supports bind_textdomain_codeset, so it doesn't try
# to convert our UTF-8 .po files to the locale encoding.
@NO_GETTEXT_CODESET@.po.spo:
@NO_GETTEXT_CODESET@	sed \
@NO_GETTEXT_CODESET@	'/^"Content-Type: text\/plain; charset=UTF-8\\n"$$/d' \
@NO_GETTEXT_CODESET@	$< > $@

@NO_GETTEXT_CODESET@.spo.mo:
@NO_GETTEXT_CODESET@	$(MSGFMT) $(MSGFMTFLAGS) -o $@ $<

# For systems with bind_textdomain_codeset, just leave the Content-Type:
# header alone.
@GETTEXT_CODESET@.po.mo:
@GETTEXT_CODESET@	$(MSGFMT) $(MSGFMTFLAGS) -o $@ $<


install-docs: install-man @INSTALL_INFO@

manroot = $(mandir)/man
install-man:
	@list='$(MANPAGES)';                                               \
        for i in $$list; do                                                \
          if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i;               \
          else file=$$i; fi;                                               \
          ext=`echo $$i | sed -e 's/^.*\\.//'`;                            \
          $(MKDIR) $(DESTDIR)$(manroot)$$ext;                              \
          inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`;                   \
          inst=`echo $$inst | sed -e 's/^.*\///'`;                         \
          inst=`echo $$inst`.$$ext;                                        \
          echo "$(INSTALL_DATA) $$file $(DESTDIR)$(manroot)$$ext/$$inst";  \
          $(INSTALL_DATA) $$file $(DESTDIR)$(manroot)$$ext/$$inst;         \
        done

install-info: doc-all-info
	$(MKDIR) $(DESTDIR)$(infodir)
	@list='$(INFOPAGES)';                                         \
        for i in $$list; do                                           \
          if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i;          \
          else file=$$i; fi;                                          \
          inst=`echo $$file | sed -e 's/^.*\///'`;                    \
          echo "$(INSTALL_DATA) $$file $(DESTDIR)$(infodir)/$$inst";  \
          $(INSTALL_DATA) $$file $(DESTDIR)$(infodir)/$$inst;         \
        done

install-swig-py: install-swig-py-lib
install-swig-rb: install-swig-rb-lib

$(SWIG_PL_DIR)/native/Makefile: $(SWIG_PL_DIR)/native/Makefile.PL
	cd $(SWIG_PL_DIR)/native; $(PERL) Makefile.PL

swig-pl_DEPS = libsvn_client libsvn_delta libsvn_diff libsvn_fs libsvn_ra libsvn_repos libsvn_subr libsvn_wc libsvn_swig_perl $(SWIG_PL_DIR)/native/Makefile
swig-pl: $(swig-pl_DEPS)
	cd $(SWIG_PL_DIR)/native; $(MAKE)

check-swig-pl: swig-pl swig-pl-lib
	cd $(SWIG_PL_DIR)/native; $(MAKE) test

install-swig-pl: swig-pl install-swig-pl-lib
	cd $(SWIG_PL_DIR)/native; $(MAKE) install

clean-swig-pl: $(SWIG_PL_DIR)/native/Makefile
	cd $(SWIG_PL_DIR)/native; $(MAKE) clean

check-swig-rb: swig-rb svnserve
	cd $(SWIG_RB_DIR); $(RUBY) test/run-test.rb

clean-swig-rb:
	for d in $(SWIG_RB_DIR) $(SWIG_RB_DIR)/libsvn_swig_ruby; \
	do \
	  cd $$d; \
	  rm -rf svn_*.c _*.c core.c *.lo *.la *.o .libs; \
	done
