[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Moving from manual Makefiles to Automake
From: |
Ralf Wildenhues |
Subject: |
Re: Moving from manual Makefiles to Automake |
Date: |
Wed, 9 Nov 2005 11:12:12 +0100 |
User-agent: |
Mutt/1.5.11 |
Hi Paulo,
* Paulo Jorge Matos wrote on Wed, Nov 09, 2005 at 10:02:53AM CET:
>
> On a current C++ project I'm using Autoconf and Automake.
> To solve the big subdir tree inside src I used VPATHs in my
> Makefile.am, if there's another way please say so.
I don't understand quite how you do this. If you want to use fewer
Makefiles than directories, consider using Automake's subdir-objects
option and look at recent discussion on this list about it, and the
documentation. (There may be an issue with you setting VPATH manually,
too; also covered here recently.)
> The current problem is due to the fact that using automake with bison
> and flex is giving me headaches.
*snip*
Two issues I can see here:
> make[3]: Entering directory `/home/pocm/software/extsat/src'
> make[3]: Warning: File `.deps/vbhimplvsids.Po' has modification time
> 2e+02 s in the future
Is your source on a networked file system (NFS, ...)? Then please look
to synchronize the time of server and client. NTP is very good for
this.
> if g++ -DHAVE_CONFIG_H -I. -I. -I.. -I./include -ansi -std=c++98
> -pedantic -Wall -DBUILDDATE=`date +'%Y-%b-%d %R'` -g -O2 -MT
> msat-parser.o -MD -MP -MF ".deps/msat-parser.Tpo" -c -o msat-parser.o
> msat-parser.cc; \
> then mv -f ".deps/msat-parser.Tpo" ".deps/msat-parser.Po"; else rm -f
> ".deps/msat-parser.Tpo"; exit 1; fi
> g++: cannot specify -o with -c or -S and multiple compilations
The problem is this:
-DBUILDDATE=`date +'%Y-%b-%d %R'`
The date expands to more than one word, the shell splits it and then g++
sets BUILDDATE to 2005-Nov-09, and sees 8:59 as source file name, and
complains.
To get around the shell expansion, you can use quotes:
"-DBUILDDATE=`date +'%Y-%b-%d %R'`"
But probably you'll rather want this in a C string, right? Then you
also need a set of quotes for the compiler, so that BUILDDDATE will
expand to
"2005-Nov-09 8:59"
instead of
2005-Nov-09 8:59
For this, you can use
"-DBUILDDATE=\"`date +'%Y-%b-%d %R'`\""
Note that some (uncommon) compilers or compiler wrappers will be too
stupid to parse your command line correctly. You could put the
definition into a generated header file, though (or add it to config.h,
if it suffices for you to have this information updated at configure
time, not at make time).
Cheers,
Ralf