[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: Sat, 5 Nov 2011 22:57:55 -0500

Greg Stein wrote:
> On Nov 5, 2011 6:06 AM, "Philip Martin" <philip.martin_at_wandisco.com> wrote:

>> We have a mkdir-init target in the Makefile that is supposed to create
>> the build directories.
>
> Right. It creates what is needed rather than a scattershot hope.

Thanks for the pointer. Running "make mkdir-init" works fine.

> Jonathan: can you adjust mkdir-init to include *just* the directories
> necessary, that you've found through your new test?

It seems that the patch should look like this, then:

[[[
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
  (external-all, external-install): Depend on mkdir-init.
  ($(SWIG_PL_DIR)/native/Makefile.PL): Likewise.
  (swig-pl): Likewise.
  ($(SWIG_PY_DIR)/libsvn): Likewise.

  (external-clean, external-distclean): Check if directories exist
    before cleaning them.
  (external-extraclean): Likewise.
  (schema-clean): Likewise.
  (clean-swig-py): Likewise.
  (clean-swig-rb): Likewise.
]]]

Index: Makefile.in
===================================================================
--- Makefile.in (revision 1198126)
+++ Makefile.in (working copy)
@@ -557,7 +557,7 @@ mkdir-init:
         done
 
 # 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 \
@@ -569,34 +569,38 @@ mkdir-init:
 ### 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='$(SVN_EXTERNAL_PROJECT_SUBDIRS)'; \
- 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"; \
+ @target=`echo $@ | sed s/external-//`; \
+ list='$(SVN_EXTERNAL_PROJECT_SUBDIRS)'; \
+ for i in $$list; do \
+ revlist="$$i $$revlist"; \
+ done; \
+ for i in $$revlist; do \
+ if [ -d $$i ]; then \
+ echo "------ making $$target in $$i"; \
+ (cd $$i && $(MAKE) $$target) || exit 1; \
+ echo "------ completed $$target in $$i"; \
+ fi; \
         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='$(SVN_EXTERNAL_PROJECT_SUBDIRS)'; \
- 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; \
+ @list='$(SVN_EXTERNAL_PROJECT_SUBDIRS)'; \
+ for i in $$list; do \
+ revlist="$$i $$revlist"; \
+ done; \
+ for i in $$revlist; do \
+ if test -d $$i; then \
+ 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; \
+ fi; \
         done;
 
 
@@ -648,7 +652,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
@@ -736,7 +742,8 @@ clean-swig-headers:
 extraclean-swig-headers: clean-swig-headers
         $(EXTRACLEAN_SWIG_HEADERS)
 
-$(SWIG_PL_DIR)/native/Makefile.PL: $(SWIG_SRC_DIR)/perl/native/Makefile.PL.in
+Makefile.PL_DEPS = mkdir-init $(SWIG_SRC_DIR)/perl/native/Makefile.PL.in
+$(SWIG_PL_DIR)/native/Makefile.PL: $(Makefile.PL_DEPS)
         ./config.status subversion/bindings/swig/perl/native/Makefile.PL
 
 $(SWIG_PL_DIR)/native/Makefile: $(SWIG_PL_DIR)/native/Makefile.PL
@@ -748,7 +755,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 +779,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 +790,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 +814,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 +843,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-06 04:58:43 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.