automake
[Top][All Lists]
Advanced

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

Re: Problem using same .y file in multiple libs and AM_YFLAGS=-d


From: Sander Niemeijer
Subject: Re: Problem using same .y file in multiple libs and AM_YFLAGS=-d
Date: Thu, 18 Sep 2003 10:25:02 +0200

After some further thinking I managed to come up with a solution myself.

It seems that it is possible to use (the generated) foo.c for libfoo_internal_la_SOURCES instead of foo.y. The rule to create foo.c from foo.y is already part of the rules for libfoo.la, so the dependencies are correct. And of course the biggest advantage is that automake now only creates one rule to generate foo.h.

Regards,
Sander

On woensdag, sep 17, 2003, at 12:12 Europe/Amsterdam, Sander Niemeijer wrote:

Hi all,

I am using a yacc/bison source file in a libtool library, but I create both an installable static/shared version of the library as well as an internal convenience library (so I can later on link the PIC objects directly into another shared library). Since I need the header file with the parser definitions I use the "AM_YFLAGS = -d" option to have automake do this for me.

The problem is that automake (1.7.7) doesn't see that the .y source files in the _SOURCES definitions of two libraries (the installable one and the internal convenience one) are actually the same and thus, because of the AM_YFLAGS definition, creates two identical rules in the final Makefile for the .h file. This is something the make program obviously doesn't like and I therefore receive a 'warning: overriding commands for target' warning.

A simple Makefile.am example that shows this behavior is:
---
AM_YFLAGS = -d

lib_LTLIBRARIES = libfoo.la
noinst_LTLIBRARIES = libfoo_internal.la

BUILT_SOURCES = foo.h

libfoo_la_SOURCES = foo.y
libfoo_la_LDFLAGS = -version-info 0:0:0

libfoo_internal_la_SOURCES = foo.y
---

Does anybody know how I can get rid of the make warnings (and, just out of interest, will these warnings stay warnings when I use a different make program instead of GNU make, or might other make programs see the double .h rule definition as an error)?

P.S. I also have, for anyone who is interested, a small example package available with just a single .y file that reproduces the problem.

Regards,
Sander Niemeijer








reply via email to

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