makefile 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. # Ccompiler
  2. CC= gcc
  3. # Executable name
  4. BIN= ld42
  5. # Source and build paths
  6. SRC_DIR= ./src
  7. BUILD_DIR= ./build
  8. # Source files
  9. SRCS=main.c\
  10. window.c\
  11. event.c\
  12. images_diffuse.c\
  13. loops.c particle.c\
  14. renderer.c\
  15. vector.c\
  16. entity.c\
  17. component.c\
  18. button.c\
  19. game.c\
  20. icon.c\
  21. stb_imp.c\
  22. player.c\
  23. satellite.c\
  24. bullet.c\
  25. hitbox.c\
  26. explosions.c\
  27. screenshot.c\
  28. hitpoint.c\
  29. random.c\
  30. basic_spray.c\
  31. util.c\
  32. help_text.c\
  33. background.c\
  34. levels.c\
  35. weapon_choice.c\
  36. triangle_ship.c\
  37. cycle_ship.c\
  38. missile_ship.c\
  39. mothership.c
  40. # Sprites
  41. # Object files to build
  42. OBJS= $(SRCS:%.c=%.o)
  43. # Dependencies for each source
  44. DEPS= $(OBJS:%.o=$(BUILD_DIR)/%.d)
  45. # Flags for the compiler
  46. CFLAGS= -O2 -Wall -Wno-unused-variable -lglfw3 -lopengl32 -lgdi32 -lpthread -lzgcl -lsdl2 -lSDL2_mixer
  47. # Default path for make install
  48. INSTALL_PATH?=/usr/local
  49. $(BIN) : $(OBJS:%=$(BUILD_DIR)/%)
  50. #build/shoehorn_sdl.o
  51. $(CC) $^ build/shoehorn_sdl.o -o $@ $(CFLAGS)
  52. -include $(DEPS)
  53. $(BUILD_DIR)/%.o : $(SRC_DIR)/%.c
  54. mkdir -p $(@D)
  55. $(CC) -MMD -c $< -o $@ $(CFLAGS)
  56. shoehorn:
  57. gcc -c src/shoehorn_sdl.c -o build/shoehorn_sdl.o -lmingw32 -lsdl2 -lsdl2_mixer
  58. .PHONY : clean install windows sprite
  59. clean :
  60. rm -rf $(BUILD_DIR)
  61. rm $(BIN) || rm $(BIN).exe
  62. sprite:
  63. make -C sprite
  64. install : $(BIN)
  65. cp $(BIN) $(INSTALL_PATH)/bin
  66. windows : $(OBJS:%=$(BUILD_DIR)/%)
  67. $(CC) $^ build/shoehorn_sdl.o -o WarpTunnel.exe $(CFLAGS) -mwindows