Makefile 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. SIM_ROOT ?= $(shell readlink -f "$(CURDIR)")
  2. CLEAN=$(findstring clean,$(MAKECMDGOALS))
  3. STANDALONE=$(SIM_ROOT)/lib/sniper
  4. LIB_CARBON=$(SIM_ROOT)/lib/libcarbon_sim.a
  5. LIB_PIN_SIM=$(SIM_ROOT)/pin/../lib/pin_sim.so
  6. LIB_FOLLOW=$(SIM_ROOT)/pin/../lib/follow_execv.so
  7. LIB_SIFT=$(SIM_ROOT)/sift/libsift.a
  8. SIM_TARGETS=$(LIB_CARBON) $(LIB_SIFT) $(LIB_PIN_SIM) $(LIB_FOLLOW) $(STANDALONE)
  9. .PHONY: dependencies compile_simulator configscripts package_deps pin python linux builddir showdebugstatus distclean
  10. # Remake LIB_CARBON on each make invocation, as only its Makefile knows if it needs to be rebuilt
  11. .PHONY: $(LIB_CARBON)
  12. all: dependencies $(SIM_TARGETS) configscripts
  13. dependencies: package_deps pin python mcpat linux builddir showdebugstatus
  14. $(SIM_TARGETS): dependencies
  15. include common/Makefile.common
  16. $(STANDALONE): $(LIB_CARBON) $(LIB_SIFT)
  17. @$(MAKE) $(MAKE_QUIET) -C $(SIM_ROOT)/standalone
  18. $(LIB_PIN_SIM): $(LIB_CARBON) $(LIB_SIFT)
  19. @$(MAKE) $(MAKE_QUIET) -C $(SIM_ROOT)/pin $@
  20. $(LIB_FOLLOW):
  21. @$(MAKE) $(MAKE_QUIET) -C $(SIM_ROOT)/pin $@
  22. $(LIB_CARBON):
  23. @$(MAKE) $(MAKE_QUIET) -C $(SIM_ROOT)/common
  24. $(LIB_SIFT): $(LIB_CARBON)
  25. @$(MAKE) $(MAKE_QUIET) -C $(SIM_ROOT)/sift
  26. ifneq ($(NO_PIN_CHECK),1)
  27. PIN_REV_MINIMUM=61206
  28. pin: $(PIN_HOME)/intel64/bin/pinbin $(PIN_HOME)/source/tools/Config/makefile.config package_deps
  29. @if [ "$$(tools/pinversion.py $(PIN_HOME) | cut -d. -f3)" -lt "$(PIN_REV_MINIMUM)" ]; then echo; echo "Found Pin version $$(tools/pinversion.py $(PIN_HOME)) in $(PIN_HOME)"; echo "but at least revision $(PIN_REV_MINIMUM) is required."; echo; false; fi
  30. $(PIN_HOME)/source/tools/Config/makefile.config:
  31. @echo
  32. @echo "Old Pin version found in $(PIN_HOME), Sniper requires Pin version $(PIN_REV_MINIMUM) or newer."
  33. @echo
  34. @false
  35. $(PIN_HOME)/intel64/bin/pinbin:
  36. @echo
  37. @echo "Cannot find Pin in $(PIN_HOME). Please download and extract Pin version $(PIN_REV_MINIMUM)"
  38. @echo "from http://www.pintool.org/downloads.html into $(PIN_HOME), or set the PIN_HOME environment variable."
  39. @echo
  40. @false
  41. endif
  42. ifneq ($(NO_PYTHON_DOWNLOAD),1)
  43. PYTHON_DEP=python_kit/$(SNIPER_TARGET_ARCH)/lib/python2.7/lib-dynload/_sqlite3.so
  44. python: $(PYTHON_DEP)
  45. $(PYTHON_DEP):
  46. $(_MSG) '[DOWNLO] Python $(SNIPER_TARGET_ARCH)'
  47. $(_CMD) mkdir -p python_kit/$(SNIPER_TARGET_ARCH)
  48. $(_CMD) wget -O - --no-verbose --quiet "http://snipersim.org/packages/sniper-python27-$(SNIPER_TARGET_ARCH).tgz" | tar xz --strip-components 1 -C python_kit/$(SNIPER_TARGET_ARCH)
  49. endif
  50. ifneq ($(NO_MCPAT_DOWNLOAD),1)
  51. mcpat: mcpat/mcpat-1.0
  52. mcpat/mcpat-1.0:
  53. $(_MSG) '[DOWNLO] McPAT'
  54. $(_CMD) mkdir -p mcpat
  55. $(_CMD) wget -O - --no-verbose --quiet "http://snipersim.org/packages/mcpat-1.0.tgz" | tar xz -C mcpat
  56. endif
  57. linux: include/linux/perf_event.h
  58. include/linux/perf_event.h:
  59. $(_MSG) '[INSTAL] perf_event.h'
  60. $(_CMD) if [ -e /usr/include/linux/perf_event.h ]; then cp /usr/include/linux/perf_event.h include/linux/perf_event.h; else cp include/linux/perf_event_2.6.32.h include/linux/perf_event.h; fi
  61. builddir: lib
  62. lib:
  63. @mkdir -p $(SIM_ROOT)/lib
  64. showdebugstatus:
  65. ifneq ($(DEBUG),)
  66. @echo Using flags: $(OPT_CFLAGS)
  67. endif
  68. configscripts: dependencies
  69. @mkdir -p config
  70. @> config/sniper.py
  71. @echo '# This file is auto-generated, changes made to it will be lost. Please edit Makefile instead.' >> config/sniper.py
  72. @echo "target=\"$(SNIPER_TARGET_ARCH)\"" >> config/sniper.py
  73. @./tools/makerelativepath.py pin_home "$(SIM_ROOT)" "$(PIN_HOME)" >> config/sniper.py
  74. @if [ $$(which git) ]; then if [ -e "$(SIM_ROOT)/.git" ]; then echo "git_revision=\"$$(git --git-dir='$(SIM_ROOT)/.git' rev-parse HEAD)\"" >> config/sniper.py; fi ; fi
  75. @./tools/makebuildscripts.py "$(SIM_ROOT)" "$(PIN_HOME)" "$(CC)" "$(CXX)" "$(SNIPER_TARGET_ARCH)"
  76. empty_config:
  77. $(_MSG) '[CLEAN ] config'
  78. $(_CMD) rm -f config/sniper.py config/buildconf.sh config/buildconf.makefile
  79. clean: empty_config empty_deps
  80. $(_MSG) '[CLEAN ] standalone'
  81. $(_CMD) $(MAKE) $(MAKE_QUIET) -C standalone clean
  82. $(_MSG) '[CLEAN ] pin'
  83. $(_CMD) $(MAKE) $(MAKE_QUIET) -C pin clean
  84. $(_MSG) '[CLEAN ] common'
  85. $(_CMD) $(MAKE) $(MAKE_QUIET) -C common clean
  86. $(_MSG) '[CLEAN ] sift'
  87. $(_CMD) $(MAKE) $(MAKE_QUIET) -C sift clean
  88. $(_MSG) '[CLEAN ] tools'
  89. $(_CMD) $(MAKE) $(MAKE_QUIET) -C tools clean
  90. $(_CMD) rm -f .build_os
  91. distclean: clean
  92. $(_MSG) '[DISTCL] python_kit'
  93. $(_CMD) rm -rf python_kit
  94. $(_MSG) '[DISTCL] McPAT'
  95. $(_CMD) rm -rf mcpat
  96. $(_MSG) '[DISTCL] perf_event.h'
  97. $(_CMD) rm -f include/linux/perf_event.h
  98. regress_quick: regress_unit regress_apps
  99. empty_deps:
  100. $(_MSG) '[CLEAN ] deps'
  101. $(_CMD) find . -name \*.d -exec rm {} \;
  102. package_deps:
  103. @BOOST_INCLUDE=$(BOOST_INCLUDE) ./tools/checkdependencies.py