Makefile 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. FILES= \
  2. test-all.bin \
  3. test-backtrace.bin \
  4. test-bionic.bin \
  5. test-dwarf.bin \
  6. test-fortify-source.bin \
  7. test-sync-compare-and-swap.bin \
  8. test-glibc.bin \
  9. test-gtk2.bin \
  10. test-gtk2-infobar.bin \
  11. test-hello.bin \
  12. test-libaudit.bin \
  13. test-libbfd.bin \
  14. test-liberty.bin \
  15. test-liberty-z.bin \
  16. test-cplus-demangle.bin \
  17. test-libelf.bin \
  18. test-libelf-getphdrnum.bin \
  19. test-libelf-mmap.bin \
  20. test-libnuma.bin \
  21. test-libperl.bin \
  22. test-libpython.bin \
  23. test-libpython-version.bin \
  24. test-libslang.bin \
  25. test-libunwind.bin \
  26. test-libunwind-debug-frame.bin \
  27. test-stackprotector-all.bin \
  28. test-timerfd.bin \
  29. test-libdw-dwarf-unwind.bin
  30. CC := $(CROSS_COMPILE)gcc -MD
  31. PKG_CONFIG := $(CROSS_COMPILE)pkg-config
  32. all: $(FILES)
  33. BUILD = $(CC) $(CFLAGS) -o $(OUTPUT)$@ $(patsubst %.bin,%.c,$@) $(LDFLAGS)
  34. ###############################
  35. test-all.bin:
  36. $(BUILD) -Werror -fstack-protector-all -O2 -Werror -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lelf -laudit -I/usr/include/slang -lslang $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl
  37. test-hello.bin:
  38. $(BUILD)
  39. test-stackprotector-all.bin:
  40. $(BUILD) -Werror -fstack-protector-all
  41. test-fortify-source.bin:
  42. $(BUILD) -O2 -Werror -D_FORTIFY_SOURCE=2
  43. test-bionic.bin:
  44. $(BUILD)
  45. test-libelf.bin:
  46. $(BUILD) -lelf
  47. test-glibc.bin:
  48. $(BUILD)
  49. test-dwarf.bin:
  50. $(BUILD) -ldw
  51. test-libelf-mmap.bin:
  52. $(BUILD) -lelf
  53. test-libelf-getphdrnum.bin:
  54. $(BUILD) -lelf
  55. test-libnuma.bin:
  56. $(BUILD) -lnuma
  57. test-libunwind.bin:
  58. $(BUILD) -lelf
  59. test-libunwind-debug-frame.bin:
  60. $(BUILD) -lelf
  61. test-libaudit.bin:
  62. $(BUILD) -laudit
  63. test-libslang.bin:
  64. $(BUILD) -I/usr/include/slang -lslang
  65. test-gtk2.bin:
  66. $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
  67. test-gtk2-infobar.bin:
  68. $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
  69. grep-libs = $(filter -l%,$(1))
  70. strip-libs = $(filter-out -l%,$(1))
  71. PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
  72. PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
  73. PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
  74. PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
  75. FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
  76. test-libperl.bin:
  77. $(BUILD) $(FLAGS_PERL_EMBED)
  78. test-libpython.bin:
  79. $(BUILD)
  80. test-libpython-version.bin:
  81. $(BUILD)
  82. test-libbfd.bin:
  83. $(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl
  84. test-liberty.bin:
  85. $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty
  86. test-liberty-z.bin:
  87. $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty -lz
  88. test-cplus-demangle.bin:
  89. $(BUILD) -liberty
  90. test-backtrace.bin:
  91. $(BUILD)
  92. test-timerfd.bin:
  93. $(BUILD)
  94. test-libdw-dwarf-unwind.bin:
  95. $(BUILD)
  96. test-sync-compare-and-swap.bin:
  97. $(BUILD) -Werror
  98. -include *.d
  99. ###############################
  100. clean:
  101. rm -f $(FILES) *.d