makefile 1.8 KB

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