makefile 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 = -O2 -g -ggdb3 -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: clean ${NAMEGUI}
  18. run-${NAMEGUI}: ${NAMEGUI}
  19. bin/${NAMEGUI}
  20. raylib:
  21. git apply --directory=3rdparty/raylib patches/0001-config-changes.patch
  22. $(MAKE) -C ./3rdparty/raylib/src
  23. git apply -R --directory=3rdparty/raylib patches/0001-config-changes.patch
  24. optionsgui:
  25. @echo ""
  26. @echo "========================================="
  27. @echo "Opts:"
  28. @echo "CFLAGS = ${CFLAGSGUI}"
  29. @echo "LDFLAGS = ${LDFLAGSGUI}"
  30. @echo "CC = ${CC}"
  31. @echo "========================================="
  32. @echo ""
  33. optionscli:
  34. @echo ""
  35. @echo "========================================="
  36. @echo "Opts:"
  37. @echo "CFLAGS = ${CFLAGSCLI}"
  38. @echo "LDFLAGS = ${LDFLAGSCLI}"
  39. @echo "CC = ${CC}"
  40. @echo "========================================="
  41. @echo ""
  42. ${NAMEGUI}: raylib optionsgui
  43. mkdir -p bin
  44. ${CC} ${SRCGUI} ${SRCCOMMON} ${CFLAGSGUI} ${LDFLAGSGUI} -o bin/${NAMEGUI}
  45. # bin/${NAMEGUI}
  46. ${NAMECLI}: optionscli
  47. mkdir -p bin
  48. ${CC} {SRCCOMMON} ${SRCCLI} ${CFLAGSCLI} ${LDFLAGSCLI} -o bin/${NAMECLI}
  49. clean:
  50. rm -rf bin
  51. rm -rf obj
  52. install:
  53. cp -i bin/${NAMEGUI} ${PREFIX}/bin/${NAMEGUI}
  54. uninstall:
  55. rm -i ${PREFIX}/bin/${NAMEGUI}
  56. .PHONY: all install uninstall clean