Makefile 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. manifests = nginx.manifest
  2. SRCDIR = nginx-1.10.1
  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 = http.t
  8. target = build-nginx $(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-nginx: build/sbin/nginx
  15. build/sbin/nginx: $(SRCDIR)
  16. cd $(SRCDIR) && ./configure --prefix=$(PWD)/build
  17. $(MAKE) -C $(SRCDIR)
  18. $(MAKE) -C $(SRCDIR) install
  19. $(SRCDIR): %: %.tar.gz
  20. tar -xzf $<
  21. $(conf_files): %.t: %.t.template
  22. sed $(extra_rules) $< > $@
  23. start-native-server:
  24. $(PREFIX) build/sbin/nginx -c $(abspath http.t)
  25. start-graphene-server:
  26. $(PREFIX) ./nginx.manifest -c $(abspath http.t) -g "user root;"
  27. random-data = $(foreach n,1 2 3 4 5 6 7 8 9 10,2K.$n.html) \
  28. $(foreach n,1 2 3 4 5,10K.$n.html) \
  29. $(foreach n,1 2 3 4 5,100K.$n.html) \
  30. $(foreach n,1 2 3,1M.$n.html) \
  31. $(foreach n,1 2 3,10M.$n.html) \
  32. $(foreach n,1 2 3,100.$n.html)
  33. test-data = build/html/oscar-web build/html/oscar-web-static build/html/random \
  34. $(addprefix build/html/random/,$(random-data))
  35. build/html/%: ../web-data/%.tar.gz
  36. [ -d "$@" ] || (cd $(dir $@) && tar -xzf ../../$^)
  37. build/html/random:
  38. mkdir -p $@
  39. build/html/random/%.html: build/html/random
  40. dd if=/dev/urandom of=$@ count=1 bs=$(basename $(basename $(notdir $@)))
  41. test-data: $(test-data)
  42. distclean: clean
  43. rm -rf build $(SRCDIR)
  44. clean-others:
  45. rm -rf $(conf_files) $(test-data)