This is the mail archive of the automake@gnu.org mailing list for the automake project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Deep packages, constructing the configure.am and Makefile.am


Alexandre Oliva wrote:
> 
> On Jun 16, 1999, Alex Hornby <alex@anvil.co.uk> wrote:
> 
> > I would like my package to find all Makefile.am's at configure, as
> > this would make adding separate test directories easier. I cannot work
> > out the m4 magic to dynamically set up the AC_OUTPUT line.
> 
> How about adding to Makefile.am:
> 
> $(srcdir)/configure.in: $(srcdir)/configure.inn
>         Makefiles=`(cd $(srcdir) && find . -name Makefile.am -print) | \
>                     sed 's,\.am$,,'`; \
>         sed < $(srcdir)/configure.inn > $@t "s%@Makefiles@%$Makefiles%"
>         rm -f $@
>         mv $@t $@
> 
> Then, in configure.inn, write:
> 
> AC_OUTPUT([@Makefiles@])
> 
I would like to point out, that this won't work for srcdir != builddir
as the toplevel directory in a hierarchy is found after the subdirs.
My current aproach (following the basic idea) is to sort the output
after
slashes. If someone has a better idea, let me know.

The current code looks like this:

# I consider the following a bad hack. But I couldn't come up with a
# solution without case. If someone has, let me know
# The Makefiles have to be sorted for slashes, since configure creates
# only one directory per Makefile not the whole hierarchy
configure.in: configure.in.in subdirs
        @mfs=`find . -name Makefile.am -print | sed -e "s#\.am##" | sed
-e "s#\./##" | sort -r`; \
        maxslashes=1; \
        for i in $$mfs; do \
          slashes=`echo $$i | sed -e "s#[^/]##g" | wc -c | sed
"s#[^0123456789]##g"`; \ 
          case "$$slashes" in \
          1) list_1="$$list_1 $$i";;\
          2) list_2="$$list_2 $$i";;\
          3) list_3="$$list_3 $$i";;\
          4) list_4="$$list_4 $$i";;\
          5) list_5="$$list_5 $$i";;\
          6) list_6="$$list_6 $$i";;\
          *) list_big="$$list_big $$i";;\
         esac ;\
        done ;\
        cp -f configure.in.in configure.in ;\
        for i in $$list_big $$list_6 $$list_5 $$list_4 $$list_3 \
                $$list_2 $$list_1; do \   
        sed -e "s#AC_OUTPUT(#AC_OUTPUT($$i #" configure.in >
configure.in.new \
         && mv configure.in.new configure.in ;\
        done        


Greetings, Stephan

-- 
Und sie nannten ihn, wie er selbst unterschrieb -
Den Trojanischen Pferdedieb


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]