diff --git a/Makefile.am b/Makefile.am index 4a8f5ef..12194f4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,134 +1,134 @@ # Copyright (C) 2010 Red Hat, Inc. # # Authors: Andrew Beekhof # Steven Dake # Angus Salkeld # # This file is part of libqb. # # libqb is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 2.1 of the License, or # (at your option) any later version. # # libqb is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with libqb. If not, see . SPEC = $(PACKAGE_NAME).spec EXTRA_DIST = autogen.sh $(SPEC).in \ build-aux/git-version-gen \ build-aux/gitlog-to-changelog \ build-aux/release.mk \ .version AUTOMAKE_OPTIONS = foreign MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure depcomp \ config.guess config.sub missing install-sh \ autoheader automake autoconf libtool libtoolize \ ltmain.sh compile build-aux/test-driver ACLOCAL_AMFLAGS = -I m4 dist_doc_DATA = COPYING INSTALL README.markdown SUBDIRS = include lib docs tools tests examples doxygen: $(MAKE) -C docs doxygen dist-clean-local: - $(AM_V_GEN)rm -f autoconf automake autoheader + rm -f autoconf automake autoheader maintainer-clean-local: - $(AM_V_GEN)rm -rf m4 - $(AM_V_GEN)rm -f .version .tarball-version + rm -rf m4 + rm -f .version .tarball-version -clean-generic: - $(AM_V_GEN)rm -rf $(SPEC) $(DIST_ARCHIVES) +clean-local: + rm -rf $(SPEC) $(DIST_ARCHIVES) ## make rpm/srpm section. $(SPEC): $(SPEC).in - $(AM_V_GEN)rm -f $@-t $@ - date="$(shell LC_ALL=C date "+%a %b %d %Y")" && \ + @rm -f $@-t $@ + @date="$(shell LC_ALL=C date "+%a %b %d %Y")" && \ if [ -f .tarball-version ]; then \ gitver="$(shell cat .tarball-version)" && \ rpmver=$$gitver && \ alphatag="" && \ dirty="" && \ numcomm="0"; \ else \ gitver="$(shell git describe --abbrev=4 --match='v*' --tags HEAD 2>/dev/null)" && \ rpmver=`echo $$gitver | sed -e "s/^v//" -e "s/-.*//g"` && \ alphatag=`echo $$gitver | sed -e "s/.*-//" -e "s/^g//"` && \ vtag=`echo $$gitver | sed -e "s/-.*//g"` && \ numcomm=`git rev-list $$vtag..HEAD | wc -l` && \ git update-index --refresh > /dev/null 2>&1 || true && \ dirty=`git diff-index --name-only HEAD 2>/dev/null`; \ fi && \ if [ -n "$$dirty" ]; then dirty="dirty"; else dirty=""; fi && \ if [ "$$numcomm" = "0" ]; then \ sed \ -e "s#@version@#$$rpmver#g" \ -e "s#%glo.*alpha.*##g" \ -e "s#%glo.*numcomm.*##g" \ -e "s#@dirty@#$$dirty#g" \ -e "s#@date@#$$date#g" \ $< > $@-t; \ else \ sed \ -e "s#@version@#$$rpmver#g" \ -e "s#@alphatag@#$$alphatag#g" \ -e "s#@numcomm@#$$numcomm#g" \ -e "s#@dirty@#$$dirty#g" \ -e "s#@date@#$$date#g" \ $< > $@-t; \ fi; \ if [ -z "$$dirty" ]; then sed -i -e "s#%glo.*dirty.*##g" $@-t; fi - $(AM_V_GEN)chmod a-w $@-t + @chmod a-w $@-t $(AM_V_GEN)mv $@-t $@ RPMBUILDOPTS = --define "_sourcedir $(abs_builddir)" \ --define "_specdir $(abs_builddir)" \ --define "_builddir $(abs_builddir)" \ --define "_srcrpmdir $(abs_builddir)" \ --define "_rpmdir $(abs_builddir)" # generates both .tar.[gx]z (backward compatibility) tarball: dist srpm: clean autoreconf -if $(MAKE) $(SPEC) dist-xz rpmbuild $(RPMBUILDOPTS) --nodeps -bs $(SPEC) rpm: clean autoreconf -if $(MAKE) $(SPEC) dist-xz rpmbuild $(RPMBUILDOPTS) -ba $(SPEC) # release/versioning BUILT_SOURCES = .version .version: echo $(VERSION) > $@-t && mv $@-t $@ dist-hook: gen-ChangeLog echo $(VERSION) > $(distdir)/.tarball-version gen_start_date = 2000-01-01 .PHONY: gen-ChangeLog gen-ChangeLog: if test -d .git; then \ $(top_srcdir)/build-aux/gitlog-to-changelog \ --since=$(gen_start_date) > $(distdir)/cl-t; \ rm -f $(distdir)/ChangeLog; \ mv $(distdir)/cl-t $(distdir)/ChangeLog; \ fi diff --git a/docs/Makefile.am b/docs/Makefile.am index 3c46ced..633f4e9 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -1,52 +1,50 @@ # Copyright (C) 2010 Red Hat, Inc. # # Authors: Angus Salkeld # # This file is part of libqb. # # libqb is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 2.1 of the License, or # (at your option) any later version. # # libqb is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with libqb. If not, see . MAINTAINERCLEANFILES = Makefile.in EXTRA_DIST = man.dox html.dox noinst_HEADERS = mainpage.h dist_man_MANS = man8/qb-blackbox.8 if HAVE_DOXYGEN inc_dir = $(top_srcdir)/include/qb - -dependent_headers = $(subst $(inc_dir),,$(shell \ +public_headers = $(sort $(patsubst %.in,%,$(subst $(inc_dir)/,,$(shell \ printf 'include $(inc_dir)/Makefile.am\n\n%%.var:\n\t@echo $$($$*)' \ - | ${MAKE} --no-print-directory -f - inst_HEADERS.var \ - || echo $(inc_dir)/qb*.h)) -dependent_headers_omit = qbconfig.h + | ${MAKE} --no-print-directory -f- inst_HEADERS.var \ + || echo $(inc_dir)/qb*.h*)))) +public_headers_omit = qbconfig.h +public_headers_pick = $(filter-out $(public_headers_omit),$(public_headers) ) -dist_man3_MANS = $(patsubst %,man3/%.3,$(filter-out \ - $(dependent_headers_omit),$(dependent_headers) \ - )) +dist_man3_MANS = $(patsubst %,man3/%.3,$(public_headers_pick)) -$(dist_man3_MANS): man.dox $(dependent_headers:%=$(inc_dir)/%) +$(dist_man3_MANS): man.dox $(public_headers_pick:%=$(inc_dir)/%) mkdir -p man3 doxygen man.dox doxygen: html.dox mkdir -p html doxygen html.dox else doxygen: @echo WARNING: no doxygen to build man pages! endif -clean-generic: +clean-local: rm -rf html man3 diff --git a/include/Makefile.am b/include/Makefile.am index 7e5fe38..12b7c2b 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,27 +1,26 @@ # Copyright (c) 2010 Red Hat, Inc. # # Authors: Angus Salkeld # # This file is part of libqb. # # libqb is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 2.1 of the License, or # (at your option) any later version. # # libqb is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with libqb. If not, see . # MAINTAINERCLEANFILES = Makefile.in config.h.in EXTRA_DIST = $(noinst_HEADERS) noinst_HEADERS = os_base.h tlist.h SUBDIRS = qb - diff --git a/lib/Makefile.am b/lib/Makefile.am index bdd9068..371cc00 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,86 +1,86 @@ # # Copyright (C) 2010 Red Hat, Inc. # # Author: Angus Salkeld # # This file is part of libqb. # # libqb is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 2.1 of the License, or # (at your option) any later version. # # libqb is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with libqb. If not, see . MAINTAINERCLEANFILES = Makefile.in noinst_HEADERS = ipc_int.h util_int.h ringbuffer_int.h loop_int.h \ log_int.h map_int.h rpl_sem.h loop_poll_int.h \ atomic_int.h AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include lib_LTLIBRARIES = libqb.la libqb_la_LDFLAGS = -version-info 18:0:18 source_to_lint = util.c hdb.c ringbuffer.c ringbuffer_helper.c \ array.c loop.c loop_poll.c loop_job.c \ loop_timerlist.c ipcc.c ipcs.c ipc_shm.c \ ipc_setup.c ipc_socket.c \ log.c log_thread.c log_blackbox.c log_file.c \ log_syslog.c log_dcs.c log_format.c \ map.c skiplist.c hashtable.c trie.c libqb_la_SOURCES = $(source_to_lint) unix.c libqb_la_LIBADD = @LTLIBOBJS@ AM_LDFLAGS = $(LDFLAGS_COPY:-Bsymbolic-functions=) if HAVE_SEM_TIMEDWAIT else libqb_la_SOURCES+=rpl_sem.c endif if HAVE_EPOLL libqb_la_SOURCES+=loop_poll_epoll.c else if HAVE_KQUEUE libqb_la_SOURCES+=loop_poll_kqueue.c else libqb_la_SOURCES+=loop_poll_poll.c endif endif pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libqb.pc if HAVE_SPLINT check_SCRIPTS = run_splint.sh TESTS = $(check_SCRIPTS) # this is a hack because debian/ubuntu don't set the arch path # in splint. DEB_INCLUDES = -I/usr/include/x86_64-linux-gnu -I/usr/include/i386-linux-gnu ALL_LINT_FLAGS = $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(DEB_INCLUDES) \ $(libqb_la_CPPFLAGS) $(CPPFLAGS) $(AM_CPPFLAGS) \ $(LINT_FLAGS) run_splint.sh: $(top_srcdir)/configure.ac - echo "$(SPLINT) $(ALL_LINT_FLAGS) $(addprefix $(top_srcdir)/lib/, $(source_to_lint))" > $@ + @echo "$(SPLINT) $(ALL_LINT_FLAGS) $(addprefix $(top_srcdir)/lib/, $(source_to_lint))" > $@ $(AM_V_GEN)chmod +x $@ dist-clean-local: - $(AM_V_GEN)rm -f run_splint.sh + rm -f run_splint.sh -clean-generic: - $(AM_V_GEN)rm -f run_splint.sh +clean-local: + rm -f run_splint.sh endif diff --git a/tests/Makefile.am b/tests/Makefile.am index 4dbe6d8..34bfc6f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,166 +1,161 @@ # Copyright (c) 2010 Red Hat, Inc. # # Authors: Angus Salkeld # # This file is part of libqb. # # libqb is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 2.1 of the License, or # (at your option) any later version. # # libqb is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with libqb. If not, see . # MAINTAINERCLEANFILES = Makefile.in EXTRA_DIST = CLEANFILES = AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include -noinst_PROGRAMS = bmc bmcpt bms rbwriter rbreader loop bench-log \ - auto_check_header_qbarray auto_check_header_qbconfig auto_check_header_qbhdb \ - auto_check_header_qbipc_common auto_check_header_qblist auto_check_header_qbloop \ - auto_check_header_qbrb auto_check_header_qbatomic auto_check_header_qbdefs \ - auto_check_header_qbipcc auto_check_header_qbipcs auto_check_header_qblog \ - auto_check_header_qbmap auto_check_header_qbutil format_compare_speed +noinst_PROGRAMS = bmc bmcpt bms rbreader rbwriter \ + bench-log format_compare_speed loop format_compare_speed_SOURCES = format_compare_speed.c $(top_builddir)/include/qb/qbutil.h format_compare_speed_LDADD = $(top_builddir)/lib/libqb.la bmc_SOURCES = bmc.c $(top_builddir)/include/qb/qbipcc.h bmc_LDADD = $(top_builddir)/lib/libqb.la bmcpt_SOURCES = bmcpt.c $(top_builddir)/include/qb/qbipcc.h bmcpt_LDADD = $(top_builddir)/lib/libqb.la bms_SOURCES = bms.c $(top_builddir)/include/qb/qbipcs.h bms_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include $(GLIB_CFLAGS) bms_LDADD = $(top_builddir)/lib/libqb.la $(GLIB_LIBS) rbwriter_SOURCES = rbwriter.c $(top_builddir)/include/qb/qbrb.h rbwriter_LDADD = $(top_builddir)/lib/libqb.la rbreader_SOURCES = rbreader.c $(top_builddir)/include/qb/qbrb.h rbreader_LDADD = $(top_builddir)/lib/libqb.la loop_SOURCES = loop.c $(top_builddir)/include/qb/qbloop.h loop_LDADD = $(top_builddir)/lib/libqb.la -public_headers = $(wildcard $(top_srcdir)/include/qb/qb*.h) +inc_dir = $(top_srcdir)/include/qb +public_headers = $(sort $(patsubst %.in,%,$(subst $(inc_dir)/,,$(shell \ + printf 'include $(inc_dir)/Makefile.am\n\n%%.var:\n\t@echo $$($$*)' \ + | ${MAKE} --no-print-directory -f- inst_HEADERS.var \ + || echo $(inc_dir)/qb*.h*)))) auto_c_files = $(patsubst %.h,auto_check_header_%.c,$(public_headers)) CLEANFILES += $(auto_c_files) -MAINTAINERCLEANFILES += $(auto_c_files) -# -# The qbconfig.h file is generated from qbconfig.h.in into the build directory tree. -# We have to have a separate rule for generating the auto_check_header_ source here. -# -$(builddir)/auto_check_header_qbconfig.c: $(top_builddir)/include/qb/qbconfig.h +# this works for both non/generated headers thanks to VPATH being +# automatically set to $(top_srcdir)/tests and $(top_builddir) +# being resolved to ".." by automake +# ($(top_srcdir)/tests/../include/qb/%.h = $(top_srcdir)/include/qb/%.h) +auto_check_header_%.c: $(top_builddir)/include/qb/%.h @name=$$(echo "$<" | sed "s|.*qb/qb||" | sed "s|\.h||") ;\ NAME=$$(echo $$name | tr [:lower:] [:upper:]) ;\ echo "#include " > $@_ ;\ echo "#ifndef QB_$${NAME}_H_DEFINED" >> $@_ ;\ echo "#error no header protector in file qb$$name.h" >> $@_ ;\ echo "#endif" >> $@_ ;\ echo "int main(void) {return 0;}" >> $@_ $(AM_V_GEN)mv $@_ $@ -$(builddir)/auto_check_header_%.c: $(top_srcdir)/include/qb/%.h - @name=$$(echo "$<" | sed "s|.*qb/qb||" | sed "s|\.h||") ;\ - NAME=$$(echo $$name | tr [:lower:] [:upper:]) ;\ - echo "#include " > $@_ ;\ - echo "#ifndef QB_$${NAME}_H_DEFINED" >> $@_ ;\ - echo "#error no header protector in file qb$$name.h" >> $@_ ;\ - echo "#endif" >> $@_ ;\ - echo "int main(void) {return 0;}" >> $@_ - $(AM_V_GEN)mv $@_ $@ +check: check-headers + +# rely on implicit automake rule to include right (local) includes +.PHONY: check-headers +check-headers: $(auto_c_files:.c=.o) distclean-compile: rm -rf auto_*.c if HAVE_DICT_WORDS if HAVE_SLOW_TESTS EXTRA_DIST += make-log-test.sh CLEANFILES += auto_write_logs.c MAINTAINERCLEANFILES += auto_write_logs.c nodist_bench_log_SOURCES = auto_write_logs.c bench_log: auto_write_logs.c $(builddir)/auto_write_logs.c: make-log-test.sh - $(srcdir)/make-log-test.sh > $(builddir)/write_logs-tmp.c + @$(srcdir)/make-log-test.sh > $(builddir)/write_logs-tmp.c $(AM_V_GEN)mv $(builddir)/write_logs-tmp.c $(builddir)/auto_write_logs.c endif endif bench_log_SOURCES = bench-log.c $(top_builddir)/include/qb/qblog.h bench_log_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include bench_log_LDADD = $(top_builddir)/lib/libqb.la if HAVE_CHECK EXTRA_DIST += resources.test EXTRA_DIST += blackbox-segfault.sh TESTS = array.test map.test rb.test log.test blackbox-segfault.sh loop.test ipc.test resources.test resources.log: rb.log log.log ipc.log check_PROGRAMS = array.test map.test rb.test log.test loop.test ipc.test util.test crash_test_dummy file_change_bytes check_SCRIPTS = resources.test blackbox-segfault.sh if HAVE_SLOW_TESTS TESTS += util.test check_PROGRAMS += util.test endif file_change_bytes_SOURCES = file_change_bytes.c crash_test_dummy_SOURCES = crash_test_dummy.c $(top_builddir)/include/qb/qblog.h crash_test_dummy_CFLAGS = @CHECK_CFLAGS@ -I$(top_srcdir)/include crash_test_dummy_LDADD = $(top_builddir)/lib/libqb.la @CHECK_LIBS@ array_test_SOURCES = check_array.c $(top_builddir)/include/qb/qbarray.h array_test_CFLAGS = @CHECK_CFLAGS@ -I$(top_srcdir)/include array_test_LDADD = $(top_builddir)/lib/libqb.la @CHECK_LIBS@ map_test_SOURCES = check_map.c $(top_builddir)/include/qb/qbmap.h map_test_CFLAGS = @CHECK_CFLAGS@ -I$(top_srcdir)/include map_test_LDADD = $(top_builddir)/lib/libqb.la @CHECK_LIBS@ rb_test_SOURCES = check_rb.c $(top_builddir)/include/qb/qbrb.h rb_test_CFLAGS = @CHECK_CFLAGS@ -I$(top_srcdir)/include rb_test_LDADD = $(top_builddir)/lib/libqb.la @CHECK_LIBS@ loop_test_SOURCES = check_loop.c $(top_builddir)/include/qb/qbloop.h loop_test_CFLAGS = @CHECK_CFLAGS@ -I$(top_srcdir)/include loop_test_LDADD = $(top_builddir)/lib/libqb.la @CHECK_LIBS@ ipc_test_SOURCES = check_ipc.c $(top_builddir)/include/qb/qbipcc.h $(top_builddir)/include/qb/qbipcs.h ipc_test_CFLAGS = @CHECK_CFLAGS@ -I$(top_srcdir)/include ipc_test_LDADD = $(top_builddir)/lib/libqb.la @CHECK_LIBS@ log_test_SOURCES = check_log.c $(top_builddir)/include/qb/qblog.h log_test_CFLAGS = @CHECK_CFLAGS@ -I$(top_srcdir)/include log_test_LDADD = $(top_builddir)/lib/libqb.la @CHECK_LIBS@ if HAVE_SYSLOG_TESTS log_test_LDADD += _syslog_override.la check_LTLIBRARIES = _syslog_override.la _syslog_override_la_SOURCES = _syslog_override.c _syslog_override.h _syslog_override_la_LDFLAGS = -module endif util_test_SOURCES = check_util.c $(top_builddir)/include/qb/qbutil.h util_test_CFLAGS = @CHECK_CFLAGS@ -I$(top_srcdir)/include util_test_LDADD = $(top_builddir)/lib/libqb.la @CHECK_LIBS@ endif -clean-generic: - $(AM_V_GEN)rm -f *.log - $(AM_V_GEN)rm -f *.fdata +clean-local: + rm -f *.log + rm -f *.fdata