Makefile 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. SYS ?= $(shell gcc -dumpmachine)
  2. export SYS
  3. LMBENCHDIR = lmbench-2.5
  4. LMBENCHMANIFEST = manifest-list
  5. export CC
  6. export CFLAGS
  7. all debug: $(LMBENCHMANIFEST)
  8. for f in `cat $(LMBENCHMANIFEST)`; do make $${f%.template}; done
  9. debug: CC="gcc -g"
  10. kvm: CFLAGS += -DKVM_BENCH -D_DEBUG
  11. kvm: all
  12. servers = lat_udp lat_tcp lat_rpc lat_connect bw_tcp
  13. %.manifest: manifest.template
  14. make -C .. lmbench/$@ appdir=lmbench/
  15. echo $(if $(findstring $(notdir $(basename $@)),$(servers)),"loader.daemonize = 1") >> $@
  16. ifeq ($(SYS),x86_64-linux-gnu)
  17. $(LMBENCHDIR)/bin/linux: $(wildcard $(LMBENCHDIR)/src/*.c) $(wildcard $(LMBENCHDIR)/src/*.h)
  18. make -C $(LMBENCHDIR)/src OS=linux CC="gcc -g"
  19. manifest-list: $(LMBENCHDIR)/bin/linux
  20. mkdir -p $(LMBENCHDIR)/bin/graphene
  21. cp -n $(LMBENCHDIR)/bin/linux/* $(LMBENCHDIR)/bin/graphene
  22. find $(LMBENCHDIR)/bin/linux/ -type f -executable \
  23. -not -name lmbench -not -name hello | \
  24. sed 's:linux/\(.*\):graphene/\1.manifest.template:g' | \
  25. tee manifest-list | \
  26. xargs -l ln -sf ../../../manifest.template
  27. for f in `cat manifest-list`; do f=$${f%.manifest.template}; \
  28. ln -sf $${f##*/}.manifest $$f ; done
  29. .PHONY: pack
  30. pack: $(LMBENCHDIR)/bin/linux manifest-list
  31. tar -czf .packed/lmbench.tar.gz $^
  32. else
  33. $(LMBENCHDIR)/bin/linux manifest-list: .packed/lmbench.tar.gz
  34. tar -xmozf $<
  35. mkdir -p $(LMBENCHDIR)/bin/graphene
  36. cp -n $(LMBENCHDIR)/bin/linux/* $(LMBENCHDIR)/bin/graphene
  37. for f in `cat manifest-list`; \
  38. do ln -sf ../../../manifest.template $$f ; done
  39. for f in `cat manifest-list`; do f=$${f%.manifest.template}; \
  40. ln -sf $${f##*/}.manifest $$f ; done
  41. endif
  42. config = $(shell $(LMBENCHDIR)/scripts/config)
  43. config-native: $(LMBENCHDIR)/bin/linux
  44. [ -f "$(LMBENCHDIR)/bin/linux/$(config)" ] || \
  45. (cd $(LMBENCHDIR)/scripts && env OS=linux ./config-run)
  46. test-native: config-native
  47. make -C $(LMBENCHDIR) OS=linux rerun
  48. config-graphene: config-native $(LMBENCHMANIFEST)
  49. [ -f "$(LMBENCHDIR)/bin/graphene/$(config)" ] || \
  50. sed -e "s/OS=\"linux\"/OS=\"graphene\"/g" "$(LMBENCHDIR)/bin/linux/$(config)" \
  51. > "$(LMBENCHDIR)/bin/graphene/$(config)"
  52. cp $(LMBENCHDIR)/bin/graphene/hello /tmp
  53. test-graphene: config-graphene
  54. make -C $(LMBENCHDIR) OS=graphene rerun
  55. clean:
  56. rm -rf $(LMBENCHMANFIEST) manifest-list
  57. make -C $(LMBENCHDIR) clean