[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Generated Makefiles for multiple platforms
From: |
Ralf Wildenhues |
Subject: |
Re: Generated Makefiles for multiple platforms |
Date: |
Mon, 19 Dec 2005 11:02:52 +0100 |
User-agent: |
Mutt/1.5.11 |
Hi Ben,
* BRM wrote on Sun, Dec 18, 2005 at 10:15:20PM CET:
> After reading through all the wisdom that has been
> given to me by this list, I have modified my test
> project to (a) generate all the Makefiles statically:
>
> AC_OUTPUT(Makefile, os/Makefile, os/linux/Makefile,
> os/mingw32/Makefile, etc.)
>
> I also added some AM_CONDITIONALs for each supported
> OS to my configure.ac like the following:
>
> AM_CONDITIONAL([TARGET_LINUX],[test ¨$target_os¨ =
> ¨linux¨])
>
> However, I am still having a few issues that I can´t
> figure out. Namely - ´make´ doesn´t want to recurse if
> I have the following in my os/Makefile.am:
>
> if TARGET_LINUX
> COMILE_OS = ¨linux¨
Please remove the quotes here, and note the typo.
COMPILE_OS = linux
> endif
> ...
> SUBDIRS = $(COMPILE_OS)
This should work.
> It will recurse if I change it to the following:
>
> SUBDIRS = @target_os@
automake needs to know the set of possible SUBDIRS at the time automake
runs (which means substitutions like @foo@ are forbidden) in order to
compute DIST_SUBDIRS, so this won't work. It should be possible to work
around this by setting DIST_SUBDIRS manually to all possible SUBDIRS.
By the way, this is very well documented in
http://sources.redhat.com/automake/automake.html#Conditional-Subdirectories
> I am also having trouble getting make to build the
> object file inside of the os/@target_cpu@ directory.
> If I do get it to recurse in, it returns with a
> ´all-am nothing to do´ type message without having
> build the os.o file. I have tried doing things like
> the following:
>
> hello_world_SOURCES = os.c
>
> SOURCES = os.c
>
> os_SOURCES = os.c
>
> however, in the case of ´SOURCES = os.c' is just
> doesn´t do anything. In the other two, it complains
> with the following:
>
> variable ´hello_world_SOURCES´ defined but no program
> or library has ´hello_world´ as canonic name (possible
> typo).
The question is: sources of what? Do like this:
bin_PROGRAMS = hello_world
hello_world_SOURCES = os.c
If your os.c should not end up in a program, you could make it be a
source of a static library, or a shared library, or a convenience
library.
Cheers,
Ralf