www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/04/19/22:00:51

Xref: news2.mv.net comp.os.msdos.djgpp:2873
From: Denis Bernard <dbernard AT teleglobe DOT ca>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: problems with makefiles
Date: Wed, 17 Apr 1996 13:54:56 -0400
Organization: Teleglobe Canada Inc.
Lines: 59
Message-ID: <31753070.142F@teleglobe.ca>
References: <Pine DOT SOL DOT 3 DOT 91 DOT 960415004409 DOT 22714A-100000 AT sauron>
NNTP-Posting-Host: bnet-gw.teleglobe.ca
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Rafael R. Sevilla wrote:
> 
> Hi. I've been using Bison for some time to build a small language, and it
> appears to give me lots of problems in conjunction with make. In order to
> make my lang.c file for example, my makefile has the following lines
> 
> lang.c lang_tab.h: lang.y $(HEADERS)
>         bison -y -d lang.y
>         update y_tab.c lang.c
>         update y_tab.h lang_tab.h
> 
> lang.o: lang.c
> 
>         ...
> 
> Trouble is, make does a lot of redundant work: it runs bison twice and
> consequently recompiles lang.c twice too, for some reason that escapes me.
> Make was invented in order to avoid redundant compiles, but it appears to
> be adding to them here. What's going on? Is there something wrong with my
> makefile?
> 
> -------------------------------------------------------------------------
> University of the Philippines                           Rafael R. Sevilla
> PABX/OVCA: Diliman Networking Project          rsevilla AT sauron DOT upd DOT edu DOT ph
> -------------------------------------------------------------------------

I use bison and I have no problems.  Your makefile may have a line like

HEADERS= ... lang_tab.h ...

this may be your problem.  remove lang_tab.h from HEADERS.

here is my own makefile.

Denis.
-------

TARGET=o.exe
SRCS=s.c sql_tab.c lexyy.c
OBJS=$(SRCS:.c=.o)

CFLAGS=-Wall

all: $(TARGET)
	echo End of compilation

$(TARGET): $(OBJS)
	gcc -o $(TARGET) $(OBJS)

sql_tab.h sql_tab.c: sql.y
	bison -d sql.y

lexyy.o: lexyy.c sql_tab.h
	gcc $(CFLAGS) -c lexyy.c

lexyy.c: l.fle
	flex l.fle

---------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019