title: Makefile in multiple directories and multiple sources
body: <p>I have a small project with the following directory structure:</p>
  
  <pre><code>src/
    game/
      some srcs...
    platform/
      sdl/
        main.c
        Makefile
    engine.c
    engine.h
  Makefile
  </code></pre>
  
  <p>I'm planning to have multiple directories inside platform with the different platforms i'm targeting my small project. The root-level Makefile is just a helper: it allows me to, from the root folder, run things like "make platform-name", "make platform-name-clean", etc.</p>
  
  <p>Here's my actual Makefile, inside the platform folder:</p>
  
  <pre><code>TARGET = sdl-game
  SRC_FOLDER = ../..
  CC = gcc
  CFLAGS = -g -Wall -DPLAT_SDL
  LDFLAGS = -lm
  
  OBJECTS = main.o \
          $(SRC_FOLDER)/engine.o \
          $(SRC_FOLDER)/game/game.o \
          $(SRC_FOLDER)/game/components.o
  
  $(TARGET): $(OBJECTS)
      $(CC) -o $(TARGET) $(OBJECTS) $(CFLAGS) $(LDFLAGS)
  
  clean:
      rm -rf $(SRC_FOLDER)/*.o
      rm -rf $(SRC_FOLDER)/game/*.o
      rm -rf $(SRC_FOLDER)/platform/sdl/*.o
      rm -rf $(SRC_FOLDER)/platform/sdl/sdl
  </code></pre>
  
  <p>The problem is: i'm not able to run this from outside the platform/sdl folder with my root-level Makefile:</p>
  
  <pre><code>null:
  make -C src/platform/sdl -f Makefile
  </code></pre>
  
  <p>Any ideas? Also, how do i move those .o objects to a "build/platform-name" folder?</p>