title: Makefile circular dependency
body: <p>Here is my Makefile:</p>
  
  <pre><code>.PHONY: all homework1
  CFLAGS= -g -O0 -Wall -Werror -Wno-unused-function
  LDFLAGS= -lm
  
  all : homework1
  
  homework1 : program.tab.o program.lex.o
  %.o : %.c
      gcc -o$@ -c $(CFLAGS) $&lt;
  %.lex.c : %.lex %.tab.h
      flex -o$@ $&lt;
  %.tab.c %.tab.h : %.y
      bison --verbose -o$@ -d $&lt;
  </code></pre>
  
  <p>Whenever I try to compile, I get the warning <code>make: Circular program.lex &lt;- program.lex.o dependency dropped.</code> I don't see how <code>program.lex</code> is dependent on <code>program.lex.o</code> at all in the makefile. I see how the dependency tree is about 4 layers deep, but it doesn't look circular.</p>
  
  <p>How can I improve my makefile?</p>