automake
[Top][All Lists]
Advanced

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

Propagating Variables from Makefile.am to Makefile.


From: Peter Fischer
Subject: Propagating Variables from Makefile.am to Makefile.
Date: Mon, 16 Feb 2004 23:09:43 +0100

Hi out there,

I'm using automake for a project which uses the CORBA implementation
omniORB and Qt under Linux. I got an example
Makefile.am from the omniORB mailing list which I managed to make it
work with my project. Now I'm trying to add
Qt support using the autoqt package I found via web search at
sourceforge.net and have some trouble.
The project has three directories in total: The topmost, one called
"config" and one called "echo".
In the topmost directory are top Makefile.am and a configure.in file.
In config there are several .m4 macros, perl scripts and a Makefile.am,
in echo are the sources of my program and also a
Makefile.am which is invoked  by the top Makefile.am.
The problem I have is, that in the top Makefile.am the variable CXXFLAGS
is set by the following command:

CXXFLAGS := $(CXXFLAGS) $(QT_CXXFLAGS)

But in the Makefile in the echo subdir the QT_CXXFLAGS don't appear. I
then tried to "backtrace" by inspecting all the resulting
Makefile.in and Makefile.


In the top Makefile.in I found the two lines (in that order with some
other lines between them):

CXXFLAGS := $(CXXFLAGS) $(QT_CXXFLAGS)

QT_CXXFLAGS = @QT_CXXFLAGS@

(Is the order important?!) So everything seemed o.k.


In the top Makefile then:

CXXFLAGS := $(CXXFLAGS) $(QT_CXXFLAGS)

QT_CXXFLAGS = -I/usr/lib/qt3/include

Looks good. but when I invoke the make, the -I/usr/lib/qt3/include
doesn't appear on the commandline, only those set
in the Makefile.am in the echo subdirectory (see below).
So the problem seems to be how to communicate the changes to the
Makefiles.am in the subdirectories (only echo at the moment).


In Makefile.am in the echo subdirectory is the following entry:

CXXFLAGS = @CXXFLAGS@ -D__x86__ -D__linux__ -D__OSVERSION__=2

So I hoped that @CXXFLAGS@ would expand to $(CXXFLAGS) $(QT_CXXFLAGS) as
set in the top Makefile.am but this
was not the case.


By the way: What does it mean exactly when I surround a variable by @
like in @address@hidden I very carefully studied the
GNU automake manual and the Goat book but in none of them I found the
answer. I then found a tutorial via web search but
I'm not sure whether I understood it. It said that @ are a kind of
protection for the variable so it can be propagated down to the
Makefile verbatim without being modified. Does that mean, for our case,
that the string "CXXFLAGS" is stored in the variable
CXXFLAGS without being expanded by automake but autoconf will expand it?

Does anyone know a document where such things are described because I
think some things are extremly unclear even after reading
the GNU manual and the Goat book. For example how to echo variables in a
Makefile.am for debugging cases like this here?

In Makefile.in in echo subdirectory I found:

CXXFLAGS = @CXXFLAGS@ -D__x86__ -D__linux__ -D__OSVERSION__=2

QT_CXXFLAGS = @QT_CXXFLAGS@


so the QT_CXXFLAGS successfully got in the Makefile.in in the
subdirectory, and finally in Makefile in echo subdirectory:

CXXFLAGS = -Wall -Wno-unused  -D__x86__ -D__linux__ -D__OSVERSION__=2

QT_CXXFLAGS = -I/usr/lib/qt3/include


So there is no communication between those variables any more.
Can you help me how to tell the top Makefile.am to reuse the value
QT_CXXFLAGS in CXXFLAGS?
The problem seems to be that the Makefil.am in the echo subdir
overwrites the old value of CXXFLAGS it gets from the top
Makefile.am (.in, whatever...).

So please help me and thanks in advance if you were so patient to read
all this (I know it is pretty much)!

Many greetings,

Peter.



P.S.: Here is the relevant portion (I believe) of the top Makefile.am:

IDL_DIRS = echo
PURE_CXX_DIRS =
OBJLIBDIRS = $(IDL_DIRS) $(PURE_CXX_DIRS)
SUBDIRS = config $(OBJLIBDIRS)
CXXFLAGS := $(CXXFLAGS) $(QT_CXXFLAGS)
LDADD := $(LDADD) $(QT_LDADD)

EXTRA_DIST = aclocal.m4

all-cxx:
 (cd echo; \
 echo "making all-cxx"; \
 make all-cxx;)
 for i in $(PURE_CXX_DIRS); \
 do \
   (cd $$i; echo "make all in $$i"; \
   make all; ) \
 done



--------------------------------------------------------------------
Peter Fischer
Universitaet Karlsruhe
Fakultaet fuer Informatik
Institut fuer Betriebs- und Dialogsysteme
Am Fasanengarten 5
76128 Karlsruhe
E-mail: address@hidden
--------------------------------------------------------------------







reply via email to

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