Makefile 2.4 KB

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