title: create makefile for static library and executable simultaniously
body: <p>I have 3 files which should included in static library (file1.c,file2.c,file3.c) and one file which should include the main function (main.c file) and linked to the static library.</p>
  
  <p>I would like to create one makefile that create the library and then create the executable.</p>
  
  <p>My base makefile is:</p>
  
  <pre><code>CC=gcc
  CFLAGS=-c -Wall
  LDFLAGS=
  SOURCES=file1.c file2.c file3.c
  OBJECTS=$(SOURCES:.c=.o)
  OUT=libctest.a
  EXECUTABLE=hello
  LDFLAGS = -static
  
  .c.o:
      $(CC) $(CFLAGS) -c $&lt; -o $@
  
  $(OUT): $(OBJECTS)
      ar rcs $(OUT) $(OBJECTS)
  
  all:
      (CC) -o $(EXECUTABLE) main.c $(OUT)
  
  clean:
      rm -f $(OBJECTS) $(OUT)
  </code></pre>
  
  <p>The library is created but the executable doesn't created (all:   (CC) -o $(EXECUTABLE) main.c $(OUT))
  Any idea what is needed?</p>