title: compile sdl2 with c on linux using makefile gives undefined reference error
body: <p>I'm not familiar with makefile and just modified a predefined makefile for my project. i was trying to build my project on windows and linux. it worked on windows with no error but when i try on Linux all sdl2 functions give errors like this:</p>
  <pre><code>/usr/bin/ld: src/scorepotion.o: in function `show_leaderboard':
  /home/kali/Desktop/project/src/scorepotion.c:263: undefined reference to `SDL_RenderCopy'
  /usr/bin/ld: /home/kali/Desktop/project/src/scorepotion.c:273: undefined reference to `roundedBoxRGBA'
  /usr/bin/ld: /home/kali/Desktop/project/src/scorepotion.c:280: undefined reference to `SDL_RenderCopy'
  /usr/bin/ld: /home/kali/Desktop/project/src/scorepotion.c:282: undefined reference to `SDL_RenderCopy'
  /usr/bin/ld: /home/kali/Desktop/project/src/scorepotion.c:283: undefined reference to `SDL_RenderPresent'
  /usr/bin/ld: /home/kali/Desktop/project/src/scorepotion.c:284: undefined reference to `SDL_Delay'
  /usr/bin/ld: /home/kali/Desktop/project/src/scorepotion.c:323: undefined reference to `SDL_DestroyTexture'
  /usr/bin/ld: /home/kali/Desktop/project/src/scorepotion.c:324: undefined reference to `SDL_DestroyTexture'
  /usr/bin/ld: /home/kali/Desktop/project/src/scorepotion.c:326: undefined reference to `SDL_RenderClear'
  /usr/bin/ld: /home/kali/Desktop/project/src/scorepotion.c:287: undefined reference to `SDL_PollEvent'
  </code></pre>
  <p>in my project folder i have this folders: src lib include output<br />
  and in lib there are some libXXX.a files</p>
  <p>this is my makefile:</p>
  <pre><code>#
  # 'make'        build executable file 'main'
  # 'make clean'  removes all .o and executable files
  #
  
  # define the C compiler to use
  CC = gcc
  
  # define any compile-time flags
  CFLAGS  := -m32 -Wall -Wextra -g  
  
  # define library paths in addition to /usr/lib
  #   if I wanted to include libraries not in /usr/lib I'd specify
  #   their path using -Lpath, something like:
  LFLAGS = -lSDL2 -lSDL2_image -lSDL2_gfx -lSDL2_ttf  -lSDL2_mixer
  
  # define output directory
  OUTPUT  := output
  
  # define source directory
  SRC     := src
  
  # define include directory
  INCLUDE := include
  
  # define lib directory
  LIB     := lib
  
  ifeq ($(OS),Windows_NT)
  MAIN    := territory.exe
  SOURCEDIRS  := $(SRC)
  INCLUDEDIRS := $(INCLUDE)
  LIBDIRS     := $(LIB)
  FIXPATH = $(subst /,\,$1)
  RM          := del /q /f
  MD  := mkdir
  else
  MAIN    := main
  SOURCEDIRS  := $(shell find $(SRC) -type d)
  INCLUDEDIRS := $(shell find $(INCLUDE) -type d)
  LIBDIRS     := $(shell find $(LIB) -type d)
  FIXPATH = $1
  RM = rm -f
  MD  := mkdir -p
  endif
  
  # define any directories containing header files other than /usr/include
  INCLUDES    := $(patsubst %,-I%, $(INCLUDEDIRS:%/=%))
  
  # define the C libs
  LIBS        := $(patsubst %,-L%, $(LIBDIRS:%/=%))
  
  # define the C source files
  SOURCES     := $(wildcard $(patsubst %,%/*.c, $(SOURCEDIRS)))
  
  # define the C object files 
  OBJECTS     := $(SOURCES:.c=.o)
  
  #
  # The following part of the makefile is generic; it can be used to 
  # build any executable just by changing the definitions above and by
  # deleting dependencies appended to the file from 'make depend'
  #
  
  OUTPUTMAIN  := $(call FIXPATH,$(OUTPUT)/$(MAIN))
  
  all: $(OUTPUT) $(MAIN)
      @echo Executing 'all' complete!
      $(OUTPUT)/$(MAIN)
      $(RM) $(call FIXPATH,$(OBJECTS))
  
  $(OUTPUT):
      $(MD) $(OUTPUT)
  
  $(MAIN): $(OBJECTS) 
      $(CC) $(CFLAGS) $(INCLUDES) -o $(OUTPUTMAIN) $(OBJECTS) $(LFLAGS) $(LIBS)  
  
  
  # this is a suffix replacement rule for building .o's from .c's
  # it uses automatic variables $&lt;: the name of the prerequisite of
  # the rule(a .c file) and $@: the name of the target of the rule (a .o file) 
  # (see the gnu make manual section about automatic variables)
  .c.o:
          $(CC) $(CFLAGS) $(INCLUDES) -c $&lt;  -o $@ 
  
  .PHONY: clean
  clean:
      $(RM) $(OUTPUTMAIN)
      $(RM) $(call FIXPATH,$(OBJECTS))
      @echo Cleanup complete!
  
  run: all
      ./$(OUTPUTMAIN)
      @echo Executing 'run: all' complete!
  </code></pre>
  <p>is the problem with makefile? how can I modify it?</p>