Re: [PATCH V2 2/4] src/xenconfig: Xen-xl parser

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

 



David kiarie wrote:
> Hmm, any  consensus on this?
>   

I looked at coreutils following Eric's suggestion, but didn't notice any
use of flex.  I went back to the automake documented approach [1] and
peeked at the resulting generated files.  src/Makefile.in contains

LEX_OUTPUT_ROOT = lex.yy
LEXCOMPILE = $(LEX) $(AM_LFLAGS) $(LFLAGS)
.l.c:
    $(AM_V_LEX)$(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c
$@ -- $(LEXCOMPILE)

which during an actual make produces

/bin/sh ../build-aux/ylwrap xenconfig/libxlu_disk_l.l lex.yy.c
xenconfig/libxlu_disk_l.c -- flex

But later the build fails with

  CC       xenconfig/libvirt_xenconfig_la-xen_xl.lo
xenconfig/xen_xl.c:28:27: fatal error: libxlu_disk_l.h: No such file or
directory
 #include "libxlu_disk_l.h"

Which is the problem I mentioned earlier in the thread about flex not
generating a header file.  I naively tried hacking '--header-file' into
AM_LFLAGS (e.g. AM_LFLAGS=--header-file=$*.h), but flex wasn't happy
with that

make[2]: Entering directory `libvirt/src'
/bin/sh ../build-aux/ylwrap xenconfig/libxlu_disk_l.l lex.yy.c
xenconfig/libxlu_disk_l.c -- flex --header-file=xenconfig/libxlu_disk_l.h
flex: fatal internal error, freopen(headerfilename) failed

I banged my head on this for a while but couldn't find a resolution :-/.

The alternate approach is to use hand-crafted rules in src/Makefile.am,
as you've done.  I'd prefer something a bit more generic like

%.c %.h:: %.l
    @rm -f $*.[ch]
    $(AM_V_GEN)$(LEX) --header-file=$*.h --outfile=$*.c $<

Which does work but has the two issues we discussed earlier:

- warning flags need relaxed when compiling the generated files
- generated files need to be excluded from syntax-check

The second issue is trivial, and although not obvious to me, I think
there are several devs on the list that can give hints.

Regards,
Jim

[1] http://www.gnu.org/software/automake/manual/html_node/Yacc-and-Lex.html


> On Fri, Sep 12, 2014 at 4:17 PM, Eric Blake <eblake@xxxxxxxxxx> wrote:
>   
>> On 09/11/2014 06:14 PM, Jim Fehlig wrote:
>>
>>     
>>> But also as mentioned before, I can't figure out how to convince
>>> automake to tell flex to generate the header file as well as the .c file.
>>>
>>> Eric, do you have any experience with automake and flex? The following
>>> thread makes it sound as though automake supports flex's
>>> '--header-file=' option, but I can't find any hint on how to make it work
>>>
>>> http://lists.gnu.org/archive/html/bug-automake/2012-08/msg00069.html
>>>
>>>       
>> Quick reply here to acknowledge that you're waiting on me, although a
>> more detailed reply may take me a few days...
>>
>> I haven't personally written a makefile with flex, but know that
>> coreutils is such a project, so I plan to research how it gets things to
>> work.
>>
>> --
>> Eric Blake   eblake redhat com    +1-919-301-3266
>> Libvirt virtualization library http://libvirt.org
>>
>>     
>
>   

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]