Makefile 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. manifests = lighttpd.manifest lighttpd-angel.manifest
  2. SRCDIR = lighttpd-1.4.30
  3. HOST = $(firstword $(shell ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' -m 1 | cut -d: -f2))
  4. PORT = 8000
  5. CORES = 4
  6. THREADS = 25
  7. conf_files = lighttpd-server.conf lighttpd.conf lighttpd-multithreaded.conf lighttpd-ssl.conf
  8. target = build-lighttpd $(conf_files) test-data
  9. exec_target = $(manifests)
  10. clean-extra = clean-others
  11. extra_rules = -e 's:\$$(HOST):$(HOST):g' -e 's:\$$(PORT):$(PORT):g'
  12. level = ../../
  13. include ../../Makefile
  14. build-lighttpd: build/sbin/lighttpd
  15. build/sbin/lighttpd: $(SRCDIR)
  16. cd $(SRCDIR) && ./configure --prefix=$(PWD)/build \
  17. --with-openssl --without-pcre --without-zlib --without-bzip2
  18. $(MAKE) -C $(SRCDIR)
  19. $(MAKE) -C $(SRCDIR) install
  20. $(SRCDIR): %: %.tar.gz
  21. tar -xzf $<
  22. lighttpd-server.conf:
  23. rm -rf $@
  24. echo "server.document-root = \"$(PWD)/html\"" >> $@
  25. echo "server.port = $(PORT)" >> $@
  26. echo "server.bind = \"$(HOST)\"" >> $@
  27. lighttpd.conf:
  28. rm -rf $@
  29. echo "include \"lighttpd-server.conf\"" >> $@
  30. echo "include \"lighttpd-generic.conf\"" >> $@
  31. lighttpd-multithreaded.conf:
  32. rm -rf $@
  33. echo "include \"lighttpd-server.conf\"" >> $@
  34. echo "server.max-worker = $(THREADS)" >> $@
  35. echo "include \"lighttpd-generic.conf\"" >> $@
  36. lighttpd-ssl.conf: server.pem
  37. rm -rf $@
  38. echo "include \"lighttpd-server.conf\"" >> $@
  39. echo "ssl.engine = \"enable\"" >> $@
  40. echo "ssl.pemfile = \"server.pem\"" >> $@
  41. echo "include \"lighttpd-generic.conf\"" >> $@
  42. server.pem:
  43. openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes -subj "/cn=lighttpd/o=oscar/dc=cs/dc=stonybrook/dc=edu/"
  44. start-native-server:
  45. $(PREFIX) build/sbin/lighttpd -D -m build/lib -f \
  46. $(if $(CONF),$(CONF),lighttpd.conf)
  47. start-multithreaded-native-server:
  48. $(PREFIX) build/sbin/lighttpd -D -m build/lib -f \
  49. $(if $(CONF),$(CONF),lighttpd-multithreaded.conf)
  50. start-ssl-native-server:
  51. $(PREFIX) build/sbin/lighttpd -D -m build/lib -f \
  52. $(if $(CONF),$(CONF),lighttpd-ssl.conf)
  53. start-graphene-server:
  54. $(PREFIX) ./lighttpd.manifest -D -m /lighttpd -f \
  55. $(if $(CONF),$(CONF),lighttpd.conf)
  56. start-multithreaded-graphene-server:
  57. $(PREFIX) ./lighttpd.manifest -D -m /lighttpd -f \
  58. $(if $(CONF),$(CONF),lighttpd-multithreaded.conf)
  59. start-ssl-graphene-server:
  60. $(PREFIX) ./lighttpd.manifest -D -m /lighttpd -f \
  61. $(if $(CONF),$(CONF),lighttpd-ssl.conf)
  62. random-data = $(foreach n,1 2 3 4 5 6 7 8 9 10,2K.$n.html) \
  63. $(foreach n,1 2 3 4 5,10K.$n.html) \
  64. $(foreach n,1 2 3 4 5,100K.$n.html) \
  65. $(foreach n,1 2 3,1M.$n.html) \
  66. $(foreach n,1 2 3,10M.$n.html) \
  67. $(foreach n,1 2 3,100.$n.html)
  68. test-data = html/oscar-web html/oscar-web-static html/random \
  69. $(addprefix html/random/,$(random-data))
  70. html/%: ../web-data/%.tar.gz
  71. [ -d "$@" ] || (cd $(dir $@) && tar -xzf ../$^)
  72. html/random:
  73. mkdir -p $@
  74. html/random/%.html: html/random
  75. dd if=/dev/urandom of=$@ count=1 bs=$(basename $(basename $(notdir $@)))
  76. test-data: $(test-data)
  77. distclean: clean
  78. rm -rf build $(SRCDIR)
  79. clean-others:
  80. rm -rf $(conf_files) $(test-data)