makefile 2.7 KB

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