title: Makefile for fftw3?
body: <p>So I can compile my code (fftw_ex.c) directly with:</p>
  
  <pre><code>    login$ gcc -o -g fftw_ex fftw_ex.c -I$TACC_FFTW3_INC -L$TACC_FFTW3_LIB -lfftw3
  </code></pre>
  
  <p>However, my professor prefers that we use a Makefile. I am just learning how to use Makefile and make, and I'm having trouble creating the Makefile. So far, this is what I have:</p>
  
  <pre><code>    #                     RULES
  
      EXEC := fftw_ex
      SRC := $(wildcard *.c)
      OBJ := $(patsubst %.c,%.o,%(SRC))
  
      #                     OPERATIONS
  
      CC := gcc
      CFLAGS := -O3 -I$TACC_FFTW3_INC
      LDFLAGS := -L$TACC_FFTW3_LIB
      LDLIBS := -lfftw3
  
      $(EXEC): $(OBJ)
              $(CC) $(LDFLAGS) $(LDLIBS) -o -g $@ $^
  
      %.o: %.c
              $(CC) $(CFLAGS) -c $&lt;
  
      #                   PHONY TARGETS
  
      .PHONY: clean
  
      clean:
              @echo Cleaning...;rm -rf *.o fftw_ex
  </code></pre>
  
  <p>I know there's a problem with the SRC line, as i'm getting the error message:</p>
  
  <pre><code>    make: *** No rule to make target `%(SRC)', needed by `fftw_ex'.  Stop.
  </code></pre>
  
  <p>Any help to get this to work would be appreciated.</p>