automake
[Top][All Lists]
Advanced

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

Re: Warn: non-POSIX variable name


From: Steven Woody
Subject: Re: Warn: non-POSIX variable name
Date: Wed, 20 Aug 2008 09:01:36 +0800

> Hi Steven,
>
> If I remember correctly a changed value in "-D flag" will not cause
> re-compilation, so if it is important that the version information
> propagates to your binary, it is likely better to generate a header file or
> even a source file than using these CPPFLAGS. I'm doing that in one of my
> projects in which the makefile.am looks something like this
>
> if HAVE_SVN_WC
> @srcdir@/subversion_info.cc: subversion_info.cc.tmp
>   @$(SHELL) @top_srcdir@/build_support/move-if-change subversion_info.cc.tmp
> \
>   @srcdir@/subversion_info.cc
>
> subversion_info.cc.tmp: FORCE
>   @echo '// subversion_info.cc generated from subversion_info.cc.in.' > $@
> ;\
>   revision=`svnversion $(top_srcdir)` ;\
>   $(SED) -e 's/sub_2_svn_revision/'$$revision'/g' \
>   @srcdir@/subversion_info.cc.in >> $@ ;
> endif
>
> FORCE:
>
> Then I have a subversion_info.cc.in that have a string sub_2_svn_revision
> where the revision is intended to be. So when I need `subversion_info.cc', a
> `subversion_info.cc.tmp' is created from the `subversion_info.cc.in' using
> the handy script, svnversion, provided by the svn team. Then the script
> move-if-change replaces `subversion_info.cc' with `subversion_info.cc.tmp'
> (like mv subversion_info_cc.tmp subversion_info.cc) but it does so only if
> the two files are different. I introduced that "if" in order to avoid
> re-compilation of subversion_info.o when not needed.
>
> Another thing is that if you plan on distributing your package, you have to
> make sure that it works also when not building from a subversion working
> copy. Either by adding this case in your script `svnrev-sh' or by checking
> it at configure time and add automake conditionals (like I do with
> HAVE_SVN_WC). In any case you probably need to add created source code
> `subversion_info.cc' to your distribution.  I used `make distcheck' to help
> me get the details right.
>
> I am not sure exactly what you wanna do, but I hope this will help.
>

Thank you Peter. I have two more questions:

1, Where and how you set the HAVE_SVN_WC?
2. What's the difference between @varname@ and $(varname) in a
Makefile.am? I noted you use many @xxxx@

Regards,
woody




reply via email to

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