automake
[Top][All Lists]
Advanced

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

Re: place automake files separately from source files


From: Ralf Wildenhues
Subject: Re: place automake files separately from source files
Date: Sun, 27 Sep 2009 11:01:09 +0200
User-agent: Mutt/1.5.20 (2009-08-09)

Hello Andy,

* Andy Tai wrote on Sat, Sep 26, 2009 at 08:13:06PM CEST:
> Hi, I wonder if there is a way to place the GNU autotools files in a source
> tree in a subdirectory from the source files, such as
> 
> if I have sources files
> 
> source1.c source2.c
> 
> and there may be a Makefile in this directory as well, as common in a simple
> project from a third party source that does not use automake/autoconf.  Now
> I want to add automake support.  Can I create a subdirectory in parallel
> with source{1,2}.c, say I call it build_system
> and then in build_system I will place the top level GNU automake files such
> as Makefile.am, configure.ac, etc.

Not easily.  When transitioning from hand-written makefiles to
automake-generated ones, you have a couple of possible strategies
though:

Assuming the old build system is recursive, and recursion mostly happens
with plain `cd SUBDIR && $(MAKE)', you should be able to replace files
one by one.  Of course, that may require adjusting configure.ac and an
upper Makefile.am in each step.

Another possible strategy is to require the user to use GNU make and
VPATH builds only; that way, the source tree may have old Makefile files
and the build tree will have the new generated ones.  This is pretty
fragile as it depends on time stamp ordering and the specific VPATH
semantics used by GNU make only, so I'd advise against it.

It is possible to use different names than Makefile.am for the automake
input files, with a caveat: in recursion rules, automake outputs plain
`$(MAKE)' only, without -f.  That still allows the following: for the
transition time, you can require GNU make to be used, and use only files
named GNUmakefile.am for automake.  The generated GNUmakefile files will
be read and executed by GNU make instead of any Makefile files then.

After the transition is done, you could remove all old Makefile files,
rename all GNUmakefile.am to Makefile.am, and adjust configure.ac.

For more information, see
  info make "Makefile names"
  info Automake Requirements
  info Automake Rebuilding

HTH.

Cheers,
Ralf




reply via email to

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