Makefile.am 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. # Googletest magic. Gumbo relies on Googletest for its unittests, and
  2. # Googletest (by design) does not provide a "make install" option. Instead,
  3. # we'll assume you copy (or symlink) the Googletest distribution into a 'gtest'
  4. # directory inside the main library directory, and then provide rules to build
  5. # it automatically. This approach (and these rules) are copied from the
  6. # protobuf distribution.
  7. ACLOCAL_AMFLAGS = -I m4
  8. if !HAVE_SHARED_LIBGTEST
  9. # Build gtest before we build protobuf tests.  We don't add gtest to SUBDIRS
  10. # because then "make check" would also build and run all of gtest's own tests,
  11. # which takes a lot of time and is generally not useful to us.  Also, we don't
  12. # want "make install" to recurse into gtest since we don't want to overwrite
  13. # the installed version of gtest if there is one.
  14. check-local: gtest/lib/libgtest.la gtest/lib/libgtest_main.la
  15. gtest/lib/libgtest.la gtest/lib/libgtest_main.la: gtest/Makefile
  16. @echo "Making lib/libgtest.a lib/libgtest_main.a in gtest"
  17. @cd gtest && $(MAKE) $(AM_MAKEFLAGS) lib/libgtest.la lib/libgtest_main.la
  18. gtest/Makefile: gtest/configure
  19. @cd gtest && ./configure
  20. # We would like to clean gtest when "make clean" is invoked.  But we have to
  21. # be careful because clean-local is also invoked during "make distclean", but
  22. # "make distclean" already recurses into gtest because it's listed among the
  23. # DIST_SUBDIRS.  distclean will delete gtest/Makefile, so if we then try to
  24. # cd to the directory again and "make clean" it will fail.  So, check that the
  25. # Makefile exists before recursing.
  26. clean-local:
  27. @if test -e gtest/Makefile; then \
  28. echo "Making clean in gtest"; \
  29. cd gtest && $(MAKE) $(AM_MAKEFLAGS) clean; \
  30. fi
  31. endif !HAVE_SHARED_LIBGTEST
  32. gentags: src/tag.in
  33. @python gentags.py $<
  34. @gperf -LANSI-C --ignore-case -m200 $< |python genperf.py >src/tag_gperf.h
  35. lib_LTLIBRARIES = libgumbo.la
  36. libgumbo_la_CFLAGS = -Wall
  37. libgumbo_la_LDFLAGS = -version-info 1:0:0 -no-undefined
  38. libgumbo_la_SOURCES = \
  39. src/attribute.c \
  40. src/attribute.h \
  41. src/char_ref.c \
  42. src/char_ref.h \
  43. src/error.c \
  44. src/error.h \
  45. src/insertion_mode.h \
  46. src/parser.c \
  47. src/parser.h \
  48. src/string_buffer.c \
  49. src/string_buffer.h \
  50. src/string_piece.c \
  51. src/string_piece.h \
  52. src/tag.c \
  53. src/tag_enum.h \
  54. src/tag_gperf.h \
  55. src/tag_strings.h \
  56. src/tag_sizes.h \
  57. src/token_type.h \
  58. src/tokenizer.c \
  59. src/tokenizer.h \
  60. src/tokenizer_states.h \
  61. src/utf8.c \
  62. src/utf8.h \
  63. src/util.c \
  64. src/util.h \
  65. src/vector.c \
  66. src/vector.h
  67. include_HEADERS = src/gumbo.h src/tag_enum.h
  68. pkgconfigdir = $(libdir)/pkgconfig
  69. pkgconfig_DATA = gumbo.pc
  70. check_PROGRAMS = gumbo_test
  71. TESTS = gumbo_test
  72. gumbo_test_CPPFLAGS = \
  73. -I"$(srcdir)/." \
  74. -I"$(srcdir)/src" \
  75. -I"$(srcdir)/gtest/include"
  76. gumbo_test_SOURCES = \
  77. tests/attribute.cc \
  78. tests/char_ref.cc \
  79. tests/parser.cc \
  80. tests/string_buffer.cc \
  81. tests/string_piece.cc \
  82. tests/tokenizer.cc \
  83. tests/test_utils.cc \
  84. tests/utf8.cc \
  85. tests/vector.cc
  86. gumbo_test_DEPENDENCIES = libgumbo.la
  87. gumbo_test_LDADD = libgumbo.la
  88. if HAVE_SHARED_LIBGTEST
  89. # FIXME(bnoordhuis) Should be configurable by the user.
  90. gumbo_test_LDADD += -lgtest -lgtest_main
  91. else
  92. gumbo_test_DEPENDENCIES += check-local
  93. gumbo_test_LDADD += gtest/lib/libgtest.la gtest/lib/libgtest_main.la
  94. endif
  95. noinst_PROGRAMS = clean_text find_links get_title positions_of_class benchmark serialize prettyprint
  96. LDADD = libgumbo.la
  97. AM_CPPFLAGS = -I"$(srcdir)/src"
  98. clean_text_SOURCES = examples/clean_text.cc
  99. find_links_SOURCES = examples/find_links.cc
  100. get_title_SOURCES = examples/get_title.c
  101. positions_of_class_SOURCES = examples/positions_of_class.cc
  102. benchmark_SOURCES = benchmarks/benchmark.cc
  103. serialize_SOURCES = examples/serialize.cc
  104. prettyprint_SOURCES = examples/prettyprint.cc