autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

how to handle new subdirectories?


From: Steffen Dettmer
Subject: how to handle new subdirectories?
Date: Tue, 2 Mar 2010 16:25:50 +0100

Hi,

how to handle new subdirectories?

1) new automake but no new autoconf directories:

For new subdirectories with new Makefile.am autoconf/automake
fails because Makefile.in seems not to be created automatically,
so we usually add in configure.in a call to a macro similar like
that:

------------------------------------------------------------------->8=======
AC_DEFUN([IC_NEW_AUTOMAKE_DIRECTORY],
[
  dir="$1"
  Makefile="$dir/Makefile"
  dnl Trying to avoid that reconfigure fails because of the new
  dnl    directory - we simply call ./config.status.
  if ! test -e $Makefile ; then
    dnl ... specific stuff here ...
    autoreconf $srcdir || exit 9
    dnl New directories often have new source files, just in case,
    dnl   let's run the depfiles command
    ./config.status depfiles $Makefile || exit 9
    if test -e $Makefile ; then
      AC_MSG_NOTICE([   (looks good)])
    else
      AC_MSG_WARN([Sorry, should not happen, but I could not create $Makefile])
    fi
  fi
]
)
=======8<-------------------------------------------------------------------


How to do this better/correctly?




2) new autoconf directories:

The macro from above works for new subdirectories with
Makefile.am but not for new configure.in files
(AC_CONFIG_SUBDIRS). I tried to write something similar for this
case, but had no idea how to do that.

We usually have a high level Makefile to iterate all build
directories (all the cross compiling configurations). This is
simple because for each cross compiling configuration configure
is called in a subdirectory build/<platform-string>, so we have
build/Makefile with

------------------------------------------------------------------->8=======
DIRS=$(shell cat .subdirs)

# required for 'make' without explicit target to work
all:
        for dir in $(DIRS) ; do \
          make -C $$dir $@ || exit 5; \
        done;

.DEFAULT:
        for dir in $(DIRS) ; do \
          make -C $$dir $@ || exit 5; \
        done;
=======8<-------------------------------------------------------------------

via top level configure we can run autoreconf and later (auto-)make
invokes some ./config.status --recheck which gets --no-create
--no-recursion. By this, the newdirectory/configure
script isn't run for build/* and thus no
build/*/newdirectory/Makefile are created and make aborts (no
rule to make target).

I tried to run in build/*/ something like `./config.status
--recheck --recursion --create' doesn't work.

So the only way I found was to use some `topsrcdir/Makefile.am':

recheck-recursive:
        @echo "In directory `pwd`:"
        ../../configure `cat .config-opts`

and then run `make -C build recheck-recursive' and `make -C build'.

This seems to work but has the disadvantage that all config.h
files of course are recreated and thus really everything is
recompiled completely.

Are there simple ways to improve this?

oki,

Steffen




reply via email to

[Prev in Thread] Current Thread [Next in Thread]