gnu make - automake-ing in bison which works fine with handwritten makefile -


friends,

i trying create makefile via gnu-autotools flex+bison+c code (toy code, ma say). handwritten makefile works fine

cc=gcc #-g -wall flex=flex bison=bison libs=lfl prog=parse  ${prog}:bib.y scan.l main.c     ${bison} -d bib.y     ${flex} -i scan.l     ${cc} -wall main.c lex.yy.c bib.tab.c `pkg-config --cflags --libs gtk+-3.0 glib-2.0` -${libs} -o $@  clean:     rm -f lex.yy.c bib.tab.h ${prog} bib.tab.c      touch scan.l bib.y main.c 

only giving warnings unused variables:

$ make -f makefile  bison -d bib.y flex -i scan.l gcc  -wall main.c lex.yy.c bib.tab.c `pkg-config --cflags --libs gtk+-3.0 glib-2.0` -lfl -o parse main.c: in function ‘main’: main.c:35:8: warning: type defaults ‘int’ in declaration of ‘yy_create_buffer’ [-wimplicit-int] main.c:35:8: warning: unused variable ‘yy_create_buffer’ [-wunused-variable] lex.yy.c:1120:17: warning: ‘yyunput’ defined not used [-wunused-function] lex.yy.c:1161:16: warning: ‘input’ defined not used [-wunused-function] bib.y: in function ‘parse_entry’: bib.y:79:9: warning: unused variable ‘author’ [-wunused-variable] 

but then, when tried create via autotools, giving problem:

##configure.ac (made autoscan) ac_prereq([2.69]) ac_init([bi-try],[1.0],[rudra.banerjee@aol.co.uk]) am_init_automake([1.9.6])  # checks programs. ac_prog_cc ac_prog_yacc ac_prog_lex  # checks libraries. #ac_prog_libtool # checks header files.  # checks library functions. am_path_gtk_3_0([3.4.0],,ac_msg_error([gtk+ 3.0.0 or higher required.]))  ac_config_files([makefile]) ac_output 

and makefile.am

bin_programs = bitry bitry_sources = bib.y scan.l main.c  am_yflags = -d am_lflags = -i  bitry_ldadd = @gtk_libs@ @lexlib@ am_cflags = @gtk_cflags@ 

the output of process is:

$ autoreconf --install makefile.am: installing './install' makefile.am: installing './copying' using gnu general public license v3 file makefile.am: consider adding copying file version control system makefile.am: code, avoid questions license project uses

$ ./configure -q  $ make -s scan.o: in function `yy_get_previous_state': /home/rudra/programs/lex/parsing/ruda/scan.c:1070: multiple definition of `yyin' bib.o:/home/rudra/programs/lex/parsing/ruda/bib.c:1070: first defined here scan.o: in function `yy_switch_to_buffer': /home/rudra/programs/lex/parsing/ruda/scan.c:1254: multiple definition of `yy_switch_to_buffer' bib.o:/home/rudra/programs/lex/parsing/ruda/bib.c:1254: first defined here scan.o: in function `yy_delete_buffer': /home/rudra/programs/lex/parsing/ruda/scan.c:1329: multiple definition of `yy_delete_buffer' bib.o:/home/rudra/programs/lex/parsing/ruda/bib.c:1329: first defined here scan.o: in function `yy_flush_buffer': /home/rudra/programs/lex/parsing/ruda/scan.c:1375: multiple definition of `yy_flush_buffer' bib.o:/home/rudra/programs/lex/parsing/ruda/bib.c:1375: first defined here scan.o: in function `yy_create_buffer': /home/rudra/programs/lex/parsing/ruda/scan.c:1299: multiple definition of `yy_create_buffer' bib.o:/home/rudra/programs/lex/parsing/ruda/bib.c:1299: first defined here scan.o: in function `yyrestart': /home/rudra/programs/lex/parsing/ruda/scan.c:1237: multiple definition of `yyrestart' bib.o:/home/rudra/programs/lex/parsing/ruda/bib.c:1237: first defined here scan.o: in function `yylex': /home/rudra/programs/lex/parsing/ruda/scan.c:663: multiple definition of `yylex' bib.o:/home/rudra/programs/lex/parsing/ruda/bib.c:663: first defined here scan.o: in function `yy_get_previous_state': /home/rudra/programs/lex/parsing/ruda/scan.c:1072: multiple definition of `yyout' bib.o:/home/rudra/programs/lex/parsing/ruda/bib.c:1072: first defined here scan.o: in function `yypush_buffer_state': /home/rudra/programs/lex/parsing/ruda/scan.c:1404: multiple definition of `yypush_buffer_state' bib.o:/home/rudra/programs/lex/parsing/ruda/bib.c:1404: first defined here scan.o: in function `yypop_buffer_state': /home/rudra/programs/lex/parsing/ruda/scan.c:1433: multiple definition of `yypop_buffer_state' bib.o:/home/rudra/programs/lex/parsing/ruda/bib.c:1433: first defined here scan.o: in function `yy_scan_buffer': /home/rudra/programs/lex/parsing/ruda/scan.c:1501: multiple definition of `yy_scan_buffer' bib.o:/home/rudra/programs/lex/parsing/ruda/bib.c:1501: first defined here scan.o: in function `yy_scan_bytes': /home/rudra/programs/lex/parsing/ruda/scan.c:1551: multiple definition of `yy_scan_bytes' bib.o:/home/rudra/programs/lex/parsing/ruda/bib.c:1551: first defined here scan.o: in function `yy_scan_string': /home/rudra/programs/lex/parsing/ruda/scan.c:1538: multiple definition of `yy_scan_string' bib.o:/home/rudra/programs/lex/parsing/ruda/bib.c:1538: first defined here scan.o: in function `yyget_lineno': /home/rudra/programs/lex/parsing/ruda/scan.c:1616: multiple definition of `yyget_lineno' bib.o:/home/rudra/programs/lex/parsing/ruda/bib.c:1616: first defined here scan.o:(.data+0x0): multiple definition of `yylineno' bib.o:(.data+0x0): first defined here scan.o: in function `yyget_in': /home/rudra/programs/lex/parsing/ruda/scan.c:1624: multiple definition of `yyget_in' bib.o:/home/rudra/programs/lex/parsing/ruda/bib.c:1624: first defined here scan.o: in function `yyget_out': /home/rudra/programs/lex/parsing/ruda/scan.c:1632: multiple definition of `yyget_out' bib.o:/home/rudra/programs/lex/parsing/ruda/bib.c:1632: first defined here scan.o: in function `yyget_leng': /home/rudra/programs/lex/parsing/ruda/scan.c:1640: multiple definition of `yyget_leng' bib.o:/home/rudra/programs/lex/parsing/ruda/bib.c:1640: first defined here scan.o: in function `yyget_text': /home/rudra/programs/lex/parsing/ruda/scan.c:1649: multiple definition of `yyget_text' bib.o:/home/rudra/programs/lex/parsing/ruda/bib.c:1649: first defined here scan.o: in function `yyset_lineno': /home/rudra/programs/lex/parsing/ruda/scan.c:1658: multiple definition of `yyset_lineno' bib.o:/home/rudra/programs/lex/parsing/ruda/bib.c:1658: first defined here scan.o: in function `yyset_in': /home/rudra/programs/lex/parsing/ruda/scan.c:1669: multiple definition of `yyset_in' bib.o:/home/rudra/programs/lex/parsing/ruda/bib.c:1669: first defined here scan.o: in function `yyset_out': /home/rudra/programs/lex/parsing/ruda/scan.c:1674: multiple definition of `yyset_out' bib.o:/home/rudra/programs/lex/parsing/ruda/bib.c:1674: first defined here scan.o: in function `yyget_debug': /home/rudra/programs/lex/parsing/ruda/scan.c:1680: multiple definition of `yyget_debug' bib.o:/home/rudra/programs/lex/parsing/ruda/bib.c:1680: first defined here scan.o: in function `yy_get_previous_state': /home/rudra/programs/lex/parsing/ruda/scan.c:1066: multiple definition of `yy_flex_debug' bib.o:/home/rudra/programs/lex/parsing/ruda/bib.c:1066: first defined here scan.o: in function `yyset_debug': /home/rudra/programs/lex/parsing/ruda/scan.c:1684: multiple definition of `yyset_debug' bib.o:/home/rudra/programs/lex/parsing/ruda/bib.c:1684: first defined here scan.o: in function `yylex_destroy': /home/rudra/programs/lex/parsing/ruda/scan.c:1717: multiple definition of `yylex_destroy' bib.o:/home/rudra/programs/lex/parsing/ruda/bib.c:1717: first defined here scan.o: in function `yyalloc': /home/rudra/programs/lex/parsing/ruda/scan.c:1763: multiple definition of `yyalloc' bib.o:/home/rudra/programs/lex/parsing/ruda/bib.c:1763: first defined here scan.o: in function `yyrealloc': /home/rudra/programs/lex/parsing/ruda/scan.c:1775: multiple definition of `yyrealloc' bib.o:/home/rudra/programs/lex/parsing/ruda/bib.c:1775: first defined here scan.o: in function `yyfree': /home/rudra/programs/lex/parsing/ruda/scan.c:1780: multiple definition of `yyfree' bib.o:/home/rudra/programs/lex/parsing/ruda/bib.c:1780: first defined here scan.o: in function `yywrap': /home/rudra/programs/lex/parsing/ruda/scan.l:16: multiple definition of `yywrap' bib.o:/home/rudra/programs/lex/parsing/ruda/bib.l:16: first defined here main.o: in function `main': /home/rudra/programs/lex/parsing/ruda/main.c:36: undefined reference `setup_tree' /home/rudra/programs/lex/parsing/ruda/main.c:44: undefined reference `yyparse' bib.o: in function `yylex': bib.c:(.text+0x7c1): undefined reference `yylval' bib.c:(.text+0x84b): undefined reference `yylval' bib.c:(.text+0x872): undefined reference `yylval' scan.o: in function `yylex': scan.c:(.text+0x7c1): undefined reference `yylval' scan.c:(.text+0x84b): undefined reference `yylval' scan.o:scan.c:(.text+0x872): more undefined references `yylval' follow collect2: error: ld returned 1 exit status make: *** [bitry] error 1 

i posted long output of makefile might helpful experienced eyes. looking forward help.

ah...solved. bison -d foo.y makes foo.tab.h ;

for automake, making foo.h.

solved


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -