Makefile.am 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. ## Process this file with automake to create Makefile.in.
  2. AUTOMAKE_OPTIONS = 1.12
  3. SUBDIRS = po lib src doc contrib misc
  4. if HAVE_TESTS
  5. SUBDIRS += tests
  6. endif
  7. EXTRA_DIST =
  8. dist_noinst_SCRIPTS = \
  9. build-glib2.sh \
  10. version.sh
  11. dist_noinst_HEADERS = $(top_srcdir)/mc-version.h
  12. ACLOCAL_AMFLAGS = -I m4
  13. CONFIG_STATUS_DEPENDENCIES = $(top_srcdir)/mc-version.h
  14. .PHONY: update-version \
  15. cppcheck \
  16. cppcheck-error \
  17. cppcheck-information \
  18. cppcheck-performance \
  19. cppcheck-portability \
  20. cppcheck-style \
  21. cppcheck-warning \
  22. cppcheck-all
  23. update-version:
  24. @if test -x $(top_srcdir)/version.sh; then \
  25. $(top_srcdir)/version.sh "$(top_srcdir)" 2>&1 >/dev/null; \
  26. else \
  27. if test ! -e $(top_srcdir)/mc-version.h; then \
  28. echo "File not found: $(top_srcdir)/version.sh"; \
  29. exit 1; \
  30. fi; \
  31. fi
  32. $(top_srcdir)/mc-version.h: update-version
  33. CPPCHECK_CMD = cppcheck \
  34. --inline-suppr \
  35. --error-exitcode=0 \
  36. -j 4 \
  37. --force \
  38. -I $(top_srcdir)/lib \
  39. --language=c \
  40. --std=c99
  41. CPPCHECK_DIRS = \
  42. "$(top_srcdir)/lib" \
  43. "$(top_srcdir)/src"
  44. CPPCHECK_OUT_PREFIX = $(top_builddir)/cppcheck-
  45. CPPCHECK_OUT_EXT = log.txt
  46. CPPCHECK_SED_FILTER = \
  47. -e '/is reassigned a value before the old one has been used./d' \
  48. -e '/ Unmatched suppression: /d' \
  49. -e "/Skipping configuration '.*' since the value of '.*' is unknown./d"
  50. cppcheck:
  51. $(CPPCHECK_CMD) --enable=all $(CPPCHECK_DIRS) 2>$(CPPCHECK_OUT_PREFIX)all.$(CPPCHECK_OUT_EXT).tmp;
  52. $(SED) $(CPPCHECK_SED_FILTER) $(CPPCHECK_OUT_PREFIX)all.$(CPPCHECK_OUT_EXT).tmp > $(CPPCHECK_OUT_PREFIX)all.$(CPPCHECK_OUT_EXT)
  53. rm -f $(CPPCHECK_OUT_PREFIX)all.$(CPPCHECK_OUT_EXT).tmp
  54. cppcheck-all: cppcheck
  55. cppcheck-information:
  56. $(CPPCHECK_CMD) --enable=information $(CPPCHECK_DIRS) 2>$(CPPCHECK_OUT_PREFIX)information.$(CPPCHECK_OUT_EXT).tmp;
  57. $(SED) $(CPPCHECK_SED_FILTER) $(CPPCHECK_OUT_PREFIX)information.$(CPPCHECK_OUT_EXT).tmp > $(CPPCHECK_OUT_PREFIX)information.$(CPPCHECK_OUT_EXT)
  58. rm -f $(CPPCHECK_OUT_PREFIX)all.$(CPPCHECK_OUT_EXT).tmp
  59. cppcheck-performance:
  60. $(CPPCHECK_CMD) --enable=performance $(CPPCHECK_DIRS) 2>$(CPPCHECK_OUT_PREFIX)performance.$(CPPCHECK_OUT_EXT).tmp;
  61. $(SED) $(CPPCHECK_SED_FILTER) $(CPPCHECK_OUT_PREFIX)performance.$(CPPCHECK_OUT_EXT).tmp > $(CPPCHECK_OUT_PREFIX)performance.$(CPPCHECK_OUT_EXT)
  62. rm -f $(CPPCHECK_OUT_PREFIX)performance.$(CPPCHECK_OUT_EXT).tmp
  63. cppcheck-portability:
  64. $(CPPCHECK_CMD) --enable=portability $(CPPCHECK_DIRS) 2>$(CPPCHECK_OUT_PREFIX)portability.$(CPPCHECK_OUT_EXT).tmp;
  65. $(SED) $(CPPCHECK_SED_FILTER) $(CPPCHECK_OUT_PREFIX)portability.$(CPPCHECK_OUT_EXT).tmp > $(CPPCHECK_OUT_PREFIX)portability.$(CPPCHECK_OUT_EXT)
  66. rm -f $(CPPCHECK_OUT_PREFIX)portability.$(CPPCHECK_OUT_EXT).tmp
  67. cppcheck-style:
  68. $(CPPCHECK_CMD) --enable=style $(CPPCHECK_DIRS) 2>$(CPPCHECK_OUT_PREFIX)style.$(CPPCHECK_OUT_EXT).tmp;
  69. $(SED) $(CPPCHECK_SED_FILTER) $(CPPCHECK_OUT_PREFIX)style.$(CPPCHECK_OUT_EXT).tmp > $(CPPCHECK_OUT_PREFIX)style.$(CPPCHECK_OUT_EXT)
  70. rm -f $(CPPCHECK_OUT_PREFIX)style.$(CPPCHECK_OUT_EXT).tmp
  71. cppcheck-warning:
  72. $(CPPCHECK_CMD) --enable=warning $(CPPCHECK_DIRS) 2>$(CPPCHECK_OUT_PREFIX)warning.$(CPPCHECK_OUT_EXT).tmp;
  73. $(SED) $(CPPCHECK_SED_FILTER) $(CPPCHECK_OUT_PREFIX)warning.$(CPPCHECK_OUT_EXT).tmp > $(CPPCHECK_OUT_PREFIX)warning.$(CPPCHECK_OUT_EXT)
  74. rm -f $(CPPCHECK_OUT_PREFIX)warning.$(CPPCHECK_OUT_EXT).tmp
  75. cppcheck-unusedFunction:
  76. $(CPPCHECK_CMD) --enable=unusedFunction $(CPPCHECK_DIRS) 2>$(CPPCHECK_OUT_PREFIX)unusedFunction.$(CPPCHECK_OUT_EXT).tmp;
  77. $(SED) $(CPPCHECK_SED_FILTER) $(CPPCHECK_OUT_PREFIX)unusedFunction.$(CPPCHECK_OUT_EXT).tmp > $(CPPCHECK_OUT_PREFIX)unusedFunction.$(CPPCHECK_OUT_EXT)
  78. rm -f $(CPPCHECK_OUT_PREFIX)unusedFunction.$(CPPCHECK_OUT_EXT).tmp
  79. cppcheck-missingInclude:
  80. $(CPPCHECK_CMD) --enable=missingInclude $(CPPCHECK_DIRS) 2>$(CPPCHECK_OUT_PREFIX)missingInclude.$(CPPCHECK_OUT_EXT).tmp;
  81. $(SED) $(CPPCHECK_SED_FILTER) $(CPPCHECK_OUT_PREFIX)missingInclude.$(CPPCHECK_OUT_EXT).tmp > $(CPPCHECK_OUT_PREFIX)missingInclude.$(CPPCHECK_OUT_EXT)
  82. rm -f $(CPPCHECK_OUT_PREFIX)missingInclude.$(CPPCHECK_OUT_EXT).tmp
  83. cppcheck-split-all: \
  84. cppcheck-information \
  85. cppcheck-performance \
  86. cppcheck-portability \
  87. cppcheck-style \
  88. cppcheck-warning \
  89. cppcheck-unusedFunction \
  90. cppcheck-missingInclude
  91. INDENT_CMD = $(INDENT) \
  92. --gnu-style \
  93. --format-first-column-comments \
  94. --indent-level4 \
  95. --brace-indent0 \
  96. --line-length100 \
  97. --no-tabs \
  98. --blank-lines-after-procedures
  99. INDENT_DIRS = \
  100. "$(top_srcdir)/lib" \
  101. "$(top_srcdir)/src" \
  102. "$(top_srcdir)/tests"
  103. indent:
  104. for directory in $(INDENT_DIRS); do \
  105. find "$${directory}" -name '*.[ch]' -print0 | \
  106. xargs -0 $(INDENT_CMD); \
  107. done