Makefile 2.7 KB

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