Makefile 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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. conf_files = lighttpd-server.conf lighttpd.conf lighttpd-multithreaded.conf
  7. target = build-lighttpd $(conf_files) test-data
  8. exec_target = $(manifests)
  9. clean-extra = clean-others
  10. extra_rules = \
  11. -e 's:\$$(PAL):../pal_loader:g' \
  12. -e 's:\$$(HOST):$(HOST):g' \
  13. -e 's:\$$(PORT):$(PORT):g'
  14. level = ../../
  15. include ../../Makefile
  16. build-lighttpd: build/sbin/lighttpd
  17. build/sbin/lighttpd: $(SRCDIR)
  18. cd $(SRCDIR) && ./configure --prefix=$(PWD)/build \
  19. --without-openssl --without-pcre --without-zlib --without-bzip2
  20. $(MAKE) -C $(SRCDIR)
  21. $(MAKE) -C $(SRCDIR) install
  22. $(SRCDIR): %: %.tar.gz
  23. tar -xzf $<
  24. lighttpd-server.conf:
  25. rm -rf $@
  26. echo "server.document-root = \"$(PWD)/html\"" >> $@
  27. echo "server.port = $(PORT)" >> $@
  28. echo "server.bind = \"$(HOST)\"" >> $@
  29. lighttpd.conf:
  30. rm -rf $@
  31. echo "include \"lighttpd-server.conf\"" >> $@
  32. echo "include \"lighttpd-generic.conf\"" >> $@
  33. lighttpd-multithreaded.conf:
  34. rm -rf $@
  35. echo "include \"lighttpd-server.conf\"" >> $@
  36. echo "server.max-worker = $(CORES)" >> $@
  37. echo "include \"lighttpd-generic.conf\"" >> $@
  38. start-native-server:
  39. $(PREFIX) build/sbin/lighttpd -D -m build/lib -f \
  40. $(if $(CONF),$(CONF),lighttpd.conf)
  41. start-multithreaded-native-server:
  42. $(PREFIX) build/sbin/lighttpd -D -m build/lib -f \
  43. $(if $(CONF),$(CONF),lighttpd-multithreaded.conf)
  44. start-graphene-server:
  45. $(PREFIX) ../pal_loader build/sbin/lighttpd -D -m /lighttpd -f \
  46. $(if $(CONF),$(CONF),lighttpd.conf)
  47. start-multithreaded-graphene-server:
  48. $(PREFIX) ../pal_loader build/sbin/lighttpd -D -m /lighttpd -f \
  49. $(if $(CONF),$(CONF),lighttpd-multithreaded.conf)
  50. random-data = $(foreach n,1 2 3 4 5 6 7 8 9 10,2K.$n.html) \
  51. $(foreach n,1 2 3 4 5,10K.$n.html) \
  52. $(foreach n,1 2 3 4 5,100K.$n.html) \
  53. $(foreach n,1 2 3,1M.$n.html) \
  54. $(foreach n,1 2 3,10M.$n.html) \
  55. $(foreach n,1 2 3,100.$n.html)
  56. test-data = html/oscar-web html/oscar-web-static html/random \
  57. $(addprefix html/random/,$(random-data))
  58. try-download:
  59. echo "download random files ($(TESTNAME)):" >> result; \
  60. time -a -o result -p wget $(addprefix http://$(HOST):$(PORT)/random/,$(random-data)) -O wget-out; \
  61. echo "download random files again ($(TESTNAME)):" >> result; \
  62. time -a -o result -p wget $(addprefix http://$(HOST):$(PORT)/random/,$(random-data)) -O wget-out; \
  63. echo "download static oscar-web ($(TESTNAME)):" >> result; \
  64. time -a -o result -p wget -r http://$(HOST):$(PORT)/oscar-web-static/index.php -O wget-out;
  65. test-native: $(test-data)
  66. $(MAKE) start-native-server & serverid=$$!; sleep 1; \
  67. $(MAKE) try-download TESTNAME=native; \
  68. rm wget-out; kill $$serverid
  69. test-multithreaded-native: $(test-data)
  70. $(MAKE) start-multithreaded-native-server & serverid=$$!; sleep 1; \
  71. $(MAKE) try-download TESTNAME=native; \
  72. rm wget-out; kill $$serverid
  73. test-graphene: $(test-data)
  74. $(MAKE) start-graphene-server & serverid=$$!; sleep 1; \
  75. $(MAKE) try-download TESTNAME=graphene; \
  76. rm wget-out; kill $$serverid
  77. test-multithreaded-graphene: $(test-data)
  78. $(MAKE) start-multithreaded-graphene-server & serverid=$$!; sleep 1; \
  79. $(MAKE) try-download TESTNAME=graphene; \
  80. rm wget-out; kill $$serverid
  81. html/%: ../web-data/%.tar.gz
  82. [ -d "$@" ] || (cd html && tar -xzf ../$^)
  83. html/random:
  84. mkdir -p html/random
  85. html/random/%.html: html/random
  86. dd if=/dev/urandom of=$@ count=1 bs=$(basename $(basename $(notdir $@)))
  87. test-data: $(test-data)
  88. distclean: clean
  89. rm -rf build $(SRCDIR)
  90. clean-others:
  91. rm -rf $(conf_files) $(test-data)