automake
[Top][All Lists]
Advanced

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

Generated Makefiles for multiple platforms


From: BRM
Subject: Generated Makefiles for multiple platforms
Date: Tue, 13 Dec 2005 13:20:04 -0800 (PST)

I am working on learning the GNU AutoTools. So far, I
have had quite success with the basics. However, I am
now trying to figure out something a little more
advanced that I need for the project that I will be
using them for, where I have to support multiple
operating systems and multiple cpu architectures.

I have created a simple hello world program that I
have been exanding out for use and am primarily
testing under MSYS using automake 1.7.1 (it's what
comes with the MSYS DTK). In the test project, I have
a directory structure like the following:

src
src\os
src\os\linux
src\os\mingw32
src\arch\i386
src\arch\i686
src\arch\ppc

My main program (main.c and hello.c) are located in
src, along with all of my autotool files. Under each
subdirectory (os and arch), I have a header file (os.h
and arch.h) and Makefile.am with a rule like the
following:

SUBDIRS = @target_os@

or 

SUBDIRS = @target_cpu@

And then in each of the subdirectory's subdirectories
(e.g. the sub-directories to os and arch), I have an
implementation file (os.c and arch.c) where it prints
out line of text declaring what it is (e.g "Arch:
i386"). I also have a Makefile.am like the following:

hello_world_SOURCES = os.c

or

hello_world_SOURCES = arch.c


My primary Makefile.am declares the following:

bin_PROGRAM = hello_world
hello_world_SOURCES = hello.c main.c
SUBDIRS = os arch

The problem I am running into is that I am having
trouble getting automake to find the architecture
subdirectories.  According to the Autobook
documentation, automake takes input from configure.ac,
and that I need to have an output line for every
Makefile. My configure.ac has the following at the
end:

AC_OUTPUT([Makefile])
AC_OUTPUT([os\Makefile])
AC_OUTPUT([arch\Makefile])

I am trying to figure out what I need to get the next
directory lower to have its Makefile generated. If I
put a static line like the following:

AC_OUTPUT([arch\i386\Makefile])

then it will work, and I will have a Makefile.in in
src\arch\i386\Makefile. However, I don't want to
needlessly configure all of the sub-directories. I
have been trying the following:

AC_OUTPUT(arch\${target_cpu}\Makefile)

but automake fails with a line linke the following:

configure.ac:18: required file
`./os\${target_os}\Makefile.in' not found


At first I tried @target_cpu@ but then I came across
the documentation at the following link

http://tinyurl.com/btfmx

that described it and used ${target_cpu}.  What am I
doing wrong? Automake should be able to handle this
kind compilation, no? I have been looking through the
Autobook and done a few google searches, but haven't
really turned up anything that seems to approach the
subject - most refer to it under autoconf instead of
automake, and I would really like to have my build
environment be like the following:

aclocal && automake && autoconf && ./configure && make

from the maintainer's perspective after checking out
from SVN, and to only have the necessary directories
configured (e.g. only ppc on a PowerPC system and not
i686 and i386; likewise, only i686 on an i686 system,
not ppc or i386).

Any help would be greatly appreciated.

TIA,

Ben




reply via email to

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