[Top][All Lists]

[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:


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 with a rule like the

SUBDIRS = @target_os@


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 like the following:

hello_world_SOURCES = os.c


hello_world_SOURCES = arch.c

My primary 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,
and that I need to have an output line for every
Makefile. My has the following at the


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:


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


but automake fails with a line linke the following: required file
`./os\${target_os}\' not found

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

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.



reply via email to

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