Makefile 3.8 KB

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