[Top][All Lists]

[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,, etc.

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

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 and an
upper 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 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 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 to, and adjust

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



reply via email to

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