Makefile 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. FILES= \
  2. test-hello \
  3. test-stackprotector-all \
  4. test-stackprotector \
  5. test-volatile-register-var \
  6. test-fortify-source \
  7. test-bionic \
  8. test-libelf \
  9. test-glibc \
  10. test-dwarf \
  11. test-libelf-mmap \
  12. test-libelf-getphdrnum \
  13. test-libunwind \
  14. test-libaudit \
  15. test-libslang \
  16. test-gtk2 \
  17. test-gtk2-infobar \
  18. test-libperl \
  19. test-libpython \
  20. test-libpython-version \
  21. test-libbfd \
  22. test-on-exit \
  23. test-backtrace \
  24. test-libnuma
  25. CC := $(CC) -MD
  26. all: $(FILES)
  27. BUILD = $(CC) -o $(OUTPUT)$@ $@.c
  28. ###############################
  29. test-hello:
  30. $(BUILD)
  31. test-stackprotector-all:
  32. $(BUILD) -Werror -fstack-protector-all
  33. test-stackprotector:
  34. $(BUILD) -Werror -fstack-protector
  35. test-volatile-register-var:
  36. $(BUILD) -Werror -Wvolatile-register-var
  37. test-fortify-source:
  38. $(BUILD) -O2 -Werror -D_FORTIFY_SOURCE=2
  39. test-bionic:
  40. $(BUILD)
  41. test-libelf:
  42. $(BUILD) -lelf
  43. test-glibc:
  44. $(BUILD)
  45. test-dwarf:
  46. $(BUILD) -ldw
  47. test-libelf-mmap:
  48. $(BUILD) -lelf
  49. test-libelf-getphdrnum:
  50. $(BUILD) -lelf
  51. test-libnuma:
  52. $(BUILD) -lnuma
  53. test-libunwind:
  54. $(BUILD) -lunwind -lunwind-x86_64 -lelf
  55. test-libaudit:
  56. $(BUILD) -laudit
  57. test-libslang:
  58. $(BUILD) -I/usr/include/slang -lslang
  59. test-gtk2:
  60. $(BUILD) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
  61. test-gtk2-infobar:
  62. $(BUILD) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
  63. grep-libs = $(filter -l%,$(1))
  64. strip-libs = $(filter-out -l%,$(1))
  65. PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
  66. PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
  67. PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
  68. PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
  69. FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
  70. test-libperl:
  71. $(BUILD) $(FLAGS_PERL_EMBED)
  72. override PYTHON := python
  73. override PYTHON_CONFIG := python-config
  74. escape-for-shell-sq = $(subst ','\'',$(1))
  75. shell-sq = '$(escape-for-shell-sq)'
  76. PYTHON_CONFIG_SQ = $(call shell-sq,$(PYTHON_CONFIG))
  77. PYTHON_EMBED_LDOPTS = $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
  78. PYTHON_EMBED_LDFLAGS = $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
  79. PYTHON_EMBED_LIBADD = $(call grep-libs,$(PYTHON_EMBED_LDOPTS))
  80. PYTHON_EMBED_CCOPTS = $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
  81. FLAGS_PYTHON_EMBED = $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
  82. test-libpython:
  83. $(BUILD) $(FLAGS_PYTHON_EMBED)
  84. test-libpython-version:
  85. $(BUILD) $(FLAGS_PYTHON_EMBED)
  86. test-libbfd:
  87. $(BUILD) -DPACKAGE='perf' -DPACKAGE=perf -lbfd -ldl
  88. test-on-exit:
  89. $(BUILD)
  90. test-backtrace:
  91. $(BUILD)
  92. -include *.d */*.d
  93. ###############################
  94. clean:
  95. rm -f $(FILES) *.d