LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-02-2007, 02:41 AM   #1
phyx
LQ Newbie
 
Registered: Jan 2006
Posts: 12

Rep: Reputation: 0
automake (Makefile.ac) & yacc


I can't figure out how to do automake using yacc. I made a makefile (Makefile-noAutomake) and generating/compiling with yacc works fine in this simple case. However, I need to ensure it build with automake. I have used automake in the past with just C code, but yacc/lex has been cryptic. I've been going over the gnu page for 2 days now. Nobody seems to have a single example using a yacc Makefile.am. And I believe I'm following the gnu docs (http://www.gnu.org/software/automake...c-and-Lex.html)

Any thoughts? I think it has something to do with how I set up my bin in Makefile.am.


First, the files and compiling using a simple makefile.
Files: ----------------------------------
g.y
l.l
appgen.c
app.c
app.h

Makefile:
"Makefile-noAutomake": -------------------
OBJS:=g.o l.o app.o appgen.o

all: app

$(OBJS): app.h

lc: y.tab.h $(OBJS)
gcc -o app $(OBJS)

y.tab.h: g.y
yacc -d g.y
---------------------------------------
Running (w/output):
$ make -f Makefile-noAutomake

yacc -d g.y
yacc g.y
mv -f y.tab.c g.c
gcc -g -O0 -c -o g.o g.c
flex -t l.l > l.c
gcc -g -O0 -c -o l.o l.c
gcc -g -O0 -c -o app.o app.c
gcc -g -O0 -c -o appgen.o appgen.c
gcc -o app g.o l.o app.o appgen.o
rm g.c l.c
-------------------------------------

Now to the automake stuff that doesn't seem to work...

------------------------------------
configure.ac:
...
AC_CONFIG_AUX_DIR([ylwrap]) # do I need ylwrap?
AM_INIT_AUTOMAKE
...
AC_MSG_NOTICE([using CFLAGS=$CFLAGS])
AC_MSG_NOTICE([using CXXFLAGS=$CXXFLAGS])
AC_MSG_NOTICE([using CPPFLAGS=$CPPFLAGS])
AC_MSG_NOTICE([using LDFLAGS=$LDFLAGS])
AC_MSG_NOTICE([using YFLAGS=$YFLAGS])
...
AC_PROG_CXX
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_PROG_YACC
AC_PROG_LEX
...
--------------------------------------
Makefile.am:
bin_PROGRAMS = app
lc_SOURCES = l.l app.c g.y appgen.c

AM_YFLAGS=-d
AM_CXXFLAGS = -g -O0
AM_LFLAGS=-t
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Automake data dirs - what should go in Makefile.am? MadCactus Programming 4 02-20-2016 04:11 AM
automake, makefile, makefile.in and makefile.am Fond_of_Opensource Linux - Newbie 1 09-12-2006 08:35 PM
Error in Makefile for Lex and Yacc oulevon Programming 2 10-24-2005 12:52 AM
Gcc & Yacc riluve Linux - Newbie 2 03-23-2005 11:16 AM
Lex & YACC coolfrog Programming 3 09-25-2004 07:00 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration