Commit 7eaa1ec0 authored by Thomas Markwalder's avatar Thomas Markwalder
Browse files

[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
parent 9b6ef162
......@@ -1393,7 +1393,6 @@ AC_CONFIG_FILES([compatcheck/Makefile
src/bin/d2/tests/Makefile
src/bin/d2/tests/d2_process_tests.sh
src/bin/d2/tests/test_data_files_config.h
src/bin/cfgrpt/Makefile
src/bin/dhcp4/Makefile
src/bin/dhcp4/spec_config.h.pre
src/bin/dhcp4/tests/Makefile
......@@ -1442,6 +1441,7 @@ AC_CONFIG_FILES([compatcheck/Makefile
src/lib/asiolink/tests/Makefile
src/lib/cc/Makefile
src/lib/cc/tests/Makefile
src/lib/cfgrpt/Makefile
src/lib/config/Makefile
src/lib/config/tests/Makefile
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/unittests/Makefile
tools/path_replacer.sh
tools/mk_cfgrpt.sh
])
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/tests/process_spawn_app.sh
chmod +x tools/path_replacer.sh
chmod +x tools/mk_cfgrpt.sh
])
AC_OUTPUT
......@@ -1651,10 +1653,6 @@ Developer:
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 <<EOF
......
# 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
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
......@@ -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/hooks/libkea-hooks.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_ddns_DATA = dhcp-ddns.spec
......@@ -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/util/libkea-util.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
endif
......
......@@ -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/stats/libkea-stats.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_dhcp4_DATA = dhcp4.spec
......@@ -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/dhcpsrv/testutils/libdhcpsrvtest.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
endif
......
......@@ -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/hooks/libkea-hooks.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_dhcp6dir = $(pkgdatadir)
......
......@@ -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/util/libkea-util.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
endif
......
......@@ -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/util/libkea-util.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)
......@@ -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/util/libkea-util.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
......
......@@ -48,7 +48,7 @@ perfdhcp_LDADD = libperfdhcp.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/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
EXTRA_DIST = perfdhcp_internals.dox
......
......@@ -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/dhcp/libkea-dhcp++.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)
endif
......
# The following build order must be maintained.
SUBDIRS = exceptions util log hooks cryptolink dns cc asiolink dhcp config stats \
asiodns testutils dhcp_ddns dhcpsrv
asiodns testutils dhcp_ddns dhcpsrv cfgrpt
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
/path_replacer.sh
\ No newline at end of file
/path_replacer.sh
/mk_cfgrpt.sh
......@@ -17,10 +17,22 @@
# 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
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
cat >> $dest << END
......@@ -34,7 +46,7 @@ END
# Body: escape '\'s and '"'s, preprend ' ";;;; ' and append '",'
sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/^/ ";;;; /' -e 's/$/",/' \
< config.report >> $dest
< $report_file >> $dest
# Trailer
cat >> $dest <<END
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment