[master] dcaf616c6 build: Centralize suffix .c.vsc make rules

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Mon May 15 16:42:06 UTC 2023


commit dcaf616c66d93de69735237967cc091fa490bb93
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Wed Mar 29 18:11:54 2023 +0200

    build: Centralize suffix .c.vsc make rules
    
    The new vsc.am file takes care of most of the logic, and include sites
    only need to reference sources as such.

diff --git a/Makefile.am b/Makefile.am
index c0480e143..5e2db4419 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -26,6 +26,7 @@ EXTRA_DIST = \
 	varnishapi.pc.in \
 	varnish.m4 \
 	varnish-legacy.m4 \
+	vsc.am \
 	vtc.am \
 	wflags.py
 
diff --git a/lib/libvsc/Makefile.am b/lib/libvsc/Makefile.am
index 842515148..243f82587 100644
--- a/lib/libvsc/Makefile.am
+++ b/lib/libvsc/Makefile.am
@@ -1,5 +1,7 @@
 #
 
+include $(top_srcdir)/vsc.am
+
 AM_CPPFLAGS = \
 	-I$(top_srcdir)/include \
 	-I$(top_builddir)/include
@@ -14,19 +16,7 @@ VSC_SRC = \
 	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)
+dist_pkgdata_SCRIPTS = vsctool.py
diff --git a/vmod/Makefile.am b/vmod/Makefile.am
index b50458265..a485c0372 100644
--- a/vmod/Makefile.am
+++ b/vmod/Makefile.am
@@ -2,6 +2,7 @@
 
 TESTS = @VMOD_TESTS@
 
+include $(top_srcdir)/vsc.am
 include $(top_srcdir)/vtc.am
 
 EXTRA_DIST = $(TESTS)
@@ -36,18 +37,9 @@ include $(srcdir)/automake_boilerplate_vtc.am
 # Post-boilerplate tweaks
 #
 
-.vsc.c: $(top_srcdir)/lib/libvsc/vsctool.py
-	$(PYTHON) $(top_srcdir)/lib/libvsc/vsctool.py -c $<
+VSC_SRC = VSC_debug.vsc
 
-.vsc.h: $(top_srcdir)/lib/libvsc/vsctool.py
-	$(PYTHON) $(top_srcdir)/lib/libvsc/vsctool.py -h $<
-
-EXTRA_DIST += VSC_debug.vsc
-nodist_libvmod_debug_la_SOURCES += \
-	VSC_debug.c \
-	VSC_debug.h
-
-vmod_debug.c: VSC_debug.c VSC_debug.h
+libvmod_debug_la_SOURCES += $(VSC_SRC)
 
 # Allow Vmod_wrong*_Data to be exported
 vmod_debug_symbols_regex = 'Vmod_.*_Data'
diff --git a/vsc.am b/vsc.am
new file mode 100644
index 000000000..e199810a4
--- /dev/null
+++ b/vsc.am
@@ -0,0 +1,14 @@
+# Generic rule to generate C code from VSC files. VSC files must be listed
+# in the $(VSC_SRC) variable.
+
+VSC_GEN = $(VSC_SRC:.vsc=.c) $(VSC_SRC:.vsc=.h)
+
+$(VSC_GEN): $(top_srcdir)/lib/libvsc/vsctool.py
+
+.vsc.c:
+	$(AM_V_GEN) $(PYTHON) $(top_srcdir)/lib/libvsc/vsctool.py -ch $<
+
+clean-local: vsc-clean
+
+vsc-clean:
+	rm -f $(VSC_GEN)
diff --git a/vtc.am b/vtc.am
index f67a4969c..cf29b5c9b 100644
--- a/vtc.am
+++ b/vtc.am
@@ -11,7 +11,7 @@
 VTC_LOG_COMPILER = $(top_builddir)/bin/varnishtest/varnishtest -v -i
 TEST_EXTENSIONS = .vtc
 
-check-am: vtc-check-tests
+check-local: vtc-check-tests
 
 vtc-check-tests:
 	@mkdir -p tests ; \


More information about the varnish-commit mailing list