[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] configure: pre-create build directories for VPATH builds

From: Jonathan Nieder <jrnieder_at_gmail.com>
Date: Mon, 7 Nov 2011 12:45:19 -0600

Daniel Shahaf wrote:
> Jonathan Nieder wrote on Sat, Nov 05, 2011 at 22:57:55 -0500:

>> +++ Makefile.in (working copy)
[...]
>> # recursive targets to handle external projects (e.g. APR, Neon)
>> -external-all external-install:
>> +external-all external-install: mkdir-init
>> @target=`echo $@ | sed s/external-//`; \
>> list='$(SVN_EXTERNAL_PROJECT_SUBDIRS)'; \
>> for i in $$list; do \
>> echo "------ making $$target in $$i"; \
>> (cd $$i && $(MAKE) $$target) || exit 1; \
>
> What is this hunk needed for?
>
> mkdir creates ./doc and ./subversion/**/, why does the make target that
> recurses into apr/neon/etc need to create those dirs?

Good catch. I was looking for places that might try to cd into
a directory that does not exist yet, and this cannot possibly be one
--- immediately after changing directory, we call "make" to use a
Makefile there.

Reviewing the other parts:

>> * Makefile.in
>> (external-all, external-install): Depend on mkdir-init.

Superfluous, as you explained.

>> ($(SWIG_PL_DIR)/native/Makefile.PL): Likewise.

Not needed --- config.status knows how to create leading directories.

>> (swig-pl): Likewise.

Needed.

        cd . && /usr/bin/python
        ../build/generator/swig/checkout_swig_header.py
        /tmp/svn-test/BUILD/../build.conf /usr/bin/swig common.swg
        Traceback (most recent call last):
          File "../build/generator/swig/checkout_swig_header.py", line 85, in <module>
            gen.checkout(sys.argv[3])
          File "../build/generator/swig/checkout_swig_header.py", line 62, in checkout
            open(out, "w")
        IOError: [Errno 2] No such file or directory: 'subversion/bindings/swig/proxy/common.swg'

>> ($(SWIG_PY_DIR)/libsvn): Likewise.

Needed.

        mkdir /tmp/svn-test/BUILD/subversion/bindings/swig/python/libsvn
        mkdir: cannot create directory `/tmp/svn-test/BUILD/subversion/bindings/swig/python/libsvn': No such file or directory
        make: *** [/tmp/svn-test/BUILD/subversion/bindings/swig/python/libsvn] Error 1

>> (external-clean, external-distclean): Check if directories exist
>> before cleaning them.
>> (external-extraclean): Likewise.

Not needed.

>> (schema-clean): Likewise.

Not really needed (since who is going to call the schema-clean
target?), but seems nice to have.

>> (clean-swig-py): Likewise.
>> (clean-swig-pl): Likewise.
>> (clean-swig-rb): Likewise.

Needed.

[[[
Allow "make extraclean-swig" and "make swig-pl" in VPATH builds without
requiring the user to run "make mkdir-init" by hand first.

* Makefile.in
  (swig-pl, $(SWIG_PY_DIR)/libsvn): Depend on mkdir-init.
  (schema-clean, clean-swig-pl, clean-swig-py, clean-swig-rb): Check if
    directories exist before cleaning them.

Review by: philip
           danielsh
(philip noticed that this should use mkdir-init instead of reimplementing
it poorly. danielsh helped pare down the patch.)
]]]

Index: Makefile.in
===================================================================
--- Makefile.in (revision 1198570)
+++ Makefile.in (working copy)
@@ -648,7 +648,9 @@ schema-xsd: $(SCHEMAS_XSD)
 $(SCHEMAS_RNG) $(SCHEMAS_DTD) $(SCHEMAS_XSD): $(SCHEMA_DIR)/common.rnc
 
 schema-clean:
- (cd $(SCHEMA_DIR) && rm -f *.rng *.dtd *.xsd)
+ if test -d $(SCHEMA_DIR); then \
+ (cd $(SCHEMA_DIR) && rm -f *.rng *.dtd *.xsd); \
+ fi
 
 #
 # Implicit rules for creating outputs from input files
@@ -748,7 +750,7 @@ $(SWIG_PL_DIR)/native/Makefile: $(SWIG_PL_DIR)/nat
 READLINK_PY=$(PYTHON) -c 'import sys,os; print(os.path.realpath(sys.argv[1]))'
 READLINK_PL=$(PERL) -e 'use Cwd; print Cwd::realpath(shift)'
 
-swig-pl_DEPS = autogen-swig-pl libsvn_swig_perl \
+swig-pl_DEPS = mkdir-init autogen-swig-pl libsvn_swig_perl \
   $(SWIG_PL_DIR)/native/Makefile
 swig-pl: $(swig-pl_DEPS)
         if test "`$(READLINK_PL) $(SWIG_PL_DIR)`" != "`$(READLINK_PL) $(SWIG_PL_SRC_DIR)`"; then \
@@ -772,11 +774,10 @@ clean-swig-pl:
         if test -z "$(RELEASE_MODE)"; then \
           $(EXTRACLEAN_SWIG_PL); \
         fi
- for d in $(SWIG_PL_DIR)/libsvn_swig_perl; \
- do \
- cd $$d; \
+ if [ -d "$(SWIG_PL_DIR)/libsvn_swig_perl" ]; then \
+ cd "$(SWIG_PL_DIR)/libsvn_swig_perl"; \
           rm -rf *.lo *.la *.o .libs; \
- done
+ fi
         if [ -f "$(SWIG_PL_DIR)/native/Makefile" ]; then \
           cd $(SWIG_PL_DIR)/native; $(MAKE) clean; \
         fi
@@ -784,7 +785,7 @@ clean-swig-pl:
 extraclean-swig-pl: clean-swig-pl
         $(EXTRACLEAN_SWIG_PL)
 
-$(SWIG_PY_DIR)/libsvn:
+$(SWIG_PY_DIR)/libsvn: mkdir-init
         mkdir $(SWIG_PY_DIR)/libsvn
 
 copy-swig-py: autogen-swig-py $(SWIG_PY_DIR)/libsvn
@@ -808,9 +809,14 @@ clean-swig-py:
         fi
         for d in $(SWIG_PY_DIR) $(SWIG_PY_DIR)/libsvn_swig_py; \
         do \
- cd $$d && rm -rf *.lo *.la *.o *.pyc .libs; \
+ if test -d $$d; then \
+ cd $$d && rm -rf *.lo *.la *.o *.pyc .libs; \
+ fi; \
         done
- find $(SWIG_PY_SRC_DIR) $(SWIG_PY_DIR) -name "*.pyc" -exec rm {} ';'
+ find $(SWIG_PY_SRC_DIR) -name "*.pyc" -exec rm {} ';'
+ if test -d $(SWIG_PY_DIR); then \
+ find $(SWIG_PY_DIR) -name "*.pyc" -exec rm {} ';'; \
+ fi
 
 extraclean-swig-py: clean-swig-py
         $(EXTRACLEAN_SWIG_PY)
@@ -832,8 +838,10 @@ clean-swig-rb:
         fi
         for d in $(SWIG_RB_DIR) $(SWIG_RB_DIR)/libsvn_swig_ruby; \
         do \
- cd $$d; \
- rm -rf *.lo *.la *.o .libs; \
+ if test -d $$d; then \
+ cd $$d; \
+ rm -rf *.lo *.la *.o .libs; \
+ fi; \
         done
 
 extraclean-swig-rb: clean-swig-rb
Received on 2011-11-07 19:45:56 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.