|
| 1 | +ACLOCAL_AMFLAGS = -I m4 |
| 2 | + |
| 3 | +AM_CFLAGS = -std=gnu99 -Wall -Werror -D_POSIX_C_SOURCE=200809L \ |
| 4 | + -D_BSD_SOURCE -D_DEFAULT_SOURCE |
| 5 | + |
| 6 | +AM_CPPFLAGS = -I$(srcdir)/include -I$(srcdir)/common \ |
| 7 | + -DSYSCONFDIR='"$(sysconfdir)"' |
| 8 | + |
| 9 | +lib_LTLIBRARIES = libxcm.la |
| 10 | +if CTL |
| 11 | +lib_LTLIBRARIES += libxcmctl.la |
| 12 | +endif |
| 13 | + |
| 14 | +include_HEADERS = include/xcm.h include/xcm_addr.h include/xcm_addr_compat.h \ |
| 15 | + include/xcm_attr.h include/xcm_attr_types.h |
| 16 | + |
| 17 | +noinst_PROGRAMS = server client |
| 18 | + |
| 19 | +bin_PROGRAMS = xcmpong |
| 20 | +if XCM_TOOL |
| 21 | +bin_PROGRAMS += xcm |
| 22 | +endif |
| 23 | +if CTL |
| 24 | +bin_PROGRAMS += xcmctl |
| 25 | +endif |
| 26 | + |
| 27 | +check_PROGRAMS = xcmtest |
| 28 | + |
| 29 | +# For information on how to update these numbers, see: |
| 30 | +# https://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.html#Libtool-versioning |
| 31 | +XCM_VERSION_CURRENT=11 |
| 32 | +XCM_VERSION_REVISION=0 |
| 33 | +XCM_VERSION_AGE=$(XCM_VERSION_CURRENT) |
| 34 | + |
| 35 | +XCMCTL_VERSION_CURRENT=1 |
| 36 | +XCMCTL_VERSION_REVISION=0 |
| 37 | +XCMCTL_VERSION_AGE=$(XCMCTL_VERSION_CURRENT) |
| 38 | + |
| 39 | +LIBXCM_SOURCES = libxcm/xcm.c libxcm/xcm_addr.c libxcm/xcm_addr_compat.c \ |
| 40 | + libxcm/xcm_tp_tcp.c libxcm/xcm_tp_ux.c libxcm/xcm_tp.c \ |
| 41 | + libxcm/common_tp.c libxcm/tcp_attr.c libxcm/log.c common/util.c \ |
| 42 | + libxcm/xcm_dns_glibc.c |
| 43 | + |
| 44 | +if TLS |
| 45 | +LIBXCM_SOURCES += libxcm/xcm_tp_tls.c libxcm/xcm_tp_utls.c libxcm/log_tls.c |
| 46 | +endif |
| 47 | + |
| 48 | +if SCTP |
| 49 | +LIBXCM_SOURCES += libxcm/xcm_tp_sctp.c |
| 50 | +endif |
| 51 | + |
| 52 | +if CTL |
| 53 | +LIBXCM_SOURCES += libxcm/ctl.c common/common_ctl.c |
| 54 | +endif |
| 55 | + |
| 56 | +libxcm_la_SOURCES = $(LIBXCM_SOURCES) |
| 57 | +libxcm_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libxcm/libxcm.vs \ |
| 58 | + -version-info $(XCM_VERSION_CURRENT):$(XCM_VERSION_REVISION):$(XCM_VERSION_AGE) |
| 59 | +libxcm_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/libxcm |
| 60 | + |
| 61 | +if LTTNG |
| 62 | +libxcm_la_SOURCES += lttng/xcm_lttng.c |
| 63 | +libxcm_la_CPPFLAGS += -DXCM_LTTNG -I$(srcdir)/lttng |
| 64 | +endif |
| 65 | + |
| 66 | +if CTL |
| 67 | +libxcmctl_la_SOURCES = libxcmctl/xcmc.c common/common_ctl.c common/util.c |
| 68 | +libxcmctl_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libxcmctl/libxcmctl.vs \ |
| 69 | + -version-info $(XCMCTL_VERSION_CURRENT):$(XCMCTL_VERSION_REVISION):$(XCMCTL_VERSION_AGE) |
| 70 | +libxcmctl_la_CPPFLAGS = $(AM_CPPFLAGS) -DUT_STD_ASSERT -I$(srcdir)/libxcmctl |
| 71 | +endif |
| 72 | + |
| 73 | +xcmpong_SOURCES = tools/xcmpong.c tools/epoll_set.c common/util.c |
| 74 | +# You might think of _CFLAGS setting as a no-op, but in fact this |
| 75 | +# makes 'xcmmon/util.c' to be built in a separate version for |
| 76 | +# 'umpong', which is needed since the other version is built by |
| 77 | +# libtool. |
| 78 | +xcmpong_CFLAGS = $(AM_CFLAGS) |
| 79 | +xcmpong_CPPFLAGS = $(AM_CPPFLAGS) -DUT_STD_ASSERT |
| 80 | +xcmpong_LDADD = libxcm.la |
| 81 | +xcmpong_LDFLAGS = -lrt |
| 82 | + |
| 83 | +if XCM_TOOL |
| 84 | +xcm_SOURCES = tools/xcm.c tools/fdfwd.c tools/evutil.c common/util.c |
| 85 | +# You might think of _CFLAGS setting as a no-op, but in fact this |
| 86 | +# makes 'xcmmon/util.c' to be built in a separate version for |
| 87 | +# 'umpong', which is needed since the other version is built by |
| 88 | +# libtool. |
| 89 | +xcm_CFLAGS = $(AM_CFLAGS) |
| 90 | +xcm_CPPFLAGS = $(AM_CPPFLAGS) -DUT_STD_ASSERT |
| 91 | +xcm_LDADD = libxcm.la |
| 92 | +xcm_LDFLAGS = -levent |
| 93 | +endif |
| 94 | + |
| 95 | +if CTL |
| 96 | +xcmctl_SOURCES = tools/xcmctl.c common/util.c |
| 97 | +xcmctl_CFLAGS = $(AM_CFLAGS) |
| 98 | +xcmctl_CPPFLAGS = $(AM_CPPFLAGS) -DUT_STD_ASSERT |
| 99 | +xcmctl_LDADD = libxcmctl.la |
| 100 | +endif |
| 101 | + |
| 102 | +server_SOURCES = example/server.c |
| 103 | +server_CFLAGS = $(AM_CFLAGS) |
| 104 | +server_LDADD = libxcm.la |
| 105 | + |
| 106 | +client_SOURCES = example/client.c |
| 107 | +client_CFLAGS = $(AM_CFLAGS) |
| 108 | +client_LDADD = libxcm.la |
| 109 | + |
| 110 | +UTEST_SOURCES = test/utest/utest.c test/utest/utestreport.c \ |
| 111 | + test/utest/utesthumanreport.c |
| 112 | +TEST_CPPFLAGS=-I$(srcdir)/test -I$(srcdir)/test/utest |
| 113 | + |
| 114 | +XCMTEST_TESTCASE_SOURCES = test/xcm_testcases.c test/addr_testcases.c |
| 115 | + |
| 116 | +xcmtest_SOURCES = $(XCMTEST_TESTCASE_SOURCES) $(UTEST_SOURCES) \ |
| 117 | + common/util.c test/testutil.c test/pingpong.c |
| 118 | +xcmtest_CPPFLAGS=$(AM_CPPFLAGS) $(TEST_CPPFLAGS) -DUT_STD_ASSERT |
| 119 | +xcmtest_LDADD = libxcm.la |
| 120 | +if CTL |
| 121 | +xcmtest_LDADD += libxcmctl.la |
| 122 | +endif |
| 123 | +xcmtest_LDFLAGS = -no-install |
| 124 | + |
| 125 | +doxygen: .doxygenerated |
| 126 | + |
| 127 | +.doxygenerated: doc/doxygen.conf include/xcm.h include/xcm_addr.h \ |
| 128 | + include/xcm_attr.h include/xcm_attr_types.h |
| 129 | + doxygen doc/doxygen.conf && touch .doxygenerated |
| 130 | + if [ -n "`command -v pdflatex`" ]; then \ |
| 131 | + make -C doc/latex; \ |
| 132 | + fi |
| 133 | + |
| 134 | +clean-local: |
| 135 | + rm -rf doc/html |
| 136 | + rm -rf doc/latex |
| 137 | + rm -f common/*.d libxcm/*.d libxcmc/*.d example/*.d tools/*.d |
| 138 | + rm -f .doxygenerated |
| 139 | + |
| 140 | +distclean-local: |
| 141 | + rm -rf autom4te.cache m4 |
| 142 | + rm -f Makefile.in aclocal.m4 compile config.guess include/stamp-h1 \ |
| 143 | + config.sub configure depcomp install-sh ltmain.sh missing \ |
| 144 | + common/config.h.in |
| 145 | + find . -name \*~ -print0 | xargs -0 rm -f |
| 146 | + |
| 147 | +xcmtest-run: xcmtest |
| 148 | + if [ "`id -u`" = 0 ]; then \ |
| 149 | + ./xcmtest -c -v -p 8 $(TESTS); \ |
| 150 | + else \ |
| 151 | + ./xcmtest -c -v $(TESTS); \ |
| 152 | + fi |
| 153 | + |
| 154 | +if LTTNG |
| 155 | +LTTNGWRAP=./test/with_lttng.sh |
| 156 | +endif |
| 157 | + |
| 158 | +if VALGRIND |
| 159 | +xcmtest-run-valgrind: xcmtest |
| 160 | + cmd="$(LTTNGWRAP) valgrind --tool=memcheck --leak-check=full -q --suppressions=./test/lttng.supp --suppressions=./test/glibc.supp --num-callers=20 ./xcmtest -v -c"; \ |
| 161 | + if [ "`id -u`" = 0 ]; then \ |
| 162 | + IN_VALGRIND=1 $$cmd -p 8 $(TESTS); \ |
| 163 | + else \ |
| 164 | + IN_VALGRIND=1 $$cmd $(TESTS); \ |
| 165 | + fi |
| 166 | +endif |
| 167 | + |
| 168 | +if PYTHON |
| 169 | +xcm_PYTHON=python/xcm.py |
| 170 | +xcmdir = $(pythondir) |
| 171 | +python-test: libxcm.la |
| 172 | + LD_LIBRARY_PATH=$(builddir)/.libs ./python/xcmtest.py |
| 173 | +endif |
| 174 | + |
| 175 | +verify-versioning: |
| 176 | + ./test/verify_versioning.py $(srcdir)/include/xcm.h \ |
| 177 | + $(builddir) 0 $(XCM_VERSION_CURRENT) $(XCM_VERSION_REVISION) |
| 178 | + |
| 179 | +BASIC_TEST_TARGETS=xcmtest-run verify-versioning |
| 180 | + |
| 181 | +if VALGRIND |
| 182 | +TEST_TARGETS=xcmtest-run-valgrind $(BASIC_TEST_TARGETS) |
| 183 | +else |
| 184 | +TEST_TARGETS=$(BASIC_TEST_TARGETS) |
| 185 | +endif |
| 186 | + |
| 187 | +if PYTHON |
| 188 | +TEST_TARGETS += python-test |
| 189 | +endif |
| 190 | + |
| 191 | +check-local: $(TEST_TARGETS) |
| 192 | + |
| 193 | +count: clean |
| 194 | + wc -l `git ls-files | grep -E '\.[ch]{1}$$' | grep -v test/utest | grep -v example` |
0 commit comments