makefile 476 B

12345678910111213141516171819202122232425
  1. # compiler flags
  2. SDL_LIB = -lSDL2 -lSDL2_image
  3. CXXFLAGS = -Wall -c
  4. LDFLAGS = $(SDL_LIB)
  5. # files
  6. SRC = $(wildcard *.c ${TARGET}/*.c ${GAME})
  7. OBJ = ${SRC:.c=.o}
  8. HEADERS = $(wildcard *.h ${TARGET}/*.h)
  9. # if GAME is defined, compile to the final game
  10. all: ${OBJ}
  11. test ! ${GAME} || ${CC} ${OBJ} -o output ${LDFLAGS}
  12. # how to compile C files
  13. .c.o:
  14. $(CC) -c -o ${<:.c=.o} $< -I .
  15. # for now, all objects depend on all headers
  16. ${OBJ}: ${HEADERS}
  17. # clean files
  18. clean:
  19. rm ${OBJ}