Automake: Compiling sources in other directories
Hi, I want ot use automake to build a library for which the source has been supplied to me by a customer. The directory structure is something like: src/main -- most of the source files are here src/host -- a few host-specific source files here In src/main, I have a Makefile.am containing something like this: lib_LTLIBRARIES = libfred.la hostdir=$(srcdir)/../host libfred_la_SOURCES = src1.cpp src2.cpp $(hostdir)/h1.cpp Everything compiles ok, but the generated Makefile.in contains libfred_a_OBJECTS = src1.o src2.o $(hostdir)/h1.o The problem is that h1.o is in the 'main' subdirectory along with all of the other object files. What's the right way to build a few sources from another directory into an application? The only think I can think of is to have another Makefile.am in src/host which builds the host sources either into object files or into a library which could be referenced by the src/mainMakefile.am, but that seems like overkill just to pick up a couple of source files. Reorganizing the source tree is also not an option. Wondering if there is a better way. Dave
[PATCH] Re: [PATCH] m4/header.m4 bug
Here's the same patch again with a test case thrown in. Derek -- Derek Price CVS Solutions Architect ( http://CVSHome.org ) mailto:[EMAIL PROTECTED] OpenAvenue ( http://OpenAvenue.com ) -- Nor was it uninteresting to the world that an experiment should be fairly and fully made whether freedom of discussion, unaided by power, is not sufficient for the propagation and protection of truth: whether a government conducting itself in the true spirit of its constitution with zeal and purity and doing no act which it would be unwilling the whole world should witness can be written down by falsehood and defamation. The experiment has been tried; [we] have witnessed the scene; our fellow citizens have looked on, cool and collected. They saw the latent source from which these outrages proceeded; they gathered around their public functionaries, and when the Constitution called them to the decision by suffrage, they pronounced their verdict, honorable to those who had served them and consolatory to the friend of man who believes he may be intrusted with his own affairs. - Thomas Jefferson; 2nd Inaugural Address, 1805 "Derek R. Price" wrote: > There was a bug in m4/header.m4 (AM_CONFIG_HEADER) which was causing > configure & config.status to create a $(top_builddir)/stamp-h file for > every header file instead of the $(top_builddir)/$(subdir)/stamp-h$index > file it was supposed to create. Basically, a few shell metachars which > were supposed to be interpreted in config.status were being interpreted > in configure instead and leaving blank spots in config.status. The > stamp files were still being created in the correct places in the > Makefile.ins & Makefiles, so it wasn't a fatal bug, but I fixed it > anyway. > > Derek > > -- > Derek Price CVS Solutions Architect ( http://CVSHome.org ) > mailto:[EMAIL PROTECTED] OpenAvenue ( http://OpenAvenue.com ) > -- > Southern DOS: Y'all reckon? (yep/Nope) Index: ChangeLog === RCS file: /cvs/automake/automake/ChangeLog,v retrieving revision 1.910 diff -u -r1.910 ChangeLog --- ChangeLog 2000/11/26 22:11:20 1.910 +++ ChangeLog 2000/12/15 19:55:12 @@ -1,3 +1,8 @@ +2000-12-15 Derek Price <[EMAIL PROTECTED]> + + * m4/header.m4 (AM_CONFIG_HEADER): This macro was broken due to + unescaped shell metachars + 2000-12-05 Derek Price <[EMAIL PROTECTED]> * automake.in (require_file_with_conf_line, Index: m4/header.m4 === RCS file: /cvs/automake/automake/m4/header.m4,v retrieving revision 1.7 diff -u -r1.7 m4/header.m4 --- m4/header.m42000/08/06 12:36:53 1.7 +++ m4/header.m42000/12/15 19:49:31 @@ -18,9 +18,9 @@ patsubst([$1], [^\([^:]*/\)?.*], [\1])stamp-h]), [am_indx=1 for am_file in $1; do -case " $CONFIG_HEADERS " in -*" $am_file "*) - echo timestamp > `echo $am_file | sed 's%:.*%%;s%[^/]*$%%'`stamp-h$am_indx +case " \$CONFIG_HEADERS " in +*" \$am_file "*) + echo timestamp > \`echo \$am_file | sed 's%:.*%%;s%[^/]*\$%%'\`stamp-h\$am_indx ;; esac am_indx=\`expr \$am_indx + 1\` --- /dev/null Thu Aug 24 05:00:32 2000 +++ tests/stamph2.test Fri Dec 15 15:57:48 2000 @@ -0,0 +1,29 @@ +#! /bin/sh + +# Make sure stamp-h* files are created where we expect + +. $srcdir/defs || exit 1 + +cat > configure.in << 'END' +AC_INIT(Makefile.am) +AM_INIT_AUTOMAKE(nonesuch, nonesuch) +AM_CONFIG_HEADER(firstfile.h sdir/secondfile.h thirdfile.h) +AC_OUTPUT(Makefile) +END + +: > Makefile.am +mkdir sdir +: > firstfile.h.in +: > sdir/secondfile.h.in +: > thirdfile.h.in + +# Fail gracefully if no autoconf. +(autoconf --version) > /dev/null 2>&1 || exit 77 + +$ACLOCAL || exit 1 +autoconf || exit 1 +$AUTOMAKE || exit 1 +./configure || exit 1 + +(test -f stamp-h1 && test -f sdir/stamp-h2 && test -f stamp-h3) || exit 1 +exit 0 Index: tests/ChangeLog === RCS file: /cvs/automake/automake/tests/ChangeLog,v retrieving revision 1.308 diff -u -r1.308 tests/ChangeLog --- tests/ChangeLog 2000/11/26 01:37:30 1.308 +++ tests/ChangeLog 2000/12/15 21:02:11 @@ -1,3 +1,8 @@ +2000-12-15 Derek Price <[EMAIL PROTECTED]> + + * stamph2.test: new file + * Makefile.am (TESTS): Added stamph2.test + 2000-12-05 Derek Price <[EMAIL PROTECTED]> * depcomp.test: New File Index: tests/Makefile.am === RCS file: /cvs/automake/automake/tests/Makefile.am,v retrieving revision 1.239 diff -u -r1.239 tests/Makefile.am --- tests/Makefile.am 2000/11/26 01:37:30 1.239 +++ tests/Makefile.am 2000/12/15 21:02:12 @@ -221,6 +222,7 @@ spell3.test \ spelling.test \ stamph.test \ +stamph2.test \ stdlib.test \ subdir.test \ subdir2.test \
Re: depcomp fix rpm'd
I tacked in the AM_CONFIG_HEADER stamp-h fix too. The current RPMs are now: http://alumni.engin.umich.edu/~oberon/automake-1.4a-0_CVSHome_org_3.noarch.rpm http://alumni.engin.umich.edu/~oberon/automake-1.4a-0_CVSHome_org_3.src.rpm Derek -- Derek Price CVS Solutions Architect ( http://CVSHome.org ) mailto:[EMAIL PROTECTED] OpenAvenue ( http://OpenAvenue.com ) -- He who laughs last thinks slowest. "Derek R. Price" wrote: > I built RPMs out of the CVS automake and with my fix for the depcomp > behavior. I figured I'd post them in case anybody wants them. The RPM > source is almost identical to RedHat's 1.4 automake with some patches > removed that wouldn't apply anymore and the depcomp patch added. I'm > not sure what the two patches I removed did, but I kept them in the > source RPM in case anybody wants a look. The build source is the > current CVS automake as of 20 minutes ago. > > http://alumni.engin.umich.edu/~oberon/automake-1.4a-0_CVSHome_org_2.noarch.rpm > > http://alumni.engin.umich.edu/~oberon/automake-1.4a-0_CVSHome_org_2.src.rpm > > Derek > > -- > Derek Price CVS Solutions Architect ( http://CVSHome.org ) > mailto:[EMAIL PROTECTED] OpenAvenue ( http://OpenAvenue.com ) > -- > It is error alone which needs the support of government. Truth can stand by > itself. > - Thomas Jefferson
[PATCH] m4/header.m4 bug
There was a bug in m4/header.m4 (AM_CONFIG_HEADER) which was causing configure & config.status to create a $(top_builddir)/stamp-h file for every header file instead of the $(top_builddir)/$(subdir)/stamp-h$index file it was supposed to create. Basically, a few shell metachars which were supposed to be interpreted in config.status were being interpreted in configure instead and leaving blank spots in config.status. The stamp files were still being created in the correct places in the Makefile.ins & Makefiles, so it wasn't a fatal bug, but I fixed it anyway. Derek -- Derek Price CVS Solutions Architect ( http://CVSHome.org ) mailto:[EMAIL PROTECTED] OpenAvenue ( http://OpenAvenue.com ) -- Southern DOS: Y'all reckon? (yep/Nope) Index: ChangeLog === RCS file: /cvs/automake/automake/ChangeLog,v retrieving revision 1.910 diff -u -r1.910 ChangeLog --- ChangeLog 2000/11/26 22:11:20 1.910 +++ ChangeLog 2000/12/15 19:55:12 @@ -1,3 +1,8 @@ +2000-12-15 Derek Price <[EMAIL PROTECTED]> + + * m4/header.m4 (AM_CONFIG_HEADER): This macro was broken due to + unescaped shell metachars + 2000-12-05 Derek Price <[EMAIL PROTECTED]> * automake.in (require_file_with_conf_line, Index: m4/header.m4 === RCS file: /cvs/automake/automake/m4/header.m4,v retrieving revision 1.7 diff -u -r1.7 m4/header.m4 --- m4/header.m42000/08/06 12:36:53 1.7 +++ m4/header.m42000/12/15 19:49:31 @@ -18,9 +18,9 @@ patsubst([$1], [^\([^:]*/\)?.*], [\1])stamp-h]), [am_indx=1 for am_file in $1; do -case " $CONFIG_HEADERS " in -*" $am_file "*) - echo timestamp > `echo $am_file | sed 's%:.*%%;s%[^/]*$%%'`stamp-h$am_indx +case " \$CONFIG_HEADERS " in +*" \$am_file "*) + echo timestamp > \`echo \$am_file | sed 's%:.*%%;s%[^/]*\$%%'\`stamp-h\$am_indx ;; esac am_indx=\`expr \$am_indx + 1\`
depcomp fix rpm'd
I built RPMs out of the CVS automake and with my fix for the depcomp behavior. I figured I'd post them in case anybody wants them. The RPM source is almost identical to RedHat's 1.4 automake with some patches removed that wouldn't apply anymore and the depcomp patch added. I'm not sure what the two patches I removed did, but I kept them in the source RPM in case anybody wants a look. The build source is the current CVS automake as of 20 minutes ago. http://alumni.engin.umich.edu/~oberon/automake-1.4a-0_CVSHome_org_2.noarch.rpm http://alumni.engin.umich.edu/~oberon/automake-1.4a-0_CVSHome_org_2.src.rpm Derek -- Derek Price CVS Solutions Architect ( http://CVSHome.org ) mailto:[EMAIL PROTECTED] OpenAvenue ( http://OpenAvenue.com ) -- It is error alone which needs the support of government. Truth can stand by itself. - Thomas Jefferson
[PATCH] Repair path of VTEXI with non gnu-makes
When they encounter a set of rules such as: a: b $(srcdir)/b: most makes don't identify $(srcdir)/b as fitting for `b'. Specifically, if $(srcdir)/b already exists, it will fullfill the dependency as it is the right file, but target lookup won't ever find it as a dependency. As far as I could tell @VTEXI@ is always intended to be built in the source directory, so the following patch allows it to be correctly built with any make: 2000-12-15 Marc Espie <[EMAIL PROTECTED]> * automake.in (handle_texinfo): Make path of $vtexi explicit in dependency. * texi-vers.am: Likewise. --- automake.in.origFri Dec 15 04:18:32 2000 +++ automake.in Fri Dec 15 04:18:54 2000 @@ -2287,7 +2287,7 @@ sub handle_texinfo # dependency list. @texi_deps = (); push (@texi_deps, $info_cursor); - push (@texi_deps, $vtexi) if $vtexi; + push (@texi_deps, '$(srcdir)/'.$vtexi) if $vtexi; # Canonicalize name first. ($canonical = $infobase) =~ tr/A-Za-z0-9_/_/c; --- texi-vers.am.orig Fri Dec 15 04:18:12 2000 +++ texi-vers.amFri Dec 15 04:18:22 2000 @@ -15,7 +15,7 @@ ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA ## 02111-1307, USA. -$(srcdir)/@VTEXI@: @MAINTAINER_MODE_TRUE@stamp-@VTI@ +$(srcdir)/@VTEXI@: @MAINTAINER_MODE_TRUE@$(srcdir)/stamp-@VTI@ @: ## Depend on configure.in so that version number updates cause a