Parcourir la source

[3929] config_report.cc is now generated during src/lib/cfgrpt/Makefile

By generating config_report.cc in the cfgrpt directory Makefile
rather than configure, it can be treated as any other generated
source file, rather than a one-off special case.

Moved cfgrpt directory from bin to lib since it creates a library
rather than an executable.

mk_cfgrpt.sh is now generated by configure from a .in file and

Details:

configure.ac
   removed call to mk_cfgrpts.sh
   added mk_cfgprt.sh to list of files generated by configure

src/bin/Makefile.am
   removed cfgrpt dir

changed cfgrpt directory to lib
    src/bin/d2/Makefile.am
    src/bin/d2/tests/Makefile.am
    src/bin/dhcp4/Makefile.am
    src/bin/dhcp4/tests/Makefile.am
    src/bin/dhcp6/Makefile.am
    src/bin/dhcp6/tests/Makefile.am
    src/bin/lfc/Makefile.am
    src/bin/lfc/tests/Makefile.am
    src/bin/perfdhcp/Makefile.am
    src/bin/perfdhcp/tests/Makefile.am

src/lib/Makefile.am
    added cfgrpt dir

src/lib/cfgrpt/Makefile.am
    changed include dir to be in lib not dir
    added config_report.cc to CLEANFILES
    added config_report.cc to BUILD_SOURCES
    removed config_report.cc from libcfgrpt_la_SOURCES
    added rule for config_report.cc to call mk_cfgrpt.sh
Thomas Markwalder il y a 9 ans
Parent
commit
7eaa1ec09c

+ 3 - 5
configure.ac

@@ -1393,7 +1393,6 @@ AC_CONFIG_FILES([compatcheck/Makefile
                  src/bin/d2/tests/Makefile
                  src/bin/d2/tests/Makefile
                  src/bin/d2/tests/d2_process_tests.sh
                  src/bin/d2/tests/d2_process_tests.sh
                  src/bin/d2/tests/test_data_files_config.h
                  src/bin/d2/tests/test_data_files_config.h
-                 src/bin/cfgrpt/Makefile
                  src/bin/dhcp4/Makefile
                  src/bin/dhcp4/Makefile
                  src/bin/dhcp4/spec_config.h.pre
                  src/bin/dhcp4/spec_config.h.pre
                  src/bin/dhcp4/tests/Makefile
                  src/bin/dhcp4/tests/Makefile
@@ -1442,6 +1441,7 @@ AC_CONFIG_FILES([compatcheck/Makefile
                  src/lib/asiolink/tests/Makefile
                  src/lib/asiolink/tests/Makefile
                  src/lib/cc/Makefile
                  src/lib/cc/Makefile
                  src/lib/cc/tests/Makefile
                  src/lib/cc/tests/Makefile
+                 src/lib/cfgrpt/Makefile
                  src/lib/config/Makefile
                  src/lib/config/Makefile
                  src/lib/config/tests/Makefile
                  src/lib/config/tests/Makefile
                  src/lib/config/tests/data_def_unittests_config.h
                  src/lib/config/tests/data_def_unittests_config.h
@@ -1494,6 +1494,7 @@ AC_CONFIG_FILES([compatcheck/Makefile
                  src/lib/util/threads/tests/Makefile
                  src/lib/util/threads/tests/Makefile
                  src/lib/util/unittests/Makefile
                  src/lib/util/unittests/Makefile
                  tools/path_replacer.sh
                  tools/path_replacer.sh
+                 tools/mk_cfgrpt.sh
 ])
 ])
 
 
  AC_CONFIG_COMMANDS([permissions], [
  AC_CONFIG_COMMANDS([permissions], [
@@ -1512,6 +1513,7 @@ AC_CONFIG_FILES([compatcheck/Makefile
            chmod +x src/lib/util/python/gen_wiredata.py
            chmod +x src/lib/util/python/gen_wiredata.py
            chmod +x src/lib/util/tests/process_spawn_app.sh
            chmod +x src/lib/util/tests/process_spawn_app.sh
            chmod +x tools/path_replacer.sh
            chmod +x tools/path_replacer.sh
+           chmod +x tools/mk_cfgrpt.sh
 ])
 ])
 
 
 AC_OUTPUT
 AC_OUTPUT
@@ -1651,10 +1653,6 @@ Developer:
 
 
 END
 END
 
 
-# Create config_report.cc with embedded config.report
-chmod +x ${srcdir}/tools/mk_cfgrpt.sh
-${srcdir}/tools/mk_cfgrpt.sh ${srcdir}/src/bin/cfgrpt/config_report.cc
-
 cat config.report
 cat config.report
 cat <<EOF
 cat <<EOF
 
 

+ 1 - 1
src/bin/Makefile.am

@@ -1,4 +1,4 @@
 # The following build order must be maintained.
 # The following build order must be maintained.
-SUBDIRS = cfgrpt dhcp4 dhcp6 d2 perfdhcp admin lfc keactrl
+SUBDIRS = dhcp4 dhcp6 d2 perfdhcp admin lfc keactrl
 
 
 check-recursive: all-recursive
 check-recursive: all-recursive

+ 0 - 13
src/bin/cfgrpt/Makefile.am

@@ -1,13 +0,0 @@
-AM_CPPFLAGS = -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
-
-# Get rid of generated message files on a clean
-CLEANFILES = *.gcno *.gcda
-
-# config_report.cc was generated by configure
-DISTCLEANFILES = config_report.cc
-
-# convenience archive
-noinst_LTLIBRARIES = libcfgrpt.la
-
-libcfgrpt_la_SOURCES = config_report.h config_report.cc cfgrpt.cc
-nodist_libcfgrpt_la_SOURCES = config_report.cc

+ 1 - 1
src/bin/d2/Makefile.am

@@ -106,7 +106,7 @@ kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/dns/libkea-dns++.la
 kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
 kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
 kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
 kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
 kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
 kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
-kea_dhcp_ddns_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la
+kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
 
 
 kea_dhcp_ddnsdir = $(pkgdatadir)
 kea_dhcp_ddnsdir = $(pkgdatadir)
 kea_dhcp_ddns_DATA = dhcp-ddns.spec
 kea_dhcp_ddns_DATA = dhcp-ddns.spec

+ 1 - 1
src/bin/d2/tests/Makefile.am

@@ -87,7 +87,7 @@ d2_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/testutils/libdhcpsrvtest.l
 d2_unittests_LDADD += $(top_builddir)/src/lib/dns/libkea-dns++.la
 d2_unittests_LDADD += $(top_builddir)/src/lib/dns/libkea-dns++.la
 d2_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
 d2_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
 d2_unittests_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
 d2_unittests_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
-d2_unittests_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la
+d2_unittests_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
 d2_unittests_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
 d2_unittests_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
 
 
 endif
 endif

+ 1 - 1
src/bin/dhcp4/Makefile.am

@@ -85,7 +85,7 @@ kea_dhcp4_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la
 kea_dhcp4_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
 kea_dhcp4_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
 kea_dhcp4_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la
 kea_dhcp4_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la
 kea_dhcp4_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
 kea_dhcp4_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
-kea_dhcp4_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la
+kea_dhcp4_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
 
 
 kea_dhcp4dir = $(pkgdatadir)
 kea_dhcp4dir = $(pkgdatadir)
 kea_dhcp4_DATA = dhcp4.spec
 kea_dhcp4_DATA = dhcp4.spec

+ 1 - 1
src/bin/dhcp4/tests/Makefile.am

@@ -109,7 +109,7 @@ dhcp4_unittests_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
 dhcp4_unittests_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la
 dhcp4_unittests_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la
 dhcp4_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/testutils/libdhcpsrvtest.la
 dhcp4_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/testutils/libdhcpsrvtest.la
 dhcp4_unittests_LDADD += $(top_builddir)/src/lib/util/io/libkea-util-io.la
 dhcp4_unittests_LDADD += $(top_builddir)/src/lib/util/io/libkea-util-io.la
-dhcp4_unittests_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la
+dhcp4_unittests_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
 dhcp4_unittests_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la
 dhcp4_unittests_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la
 endif
 endif
 
 

+ 1 - 1
src/bin/dhcp6/Makefile.am

@@ -85,7 +85,7 @@ kea_dhcp6_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
 kea_dhcp6_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
 kea_dhcp6_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
 kea_dhcp6_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
 kea_dhcp6_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
 kea_dhcp6_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
 kea_dhcp6_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
-kea_dhcp6_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la
+kea_dhcp6_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
 kea_dhcp6_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la
 kea_dhcp6_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la
 
 
 kea_dhcp6dir = $(pkgdatadir)
 kea_dhcp6dir = $(pkgdatadir)

+ 1 - 1
src/bin/dhcp6/tests/Makefile.am

@@ -111,7 +111,7 @@ dhcp6_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
 dhcp6_unittests_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
 dhcp6_unittests_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
 dhcp6_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
 dhcp6_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
 dhcp6_unittests_LDADD += $(top_builddir)/src/lib/util/io/libkea-util-io.la
 dhcp6_unittests_LDADD += $(top_builddir)/src/lib/util/io/libkea-util-io.la
-dhcp6_unittests_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la
+dhcp6_unittests_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
 dhcp6_unittests_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la
 dhcp6_unittests_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la
 
 
 endif
 endif

+ 1 - 1
src/bin/lfc/Makefile.am

@@ -65,6 +65,6 @@ kea_lfc_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
 kea_lfc_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
 kea_lfc_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
 kea_lfc_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
 kea_lfc_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
 kea_lfc_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
 kea_lfc_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
-kea_lfc_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la
+kea_lfc_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
 
 
 kea_lfcdir = $(pkgdatadir)
 kea_lfcdir = $(pkgdatadir)

+ 1 - 1
src/bin/lfc/tests/Makefile.am

@@ -58,7 +58,7 @@ lfc_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
 lfc_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
 lfc_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
 lfc_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
 lfc_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
 lfc_unittests_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
 lfc_unittests_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
-lfc_unittests_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la
+lfc_unittests_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
 
 
 endif
 endif
 
 

+ 1 - 1
src/bin/perfdhcp/Makefile.am

@@ -48,7 +48,7 @@ perfdhcp_LDADD = libperfdhcp.la
 perfdhcp_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
 perfdhcp_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
 perfdhcp_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
 perfdhcp_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
 perfdhcp_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
 perfdhcp_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
-perfdhcp_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la
+perfdhcp_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
 
 
 # ... and the documentation
 # ... and the documentation
 EXTRA_DIST = perfdhcp_internals.dox
 EXTRA_DIST = perfdhcp_internals.dox

+ 1 - 1
src/bin/perfdhcp/tests/Makefile.am

@@ -47,7 +47,7 @@ run_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
 run_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
 run_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
 run_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
 run_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
 run_unittests_LDADD += $(top_builddir)/src/lib/util/unittests/libutil_unittests.la
 run_unittests_LDADD += $(top_builddir)/src/lib/util/unittests/libutil_unittests.la
-run_unittests_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la
+run_unittests_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
 run_unittests_LDADD += $(GTEST_LDADD)
 run_unittests_LDADD += $(GTEST_LDADD)
 endif
 endif
 
 

+ 1 - 1
src/lib/Makefile.am

@@ -1,3 +1,3 @@
 # The following build order must be maintained.
 # The following build order must be maintained.
 SUBDIRS = exceptions util log hooks cryptolink dns cc asiolink dhcp config stats \
 SUBDIRS = exceptions util log hooks cryptolink dns cc asiolink dhcp config stats \
-          asiodns testutils dhcp_ddns dhcpsrv
+          asiodns testutils dhcp_ddns dhcpsrv cfgrpt

src/bin/cfgrpt/.gitignore → src/lib/cfgrpt/.gitignore


+ 17 - 0
src/lib/cfgrpt/Makefile.am

@@ -0,0 +1,17 @@
+AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
+
+# Get rid of generated message files on a clean
+CLEANFILES = *.gcno *.gcda config_report.cc
+
+# config_report.cc is generated below
+BUILT_SOURCES = config_report.cc
+
+# convenience archive
+noinst_LTLIBRARIES = libcfgrpt.la
+
+nodist_libcfgrpt_la_SOURCES = config_report.cc
+libcfgrpt_la_SOURCES = config_report.h cfgrpt.cc
+
+# Generate config_report.cc
+config_report.cc: $(abs_top_builddir)/config.report
+	$(abs_top_builddir)/tools/mk_cfgrpt.sh $(abs_top_builddir)/src/lib/cfgrpt/config_report.cc

src/bin/cfgrpt/cfgrpt.cc → src/lib/cfgrpt/cfgrpt.cc


src/bin/cfgrpt/config_report.h → src/lib/cfgrpt/config_report.h


+ 2 - 1
tools/.gitignore

@@ -1 +1,2 @@
-/path_replacer.sh
+/path_replacer.sh
+/mk_cfgrpt.sh

+ 15 - 3
tools/mk_cfgrpt.sh

@@ -17,10 +17,22 @@
 # Called by configure
 # Called by configure
 #
 #
 
 
-dest=$1
+dest="$1"
+report_file="@abs_top_builddir@/config.report"
+
+if [ -z ${report_file} ]
+then
+    echo "ERROR mk_cfgrpt.sh - input report: $report_file does not exist"
+    exit -1
+fi
 
 
 # Initializes
 # Initializes
-cat > $dest
+cat /dev/null > $dest
+if [ $? -ne 0 ]
+then
+    echo "ERROR mk_cfgrpt.sh - cannot create config output file: $dest"
+    exit -1
+fi
 
 
 # Header
 # Header
 cat >> $dest << END
 cat >> $dest << END
@@ -34,7 +46,7 @@ END
 
 
 # Body: escape '\'s and '"'s, preprend '    ";;;; ' and append '",'
 # Body: escape '\'s and '"'s, preprend '    ";;;; ' and append '",'
 sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/^/    ";;;; /' -e 's/$/",/' \
 sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/^/    ";;;; /' -e 's/$/",/' \
-    < config.report >> $dest
+    < $report_file >> $dest
 
 
 # Trailer
 # Trailer
 cat >> $dest <<END
 cat >> $dest <<END