makefile 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. # CC = cc
  2. SRCCOMMON = src/global-state.c src/data-structure.c src/hashing.c src/file-loading.c 3rdparty/stringutils/src/stringutils.c 3rdparty/vec/src/vec.c
  3. SRCGUI = src/picunic-gui.c src/gui-loop.c
  4. SRCCLI =
  5. NAMEGUI = picunic-gui
  6. NAMECLI = picunic-cli
  7. PREFIX = /usr/local
  8. INCLUDEPATHS = -I./include -I./3rdparty -I./3rdparty/raylib/src -I./3rdparty/raygui/src -I./3rdparty/stringutils/include -I./3rdparty/vec/src
  9. CFLAGSGUI = -Wall -Wextra -Wpedantic --std=c99 -D_DEFAULT_SOURCE ${INCLUDEPATHS}
  10. ifeq ($(OS),Windows_NT)
  11. LDFLAGSGUI = -L3rdparty/raylib/src -lraylib -lm -lpthread -ldl -lwinmm -lgdi32 -ldxguid -lregex -ltre -lintl -liconv -static
  12. else
  13. LDFLAGSGUI = -L3rdparty/raylib -lraylib -lGL -lm -lpthread -ldl -lrt -lX11
  14. endif
  15. CFLAGSCLI =
  16. LDFLAGSCLI =
  17. all: prepare-debug ${NAMEGUI}
  18. release: clean prepare-release ${NAMEGUI}
  19. run-${NAMEGUI}: prepare-debug ${NAMEGUI}
  20. bin/${NAMEGUI}
  21. prepare-debug:
  22. $(eval CFLAGSGUI += -O2 -g -ggdb3)
  23. @echo "Debug version"
  24. prepare-release:
  25. $(eval CFLAGSGUI += -O3 -s)
  26. @echo "Release version"
  27. raylib:
  28. git apply --directory=3rdparty/raylib patches/0001-config-changes.patch
  29. $(MAKE) -C ./3rdparty/raylib/src
  30. git apply -R --directory=3rdparty/raylib patches/0001-config-changes.patch
  31. optionsgui:
  32. @echo ""
  33. @echo "========================================="
  34. @echo "Opts:"
  35. @echo "CFLAGS = ${CFLAGSGUI}"
  36. @echo "LDFLAGS = ${LDFLAGSGUI}"
  37. @echo "CC = ${CC}"
  38. @echo "========================================="
  39. @echo ""
  40. optionscli:
  41. @echo ""
  42. @echo "========================================="
  43. @echo "Opts:"
  44. @echo "CFLAGS = ${CFLAGSCLI}"
  45. @echo "LDFLAGS = ${LDFLAGSCLI}"
  46. @echo "CC = ${CC}"
  47. @echo "========================================="
  48. @echo ""
  49. ${NAMEGUI}: raylib optionsgui
  50. mkdir -p bin
  51. ${CC} ${SRCGUI} ${SRCCOMMON} ${CFLAGSGUI} ${LDFLAGSGUI} -o bin/${NAMEGUI}
  52. # bin/${NAMEGUI}
  53. ${NAMECLI}: optionscli
  54. mkdir -p bin
  55. ${CC} {SRCCOMMON} ${SRCCLI} ${CFLAGSCLI} ${LDFLAGSCLI} -o bin/${NAMECLI}
  56. clean:
  57. rm -rf bin
  58. rm -rf obj
  59. install:
  60. cp -i bin/${NAMEGUI} ${PREFIX}/bin/${NAMEGUI}
  61. uninstall:
  62. rm -i ${PREFIX}/bin/${NAMEGUI}
  63. .PHONY: all install uninstall clean