Makefile 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. .PHONY: build-lighttpd
  15. build-lighttpd: build/sbin/lighttpd
  16. build/sbin/lighttpd: $(SRCDIR)
  17. cd $(SRCDIR) && ./configure --prefix=$(PWD)/build \
  18. --with-openssl --without-pcre --without-zlib --without-bzip2
  19. $(MAKE) -C $(SRCDIR)
  20. $(MAKE) -C $(SRCDIR) install
  21. $(SRCDIR): %: %.tar.gz
  22. tar -xmzf $<
  23. lighttpd-server.conf:
  24. rm -rf $@
  25. echo "server.document-root = \"$(PWD)/html\"" >> $@
  26. echo "server.port = $(PORT)" >> $@
  27. echo "server.bind = \"$(HOST)\"" >> $@
  28. lighttpd.conf:
  29. rm -rf $@
  30. echo "include \"lighttpd-server.conf\"" >> $@
  31. echo "include \"lighttpd-generic.conf\"" >> $@
  32. lighttpd-multithreaded.conf:
  33. rm -rf $@
  34. echo "include \"lighttpd-server.conf\"" >> $@
  35. echo "server.max-worker = $(THREADS)" >> $@
  36. echo "include \"lighttpd-generic.conf\"" >> $@
  37. lighttpd-ssl.conf: server.pem dhparam.pem
  38. rm -rf $@
  39. echo "include \"lighttpd-server.conf\"" >> $@
  40. echo "include \"lighttpd-generic.conf\"" >> $@
  41. echo "" >> $@
  42. echo "\$$SERVER[\"socket\"] == \"0.0.0.0:443\" {" >> $@
  43. echo "ssl.engine = \"enable\"" >> $@
  44. echo "ssl.pemfile = \"server.pem\"" >> $@
  45. echo "ssl.cipher-list = \"ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA\"" >> $@
  46. echo "ssl.honor-cipher-order = \"enable\"" >> $@
  47. echo "ssl.dh-file = \"dhparam.pem\"" >> $@
  48. echo "ssl.ec-curve = \"secp384r1\"" >> $@
  49. echo "}" >> $@
  50. server.pem:
  51. openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes -subj "/cn=lighttpd/o=oscar/dc=cs/dc=stonybrook/dc=edu/"
  52. dhparam.pem:
  53. openssl dhparam -out dhparam.pem 2048
  54. .PHONY: start-native-server
  55. start-native-server:
  56. $(PREFIX) build/sbin/lighttpd -D -m build/lib -f \
  57. $(if $(CONF),$(CONF),lighttpd.conf)
  58. .PHONY: start-multithreaded-native-server
  59. start-multithreaded-native-server:
  60. $(PREFIX) build/sbin/lighttpd -D -m build/lib -f \
  61. $(if $(CONF),$(CONF),lighttpd-multithreaded.conf)
  62. .PHONY: start-ssl-native-server
  63. start-ssl-native-server:
  64. $(PREFIX) build/sbin/lighttpd -D -m build/lib -f \
  65. $(if $(CONF),$(CONF),lighttpd-ssl.conf)
  66. .PHONY: start-graphene-server
  67. start-graphene-server:
  68. $(PREFIX) ./lighttpd.manifest -D -m /lighttpd -f \
  69. $(if $(CONF),$(CONF),lighttpd.conf)
  70. .PHONY: start-multithreaded-graphene-server
  71. start-multithreaded-graphene-server:
  72. $(PREFIX) ./lighttpd.manifest -D -m /lighttpd -f \
  73. $(if $(CONF),$(CONF),lighttpd-multithreaded.conf)
  74. .PHONY: start-ssl-graphene-server
  75. start-ssl-graphene-server:
  76. $(PREFIX) ./lighttpd.manifest -D -m /lighttpd -f \
  77. $(if $(CONF),$(CONF),lighttpd-ssl.conf)
  78. random-data = $(foreach n,1 2 3 4 5 6 7 8 9 10,2K.$n.html) \
  79. $(foreach n,1 2 3 4 5,10K.$n.html) \
  80. $(foreach n,1 2 3 4 5,100K.$n.html) \
  81. $(foreach n,1 2 3,1M.$n.html) \
  82. $(foreach n,1 2 3,10M.$n.html) \
  83. $(foreach n,1 2 3,100.$n.html)
  84. test-data = html/oscar-web html/oscar-web-static html/random \
  85. $(addprefix html/random/,$(random-data))
  86. html/%: ../web-data/%.tar.gz
  87. [ -d "$@" ] || (cd $(dir $@) && tar -xzf ../$^)
  88. html/random:
  89. mkdir -p $@
  90. html/random/%.html: html/random
  91. dd if=/dev/urandom of=$@ count=1 bs=$(basename $(basename $(notdir $@)))
  92. test-data: $(test-data)
  93. .PHONY: distclean
  94. distclean: clean
  95. rm -rf build $(SRCDIR)
  96. .PHONY: clean-others
  97. clean-others:
  98. rm -rf $(conf_files) $(test-data)