Makefile.am 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. # SPDX-License-Identifier: GPL-2.0 or GPL-3.0
  2. # Copyright © 2018-2019 Ariadne Devos
  3. # sHT -- build system -- list of dependencies
  4. AUTOMAKE_OPTIONS = subdir-objects foreign no-dist \
  5. -Wobsolete -Woverride -Wunsupported -Werror
  6. AM_CPPFLAGS = -D_GNU_SOURCE "-I$(srcdir)/arch/$(CONFIG_ARCH)" -Og -g2
  7. bin_PROGRAMS = shttpd
  8. shtsources = \
  9. buffer/append.c \
  10. buffer/lex.c \
  11. buffer/memeq.c \
  12. buffer/skip.c \
  13. fd/fd.c \
  14. fd/inet.c \
  15. generic/bug.c \
  16. lex/findchar.c \
  17. lex/ipv4.c \
  18. lex/nat-decimal.c \
  19. lex/nat-uphex.c \
  20. string/filler-merge.c \
  21. string/setops.c \
  22. task/accept.c \
  23. task/perform.c \
  24. task/sockrw.c \
  25. task/stream.c \
  26. worker/alloc.c \
  27. worker/block-mmap.c \
  28. worker/edge-epoll.c \
  29. worker/loop.c \
  30. worker/objcache.c \
  31. worker/schedule.c \
  32. worker/vector.c
  33. worker/objcache.c: worker/objcache-bless-table.c
  34. touch -c $@
  35. worker/objcache-bless-table.c: tools/gen-vector-variants.sh
  36. $< size sHT_objcache_bless objcache-bless.c > $@T && mv -T $@T $@
  37. tests/%$(EXEEXT): tests/%.o $(shttpd_OBJECTS) $(shttpd_DEPENDENCIES) $(EXTRA_shttpd_DEPENDENCIES)
  38. @rm -f shttpd$(EXEEXT)
  39. $(AM_V_CCLD)$(LINK) $< $(shttpd_OBJECTS) $(shttpd_LDADD) $(LIBS)
  40. tests = \
  41. tests/append \
  42. tests/bitvec \
  43. tests/cmp \
  44. tests/lex \
  45. tests/ipv4 \
  46. tests/memeq \
  47. tests/index-nospec
  48. testresult = tests/append
  49. %.result: %
  50. ./$< > "$@" 2>&1; \
  51. cat "$@" || exit 1; \
  52. if [ "$$?" -eq 0 ]; then \
  53. rm -f "$@-fail" ; \
  54. touch "$@-pass" || exit 1; \
  55. else \
  56. rm -f "$@-pass" ; \
  57. touch "$@-fail" || exit 1; \
  58. fi
  59. # TODO: fatal error: opening dependency file tests/.deps/append.Tpo
  60. # Work-around: mkdir tests/.deps
  61. # Future solution:
  62. # "don't write a portable Makefile, use a portable (GNU) make instead!"
  63. # (Mad Scientist's general advice)
  64. # don't support all platforms (s^2 requires architecture-specific support,
  65. # and WILL be formally verified for array bounds.
  66. test: $(foreach t,$(tests),$(t).result)
  67. @ echo Summary
  68. @ cat $(foreach t,$(tests),$(t).result)
  69. @ cat $(foreach t,$(tests),$(t).result-pass) || (echo 'not all tests passed' && exit 1)
  70. shttpdsources = \
  71. http/accept.c \
  72. http/stream.c
  73. shttpd_SOURCES = $(shtsources) $(shttpdsources)
  74. # Build the documentation with Sphinx.
  75. # It is configured in $(srcdir)/doc/conf.py.
  76. # <http://sphinx-doc.org/stable/>.
  77. #
  78. # -n: warn about all missing references
  79. # -q: only output warning
  80. # -W: turn warnings into errors
  81. # -d: cache directory
  82. # sourcedir, outdir
  83. html-local:
  84. sphinx-build -b html -n -q -d $(builddir)/doctrees $(srcdir)/doc $(builddir)/html
  85. mostlyclean-local:
  86. -rm -rf $(builddir)/html $(builddir)/doctrees
  87. # TODO: install the documentation