Commit b2d840cf authored by Martin Blix Grydeland's avatar Martin Blix Grydeland

Build VSC generated sources in lib/libvsc

This is to resolve the chicken and egg problem of the VSC headers being
generated only once bin/varnishd is built, while they are used in several
VMODs and libraries.

This moves the generation of the VSC .c and .h header files to a directory
in lib that can be built earlier than its dependencies.

Also Don't AC_SUBST the vsc files. The complete list of vsc files is known
and listed in the .am file when automake is run, so there is no need to
have configure.ac help with making lists.
parent 99f8560e
......@@ -4,7 +4,8 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/lib/libvgz \
-I$(top_builddir)/bin/varnishd \
-I$(top_builddir)/include
-I$(top_builddir)/include \
-I$(top_builddir)/lib/libvsc
sbin_PROGRAMS = varnishd
......@@ -178,6 +179,7 @@ varnishd_LDFLAGS = -export-dynamic
varnishd_LDADD = \
$(top_builddir)/lib/libvcc/libvcc.la \
$(top_builddir)/lib/libvarnish/libvarnish.la \
$(top_builddir)/lib/libvsc/libvsc.la \
$(top_builddir)/lib/libvgz/libvgz.la \
@JEMALLOC_LDADD@ \
${DL_LIBS} ${PTHREAD_LIBS} ${NET_LIBS} ${RT_LIBS} ${LIBM}
......@@ -250,28 +252,3 @@ DISTCLEANFILES = builtin_vcl.c
BUILT_SOURCES = vhp_hufdec.h
DISTCLEANFILES += vhp_hufdec.h
#######################################################################
.vsc.c:
$(PYTHON) $(top_srcdir)/lib/libvcc/vsctool.py -ch $<
VSC_SRC = \
VSC_lck.vsc \
VSC_main.vsc \
VSC_mempool.vsc \
VSC_mgt.vsc \
VSC_sma.vsc \
VSC_smf.vsc \
VSC_smu.vsc \
VSC_vbe.vsc
VSC_GEN_C = @VSC_GEN_C@
VSC_GEN_H = @VSC_GEN_H@
$(VSC_GEN_C): $(top_srcdir)/lib/libvcc/vsctool.py
BUILT_SOURCES += $(VSC_GEN_C)
CLEANFILES = $(VSC_GEN_C) $(VSC_GEN_H)
varnishd_SOURCES += $(VSC_SRC)
......@@ -824,14 +824,6 @@ VMOD_TESTS="$(cd $srcdir/vmod && echo tests/*.vtc)"
AC_SUBST(VMOD_TESTS)
AM_SUBST_NOTMAKE(VMOD_TESTS)
VSC_SRC="$(cd $srcdir/bin/varnishd && echo *.vsc)"
VSC_GEN_C="$(echo $VSC_SRC | sed 's:\.vsc:.c:g')"
VSC_GEN_H="$(echo $VSC_SRC | sed 's:\.vsc:.h:g')"
# automake does not allow to AC_SUBST _SOURCES files (for a good
# reason), so we automate the cleanup at least
AC_SUBST(VSC_GEN_C)
AC_SUBST(VSC_GEN_H)
# Make sure this include dir exists
AC_CONFIG_COMMANDS([mkdir], [$MKDIR_P doc/sphinx/include])
......@@ -854,6 +846,7 @@ AC_CONFIG_FILES([
etc/Makefile
include/Makefile
lib/Makefile
lib/libvsc/Makefile
lib/libvarnish/Makefile
lib/libvarnishapi/Makefile
lib/libvcc/Makefile
......
......@@ -86,22 +86,21 @@ include/params.rst: $(top_builddir)/bin/varnishd/varnishd
BUILT_SOURCES += include/params.rst
COUNTERS = \
$(top_srcdir)/bin/varnishd/VSC_main.vsc \
$(top_srcdir)/bin/varnishd/VSC_mgt.vsc \
$(top_srcdir)/bin/varnishd/VSC_mempool.vsc \
$(top_srcdir)/bin/varnishd/VSC_sma.vsc \
$(top_srcdir)/bin/varnishd/VSC_smu.vsc \
$(top_srcdir)/bin/varnishd/VSC_smf.vsc \
$(top_srcdir)/bin/varnishd/VSC_vbe.vsc \
$(top_srcdir)/bin/varnishd/VSC_lck.vsc
include/counters.rst: $(top_srcdir)/lib/libvcc/vsctool.py $(COUNTERS)
$(top_srcdir)/lib/libvsc/VSC_main.vsc \
$(top_srcdir)/lib/libvsc/VSC_mgt.vsc \
$(top_srcdir)/lib/libvsc/VSC_mempool.vsc \
$(top_srcdir)/lib/libvsc/VSC_sma.vsc \
$(top_srcdir)/lib/libvsc/VSC_smu.vsc \
$(top_srcdir)/lib/libvsc/VSC_smf.vsc \
$(top_srcdir)/lib/libvsc/VSC_vbe.vsc \
$(top_srcdir)/lib/libvsc/VSC_lck.vsc
include/counters.rst: $(top_srcdir)/lib/libvsc/vsctool.py $(COUNTERS)
echo -n '' > ${@}_
for i in $(COUNTERS); do \
$(PYTHON) $(top_srcdir)/lib/libvcc/vsctool.py -r $$i >> ${@}_ ; \
$(PYTHON) $(top_srcdir)/lib/libvsc/vsctool.py -r $$i >> ${@}_ ; \
done
mv -f ${@}_ ${@}
BUILT_SOURCES += include/counters.rst
include/varnishncsa_options.rst: $(top_builddir)/bin/varnishncsa/varnishncsa
......
#
SUBDIRS = \
libvsc \
libvarnish \
libvarnishapi \
libvcc \
......
......@@ -36,8 +36,7 @@ dist_noinst_SCRIPTS = \
generate.py
dist_pkgdata_SCRIPTS = \
vmodtool.py \
vsctool.py
vmodtool.py
## keep in sync with include/Makefile.am
vcc_obj.c: \
......
#
AM_CPPFLAGS = \
-I$(top_srcdir)/include \
-I$(top_builddir)/include
VSC_SRC = \
VSC_lck.vsc \
VSC_main.vsc \
VSC_mempool.vsc \
VSC_mgt.vsc \
VSC_sma.vsc \
VSC_smf.vsc \
VSC_smu.vsc \
VSC_vbe.vsc
VSC_GEN_C = $(VSC_SRC:.vsc=.c)
VSC_GEN_H = $(VSC_SRC:.vsc=.h)
$(VSC_GEN_C): vsctool.py
.vsc.c:
$(PYTHON) $(srcdir)/vsctool.py -ch $<
noinst_LTLIBRARIES = libvsc.la
libvsc_la_SOURCES = $(VSC_SRC)
dist_pkgdata_SCRIPTS = \
vsctool.py
BUILT_SOURCES = $(VSC_GEN_C)
CLEANFILES = $(VSC_GEN_C) $(VSC_GEN_H)
......@@ -66,7 +66,7 @@ def genhdr(fo, name):
fo.write(' * NB: This file is machine generated, DO NOT EDIT!\n')
fo.write(' *\n')
fo.write(' * Edit ' + name +
'.vsc and run lib/libvcc/vsctool.py instead.\n')
'.vsc and run lib/libvsc/vsctool.py instead.\n')
fo.write(' */\n')
fo.write('\n')
......
......@@ -34,10 +34,10 @@ include $(srcdir)/automake_boilerplate_vtc.am
#
.vsc.c:
$(PYTHON) $(top_srcdir)/lib/libvcc/vsctool.py -c $<
$(PYTHON) $(top_srcdir)/lib/libvsc/vsctool.py -c $<
.vsc.h:
$(PYTHON) $(top_srcdir)/lib/libvcc/vsctool.py -h $<
$(PYTHON) $(top_srcdir)/lib/libvsc/vsctool.py -h $<
EXTRA_DIST += VSC_debug.vsc
nodist_libvmod_debug_la_SOURCES += \
......
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