Yu-Gi-Oh! Deck Building and Card Inventory Management web interface written in Common Lisp, utilizing HTMX.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

135 Zeilen
4.5KB

  1. ################################################################################
  2. # Target Host Architecture
  3. ARCH ?= x86_64
  4. # docker / podman
  5. DOCKER ?= podman
  6. DOCKER_COMPOSE ?= podman-compose
  7. # Other programs
  8. LISP ?= sbcl
  9. RM ?= rm -f
  10. ################################################################################
  11. # Git Revision Info
  12. GIT_REV ?= $(shell git rev-parse master)
  13. # Influences the Docker Image Name
  14. IMAGE_NAME ?= cl-deck-builder2-$(GIT_REV)
  15. # For bind to this external address for docker-run
  16. EXTERNAL_ADDR ?= 5005
  17. EXTERNAL_SLYNK_ADDR ?= 4005
  18. # Platform passed to Dockerfile
  19. PLATFORM.x86_64 ?= linux/amd64
  20. PLATFORM.aarch64 ?= linux/arm64/v8
  21. PLATFORM ?= $(PLATFORM.$(ARCH))
  22. ################################################################################
  23. # Code Borrwed from openbookstore <https://gitlab.com/myopenbookstore/openbookstore>
  24. # List lisp files, unless they contains a #
  25. SRC += $(shell find src/ -name '*.lisp' -a ! -name '*#*')
  26. HTML += $(shell find templates/ -name '*.html' -a ! -name '*#*')
  27. DEPS += $(SRC) $(HTML) $(wildcard *.asd)
  28. # list of supported locales
  29. LOCALES := en_US
  30. # Example of how the variable should look after adding a new locale:
  31. # LOCALES := en_US en_GB fr_FR es_ES
  32. # list of .po files (computed from the LOCALES variable)
  33. PO_FILES := $(foreach locale,$(LOCALES),locale/$(locale)/LC_MESSAGES/cl-deck-builder2.po)
  34. # list of .mo files (computed from the LOCALES variable)
  35. MO_FILES := $(foreach locale,$(LOCALES),locale/$(locale)/LC_MESSAGES/cl-deck-builder2.mo)
  36. ################################################################################
  37. all:
  38. docker-build: Dockerfile test
  39. $(DOCKER) buildx build --platform $(PLATFORM) -t $(IMAGE_NAME) .
  40. docker-run:
  41. $(DOCKER) run --platform $(PLATFORM) \
  42. --rm -it -P -p $(EXTERNAL_SLYNK_ADDR):4005 -p $(EXTERNAL_ADDR):5005 \
  43. --userns=keep-id -v $(HOME)/public:/home/quicklisp/public:z $(IMAGE_NAME)
  44. docker-clean:
  45. -$(DOCKER) image rm -f $(IMAGE_NAME)
  46. clean-fasl:
  47. -find -name '*.fasl' | xargs $(RM) -fv
  48. clean: clean-fasl
  49. -find -name '*~' | xargs $(RM) -fv
  50. $(RM) -rf bin/
  51. # I use a feature flag, bc using djula:*recompile-templates-on-change*
  52. # requires to load Djula before our app, and it isn't exactly the same meaning.
  53. build-lisp-image: ${MO_FILES}
  54. $(LISP) --non-interactive \
  55. --eval '(ql:quickload "deploy")' \
  56. --load cl-deck-builder2.asd \
  57. --eval '(push :djula-binary *features*)' \
  58. --eval '(ql:quickload :cl-deck-builder2)' \
  59. --eval '(asdf:make :cl-deck-builder2)'
  60. # This must use a custom-built SBCL with a special parameter,
  61. # see linux-packaging README.
  62. # I have it under ~/.local/bin/bin/sbcl
  63. build-package:
  64. $(LISP) --non-interactive \
  65. --load cl-deck-builder2.asd \
  66. --eval '(ql:quickload :cl-deck-builder2)' \
  67. --eval '(setf *debugger-hook* (lambda (c h) (declare (ignore h)) (format t "~A~%" c) (sb-ext:quit :unix-status -1)))' \
  68. --eval '(asdf:make :cl-deck-builder2)'
  69. # build-gui:
  70. # $(LISP) --non-interactive \
  71. # --load cl-deck-builder2.asd \
  72. # --eval '(ql:quickload :bookshops/gui)' \
  73. # --eval '(asdf:make :bookshops/gui)'
  74. test:
  75. $(LISP) --non-interactive \
  76. --load cl-deck-builder2.asd \
  77. --load cl-deck-builder2-test.asd \
  78. --eval "(ql:quickload '(:cl-deck-builder2 :cl-deck-builder2-test))" \
  79. --eval "(asdf:test-system :cl-deck-builder2)"
  80. .PHONY: tr
  81. tr: ${MO_FILES}
  82. PO_TEMPLATE_DIR := locale/templates/LC_MESSAGES
  83. PO_TEMPLATE := ${PO_TEMPLATE_DIR}/cl-deck-builder2.pot
  84. # Rule to extract translatable strings from SRC
  85. ${PO_TEMPLATE_DIR}/lisp.pot: $(SRC)
  86. mkdir -p $(@D)
  87. xgettext -k_ -kN_ --language=lisp -o $@ $^
  88. # Rule to extract translatable strings from djula templates
  89. ${PO_TEMPLATE_DIR}/djula.pot: $(HTML) src/i18n.lisp
  90. $(LISP) --non-interactive \
  91. --eval '(ql:quickload "deploy")' \
  92. --eval '(asdf:load-asd (truename "cl-deck-builder2.asd"))' \
  93. --eval '(push :djula-binary *features*)' \
  94. --eval '(ql:quickload :cl-deck-builder2)' \
  95. --eval '(cl-deck-builder2.i18n:update-djula.pot)'
  96. # Rule to combine djula.pot and lisp.pot into cl-deck-builder2.pot
  97. ${PO_TEMPLATE}: ${PO_TEMPLATE_DIR}/djula.pot ${PO_TEMPLATE_DIR}/lisp.pot
  98. msgcat --use-first $^ > $@
  99. # Rule to generate or update the .po files from the .pot file
  100. locale/%/LC_MESSAGES/cl-deck-builder2.po: ${PO_TEMPLATE}
  101. mkdir -p $(@D)
  102. [ -f $@ ] || msginit --locale=$* \
  103. --no-translator \
  104. -i $< \
  105. -o $@ \
  106. && msgmerge --update $@ $<
  107. # Rule to create the .mo files from the .po files
  108. locale/%/LC_MESSAGES/cl-deck-builder2.mo: locale/%/LC_MESSAGES/cl-deck-builder2.po
  109. mkdir -p $(@D)
  110. msgfmt -o $@ $<