From 4a2cabe3be6593effa1004279e39a44f39f8e13f Mon Sep 17 00:00:00 2001 From: Olaf Meeuwissen Date: Sat, 11 Jul 2020 16:51:23 +0900 Subject: [PATCH] pixma: Fix sane options file generation This now generates files in the source tree and includes them in the source tarball together with the script used. Explicit dependencies are added to trigger generation. Rules have been rewritten to use implicit variables for brevity. --- backend/Makefile.am | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/backend/Makefile.am b/backend/Makefile.am index 4f8c01b31..9507fe7ac 100644 --- a/backend/Makefile.am +++ b/backend/Makefile.am @@ -56,14 +56,6 @@ dll-preload.h: fi; \ echo "};" >> $@ -# generate options files for pixma backend -pixma/pixma_sane_options.h: - @echo Generating pixma_sane_options.h from pixma.c - @python pixma/scripts/pixma_gen_options.py h < pixma/pixma.c > pixma/pixma_sane_options.h -pixma/pixma_sane_options.c: - @echo Generating pixma_sane_options.c from pixma.c - @python pixma/scripts/pixma_gen_options.py < pixma/pixma.c > pixma/pixma_sane_options.c - # TODO: This really belongs together with the saned sources and # should be installed there as well. EXTRA_DIST += saned.conf.in @@ -945,15 +937,30 @@ libpixma_la_SOURCES = pixma/pixma.c \ pixma/pixma_rename.h libpixma_la_CPPFLAGS = $(AM_CPPFLAGS) $(XML_CFLAGS) -DBACKEND_NAME=pixma +# Generate options files included by pixma/pixma.c from said file. +# The circular dependency means we cannot add it as a prerequisite +# for the targets that build the options files. + +$(srcdir)/pixma/pixma.c: \ + $(srcdir)/pixma/pixma_sane_options.h \ + $(srcdir)/pixma/pixma_sane_options.c + +$(srcdir)/pixma/pixma_sane_options.h: + @echo Generating $@ from $(@D)/pixma.c + @(cd $(@D); python scripts/pixma_gen_options.py h < pixma.c > $(@F)) +$(srcdir)/pixma/pixma_sane_options.c: + @echo Generating $@ from $(@D)/pixma.c + @(cd $(@D); python scripts/pixma_gen_options.py < pixma.c > $(@F)) + +EXTRA_DIST += pixma/pixma_sane_options.c +EXTRA_DIST += pixma/pixma_sane_options.h +EXTRA_DIST += pixma/scripts/pixma_gen_options.py + nodist_libsane_pixma_la_SOURCES = pixma-s.c libsane_pixma_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=pixma libsane_pixma_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS) libsane_pixma_la_LIBADD = $(COMMON_LIBS) libpixma.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_usb.lo ../sanei/sanei_thread.lo $(SANEI_SANEI_JPEG_LO) $(JPEG_LIBS) $(XML_LIBS) $(MATH_LIB) $(SOCKET_LIBS) $(USB_LIBS) $(SANEI_THREAD_LIBS) $(RESMGR_LIBS) EXTRA_DIST += pixma.conf.in -# included in pixma.c -BUILT_SOURCES = pixma/pixma_sane_options.c pixma/pixma_sane_options.h -CLEANFILES += pixma/pixma_sane_options.c pixma/pixma_sane_options.h - libplustek_la_SOURCES = plustek.c plustek.h libplustek_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=plustek @@ -1223,7 +1230,7 @@ libdll_preload_la_LIBADD = ../sanei/sanei_usb.lo $(USB_LIBS) $(XML_LIBS) libdll_la_SOURCES = dll.c libdll_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=dll libdll_la_LIBADD = ../sanei/sanei_usb.lo $(USB_LIBS) $(XML_LIBS) -BUILT_SOURCES += dll-preload.h +BUILT_SOURCES = dll-preload.h CLEANFILES += dll-preload.h nodist_libsane_dll_la_SOURCES = dll-s.c