automake
[Top][All Lists]
Advanced

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

Error when ylwrap is invoked from an Autotools generated Makefile.


From: Craig Sanders
Subject: Error when ylwrap is invoked from an Autotools generated Makefile.
Date: Wed, 21 May 2008 20:32:39 +1000

Hello all.

I'm hoping someone might be able to help me or point me in the right direction 
with regards to a problem I am having trying to use a Flex file in a small 
Autotools based project.

I'm attempting to use a Flex file which I have named "simple.ll" in a small 
Autotools based project for a University subject, however I have run into a 
problem. This problem occurs when I invoke make from the command line - it 
results in the following output ;

>>>>>>>>>>

Making all in src
make[1]: Entering directory `/home/craig/source_code/c/src/flex/src'
g++ -DPACKAGE_NAME=\"flex_simple\" -DPACKAGE_TARNAME=\"flex_simple\" 
-DPACKAGE_VERSION=\"0.0.1\" -DPACKAGE_STRING=\"flex_simple\ 0.0.1\" 
-DPACKAGE_BUGREPORT=\"address@hidden" -DPACKAGE=\"flex_simple\" 
-DVERSION=\"0.0.1\" -DYYTEXT_POINTER=1 -I.  -DHAVE_CONFIG_H -I../include   -g 
-O2 -MT main-main.o -MD -MP -MF .deps/main-main.Tpo -c -o main-main.o `test -f 
'main.cpp' || echo './'`main.cpp
mv -f .deps/main-main.Tpo .deps/main-main.Po
/bin/sh ../ylwrap simple.ll lex.yy.c simple.cc -- flex
make[1]: *** [simple.cc] Error 1
make[1]: Leaving directory `/home/craig/source_code/c/src/flex/src'
make: *** [all-recursive] Error 1

<<<<<<<<<<

When I look in the sub-directory "/home/craig/source_code/c/src/flex/src", 
which is the directory from within which the ylwrap command is invoked, the 
file "simple.cc" does not exist. I believe this is because ylwrap is attempting 
to instruct flex to generate a C file called lex.yy.c. However, I have coded an 
option into "simple.ll" (see below) to instruct flex to generate a C++ file, 
thus ylwrap should look for a file called lex.yy.cc to rename. Is there any 
configuration setting that I can place into Makefile.am to instruct ylwrap to 
generate lex.yy.cc instead of lex.yy.c?

Furthermore, if I go into the Autotools generated Makefile for this 
sub-directory and change the following line (I know, bad idea) ;

.ll.cc:
        $(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- 
$(LEXCOMPILE)

to

.ll.cc:
        $(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).cc $@ -- 
$(LEXCOMPILE)

then I get the following when I invoke make again ;

>>>>>>>>>>

Making all in src
make[1]: Entering directory `/home/craig/source_code/c/src/flex/src'
/bin/sh ../ylwrap simple.ll lex.yy.cc simple.cc -- flex
make[1]: *** No rule to make target `simple.c', needed by `main-simple.o'.  
Stop.
make[1]: Leaving directory `/home/craig/source_code/c/src/flex/src'
make: *** [all-recursive] Error 1

<<<<<<<<<<

Why is make trying to make the file "simple.c" when I want it to make 
"simple.cc"? How can I instruct it that I want flex to generate a C++ file 
called "simple.cc"?

My Makefile.am in the src sub-directory looks as follows ;

>>>>>>>>>>

bin_PROGRAMS  = main
main_SOURCES  = simple.ll
main_CPPFLAGS = -DHAVE_CONFIG_H
main_LDFLAGS  = ${LEXLIB}
main_CXXFLAGS =

<<<<<<<<<<

and my configure.ac file in the top-level directory of the package looks as 
follows ;

>>>>>>>>>>

AC_INIT(
        [flex_simple],
        [0.0.1],
        address@hidden)
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR(
                 [src/simple.ll])
AC_PROG_CXX
AC_PROG_LEX
AC_OUTPUT([
           Makefile
           src/Makefile
])

<<<<<<<<<<

Also, for what it's worth, my Flex source file "simple.ll" looks as follows ;

>>>>>>>>>>

%{
#include <iostream>

using std::cout;
using std::endl;
%}

%option noyywrap
%option c++

DIGIT               [0-9]
HEAD_COMMAND_PACKET <command>
TAIL_COMMAND_PACKET <\/command>

        int   numPackets = 0;

%%

{HEAD_COMMAND_PACKET}([[:graph:]]|[[:space:]])*{TAIL_COMMAND_PACKET}  {
        return(0);
}

%%

<<<<<<<<<<

I'm guessing my problem is being caused by my incorrect usage of one of the 
Autotools, rather than ylwrap. If anyone could provide any assistance on this 
matter it would be greatly appreciated.

Thankyou in advance.


- Craig Sanders




reply via email to

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