Unix Programming - A make question

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > April 2004 > A make question





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author A make question
Daniel Haude

2004-04-23, 8:34 am

Hello,

Why is make complaining about a "circular dependency" in this makefile?

----
dh@kir:~/c/foo$ cat Makefile
lexer.yy.c : lexer.yy
flex --header-file=lexer.yy.h -o $@ $<
dh@kir:~/c/foo$ make
make: Circular lexer.yy <- lexer.yy.c dependency dropped.
dh@kir:~/c/foo$
----

Strangely, the error disappears when I call the target something else than
lexer.yy.c

What's the cause of this?

Thsnks,
**Daniel

--
"With me is nothing wrong! And with you?" (from r.a.m.p)
Barry Margolin

2004-04-23, 8:34 am

In article <slrnc8i0mb.7dd.haude@kir.physnet.uni-hamburg.de>,
Daniel Haude <haude@physnet.uni-hamburg.de> wrote:

> Hello,
>
> Why is make complaining about a "circular dependency" in this makefile?
>
> ----
> dh@kir:~/c/foo$ cat Makefile
> lexer.yy.c : lexer.yy
> flex --header-file=lexer.yy.h -o $@ $<
> dh@kir:~/c/foo$ make
> make: Circular lexer.yy <- lexer.yy.c dependency dropped.
> dh@kir:~/c/foo$
> ----
>
> Strangely, the error disappears when I call the target something else than
> lexer.yy.c
>
> What's the cause of this?


Make has built-in dependencies for:

*: *.o
*.o: *.c

which creates an indirect dependency for * <- *.c.

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
Lorinczy Zsigmond / Domonyik Mariann

2004-04-24, 1:34 am

Daniel Haude wrote:

> Hello,
>
> Why is make complaining about a "circular dependency" in this makefile?
>
> ----
> dh@kir:~/c/foo$ cat Makefile
> lexer.yy.c : lexer.yy
> flex --header-file=lexer.yy.h -o $@ $<
> dh@kir:~/c/foo$ make
> make: Circular lexer.yy <- lexer.yy.c dependency dropped.
> dh@kir:~/c/foo$
> ----
>
> Strangely, the error disappears when I call the target something else than
> lexer.yy.c
>
> What's the cause of this?


You should use the standard file-extensions, like lexer.y, lexer.c, lexer.h
Daniel Haude

2004-04-26, 4:34 am

On Fri, 23 Apr 2004 08:24:11 -0400,
Barry Margolin <barmar@alum.mit.edu> wrote
in Msg. <barmar-126C97.08241123042004@comcast.ash.giganews.com>
> Make has built-in dependencies for:
>
> *: *.o
> *.o: *.c
>
> which creates an indirect dependency for * <- *.c.


...which means that make would like to create lexer.yy from lexer.yy.c (via
lexer.yy.o) instead of lexer.yy.c from lexer.yy? I guess that makes
sense. Renaming the files appropriately took care of it. Thanks for the
help (and note my flex question elsewhere on this group ;-)

--Daniel

--
"With me is nothing wrong! And with you?" (from r.a.m.p)
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com