From 611d30ceb68c8542d11acee8248f66f9485505e9 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 1 Nov 2010 12:22:47 -0700 Subject: [PATCH] vlog: Generate vlog-modules.def automatically. --- Makefile.am | 1 + build-aux/check-vlog-modules | 66 -------------------------- lib/automake.mk | 23 ++++++--- lib/vlog-modules.def | 92 ------------------------------------ m4/openvswitch.m4 | 4 +- 5 files changed, 21 insertions(+), 165 deletions(-) delete mode 100755 build-aux/check-vlog-modules delete mode 100644 lib/vlog-modules.def diff --git a/Makefile.am b/Makefile.am index da4c1b33..8517b2b8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -12,6 +12,7 @@ SUBDIRS = datapath AM_CPPFLAGS = $(SSL_CFLAGS) AM_CPPFLAGS += -I $(top_srcdir)/include AM_CPPFLAGS += -I $(top_srcdir)/lib +AM_CPPFLAGS += -I $(top_builddir)/lib AM_CFLAGS = -Wstrict-prototypes AM_CFLAGS += $(WARNING_FLAGS) diff --git a/build-aux/check-vlog-modules b/build-aux/check-vlog-modules deleted file mode 100755 index d6efaa4f..00000000 --- a/build-aux/check-vlog-modules +++ /dev/null @@ -1,66 +0,0 @@ -#! /bin/sh - -if test "$1" = --help; then - cat </dev/null 2>&1; then - : -else - exit 0 -fi - -# Get the list of modules declared in lib/vlog-modules.def. -vlog_modules=` - sed -n 's/^VLOG_MODULE(\([_a-zA-Z0-9]\{1,\}\)).*$/\1/p' \ - lib/vlog-modules.def \ - | LC_ALL=C sort -u | xargs echo` - -# Get the list of modules defined in some source file. -src_modules=` - git grep -h -E '^[ ]*VLOG_DEFINE(_THIS)?_MODULE\([_a-zA-Z0-9]+\);[ ]*$' \ - | sed 's/.*(\([_a-zA-Z0-9]\{1,\}\)).*/\1/' \ - | LC_ALL=C sort -u \ - | xargs echo` - -rc=0 - -for module in $vlog_modules; do - case " $src_modules " in - *" $module "*) ;; - *) echo "vlog module $module is declared in lib/vlog-modules.def but not defined by any source file"; - rc=1 ;; - esac -done - -for module in $src_modules; do - case " $vlog_modules " in - *" $module "*) ;; - *) echo "vlog module $module is defined in a source file but not declared in lib/vlog-modules.def"; - rc=1 ;; - esac -done - -exit $rc diff --git a/lib/automake.mk b/lib/automake.mk index 07509107..65556611 100644 --- a/lib/automake.mk +++ b/lib/automake.mk @@ -156,7 +156,6 @@ lib_libopenvswitch_a_SOURCES = \ lib/vconn-stream.c \ lib/vconn.c \ lib/vconn.h \ - lib/vlog-modules.def \ lib/vlog.c \ lib/vlog.h nodist_lib_libopenvswitch_a_SOURCES = \ @@ -247,6 +246,17 @@ lib-install-data-local: $(MKDIR_P) $(DESTDIR)$(PKIDIR) $(MKDIR_P) $(DESTDIR)$(LOGDIR) +# All distributed sources, with names adjust properly for referencing +# from $(builddir). +all_sources = \ + `for file in $(DIST_SOURCES); do \ + if test -f $$file; then \ + echo $$file; \ + else \ + echo $(VPATH)/$$file; \ + fi; \ + done` + # All the source files that have coverage counters. COVERAGE_FILES = \ lib/dpif.c \ @@ -277,8 +287,9 @@ lib/coverage-counters.c: $(COVERAGE_FILES) lib/coverage-scan.pl mv $@.tmp $@ EXTRA_DIST += lib/coverage-scan.pl -ALL_LOCAL += check-vlog-modules -check-vlog-modules: - cd $(srcdir) && build-aux/check-vlog-modules -.PHONY: check-vlog-modules -EXTRA_DIST += build-aux/check-vlog-modules +if !USE_LINKER_SECTIONS +lib/vlog.$(OBJEXT): lib/vlog-modules.def +lib/vlog-modules.def: $(DIST_SOURCES) + sed -n 's|^VLOG_DEFINE_\(THIS_\)\{0,1\}MODULE(\([_a-zA-Z0-9]\{1,\}\)).*$$|VLOG_MODULE(\2)|p' $(all_sources) | LC_ALL=C sort -u > $@ +CLEANFILES += lib/vlog-modules.def +endif diff --git a/lib/vlog-modules.def b/lib/vlog-modules.def deleted file mode 100644 index f891613e..00000000 --- a/lib/vlog-modules.def +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2008, 2009, 2010 Nicira Networks. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Modules that can emit log messages. */ -VLOG_MODULE(backtrace) -VLOG_MODULE(brcompatd) -VLOG_MODULE(bridge) -VLOG_MODULE(cfm) -VLOG_MODULE(collectors) -VLOG_MODULE(controller) -VLOG_MODULE(coverage) -VLOG_MODULE(daemon) -VLOG_MODULE(dhcp) -VLOG_MODULE(dhcp_client) -VLOG_MODULE(discovery) -VLOG_MODULE(dpif) -VLOG_MODULE(dpif_linux) -VLOG_MODULE(dpif_netdev) -VLOG_MODULE(dpctl) -VLOG_MODULE(entropy) -VLOG_MODULE(fail_open) -VLOG_MODULE(fatal_signal) -VLOG_MODULE(flow) -VLOG_MODULE(in_band) -VLOG_MODULE(jsonrpc) -VLOG_MODULE(leak_checker) -VLOG_MODULE(learning_switch) -VLOG_MODULE(lockfile) -VLOG_MODULE(mac_learning) -VLOG_MODULE(netdev) -VLOG_MODULE(netdev_dummy) -VLOG_MODULE(netdev_linux) -VLOG_MODULE(netdev_vport) -VLOG_MODULE(netflow) -VLOG_MODULE(netlink) -VLOG_MODULE(nx_match) -VLOG_MODULE(ofctl) -VLOG_MODULE(ofp_parse) -VLOG_MODULE(ofp_util) -VLOG_MODULE(ovs_discover) -VLOG_MODULE(ofproto) -VLOG_MODULE(openflowd) -VLOG_MODULE(ovsdb_client) -VLOG_MODULE(ovsdb_error) -VLOG_MODULE(ovsdb_file) -VLOG_MODULE(ovsdb_idl) -VLOG_MODULE(ovsdb_log) -VLOG_MODULE(ovsdb_jsonrpc_server) -VLOG_MODULE(ovsdb_server) -VLOG_MODULE(ovsdb_tool) -VLOG_MODULE(pktbuf) -VLOG_MODULE(pcap) -VLOG_MODULE(poll_loop) -VLOG_MODULE(proc_net_compat) -VLOG_MODULE(process) -VLOG_MODULE(rconn) -VLOG_MODULE(reconnect) -VLOG_MODULE(rtnetlink) -VLOG_MODULE(sflow) -VLOG_MODULE(stream_fd) -VLOG_MODULE(stream_ssl) -VLOG_MODULE(stream_tcp) -VLOG_MODULE(stream_unix) -VLOG_MODULE(stream) -VLOG_MODULE(status) -VLOG_MODULE(svec) -VLOG_MODULE(timeval) -VLOG_MODULE(socket_util) -VLOG_MODULE(system_stats) -VLOG_MODULE(unixctl) -VLOG_MODULE(util) -VLOG_MODULE(vconn_stream) -VLOG_MODULE(vconn) -VLOG_MODULE(vsctl) -VLOG_MODULE(vlog) -VLOG_MODULE(vswitchd) -VLOG_MODULE(xenserver) - -#undef VLOG_MODULE diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4 index fe30eec2..6dda3508 100644 --- a/m4/openvswitch.m4 +++ b/m4/openvswitch.m4 @@ -348,4 +348,6 @@ AC_DEFUN([OVS_CHECK_LINKER_SECTIONS], into sections with user-defined names and the linker automatically defines __start_SECNAME and __stop_SECNAME symbols that designate the start and end of the section.]) - fi]) + fi + AM_CONDITIONAL( + [USE_LINKER_SECTIONS], [test $ovs_cv_use_linker_sections = yes])]) -- 2.30.2