Source code of the Visual Novel Database https://vndb.org/
website

Makefile 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. # all (default)
  2. # Same as `make dirs js icons skins robots`
  3. #
  4. # dirs
  5. # Creates the required directories not present in git
  6. #
  7. # js
  8. # Generates the Javascript code
  9. #
  10. # icons
  11. # Generates the CSS icon sprites
  12. #
  13. # skins
  14. # Generates the CSS code
  15. #
  16. # robots
  17. # Ensures that www/robots.txt and static/robots.txt exist. Can be modified to
  18. # suit your needs.
  19. #
  20. # chmod
  21. # For when the http process is run from a different user than the files are
  22. # chown'ed to. chmods all files and directories written to from vndb.pl.
  23. #
  24. # chmod-autoupdate
  25. # As chmod, but also chmods all files that may need to be updated from a
  26. # normal 'make' run. Should be used when the regen_static option is enabled
  27. # and the http process is run from a different user.
  28. #
  29. # multi-start, multi-stop, multi-restart:
  30. # Start/stop/restart the Multi daemon. Provided for convenience, a proper initscript
  31. # probably makes more sense.
  32. #
  33. # NOTE: This Makefile has only been tested using a recent version of GNU make
  34. # in a relatively up-to-date Arch/Gentoo Linux environment, and may not work in
  35. # other environments. Patches to improve the portability are always welcome.
  36. .PHONY: all dirs js icons skins robots chmod chmod-autoupdate multi-stop multi-start multi-restart
  37. all: dirs js skins robots data/config.pl util/sql/editfunc.sql
  38. dirs: static/ch static/f static/cv static/sf static/st data/log www www/feeds www/api
  39. js: static/f/vndb.js
  40. icons: data/icons/icons.css
  41. skins: $(shell ls static/s | sed -e 's/\(.\+\)/static\/s\/\1\/style.css/g')
  42. robots: dirs www/robots.txt static/robots.txt
  43. util/sql/editfunc.sql: util/sqleditfunc.pl util/sql/schema.sql
  44. util/sqleditfunc.pl
  45. static/ch static/cv static/sf static/st:
  46. mkdir -p $@;
  47. for i in $$(seq -w 0 1 99); do mkdir -p "$@/$$i"; done
  48. data/log www www/feeds www/api static/f:
  49. mkdir -p $@
  50. data/config.pl:
  51. cp -n data/config_example.pl data/config.pl
  52. static/f/vndb.js: data/js/*.js util/jsgen.pl data/config.pl data/global.pl | static/f
  53. util/jsgen.pl
  54. data/icons/icons.css: data/icons/*.png data/icons/*/*.png util/spritegen.pl | static/f
  55. util/spritegen.pl
  56. static/s/%/style.css: static/s/%/conf util/skingen.pl data/style.css data/icons/icons.css
  57. util/skingen.pl $*
  58. %/robots.txt:
  59. echo 'User-agent: *' > $@
  60. echo 'Disallow: /' >> $@
  61. chmod: all
  62. chmod -R a-x+rwX static/{ch,cv,sf,st}
  63. chmod-autoupdate: chmod
  64. chmod a+xrw static/f data/icons
  65. chmod -f a-x+rw static/s/*/{style.css,boxbg.png} static/f/icons.png
  66. # may wait indefinitely, ^C and kill -9 in that case
  67. define multi-stop
  68. if [ -s data/multi.pid ]; then\
  69. kill `cat data/multi.pid`;\
  70. while [ -s data/multi.pid ]; do\
  71. if kill -0 `cat data/multi.pid`; then sleep 1;\
  72. else rm -f data/multi.pid; fi\
  73. done;\
  74. fi
  75. endef
  76. define multi-start
  77. util/multi.pl
  78. endef
  79. multi-stop:
  80. $(multi-stop)
  81. multi-start:
  82. $(multi-start)
  83. multi-restart:
  84. $(multi-stop)
  85. $(multi-start)