From adac4f23e672ce7a2d6e601024bda190a12e0df5 Mon Sep 17 00:00:00 2001 From: David Ward Date: Sun, 24 Apr 2022 22:52:55 -0400 Subject: [PATCH] backend/Makefile: Improve rules for pixma/pixma_sane_options.{c,h} Ensure these files are updated after pixma/pixma.c is changed. Do not remove them during "make clean" or "make distclean", because they are part of the source distribution (generated with "make dist"). Display the relative paths in the build output. --- backend/Makefile.am | 43 ++++++++++++++++++++++--------------------- po/Makevars | 2 +- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/backend/Makefile.am b/backend/Makefile.am index 3e98076ad..e6de26b5f 100644 --- a/backend/Makefile.am +++ b/backend/Makefile.am @@ -18,6 +18,8 @@ DIST_LIBS_LDFLAGS = $(AM_LDFLAGS) -rpath '$(libdir)' -version-number $(V_MAJOR): LIBTOOL += --silent FIRMWARE_DIRS = artec_eplus48u gt68xx snapscan epjitsu +BUILT_SOURCES = + # Needed by most backends as they add sane_strstatus.lo to their list # of libraries to link with via libsane_${BACKEND}_la_LIBADD. Due to # the implicit dependency, automake does not notice the need to clean @@ -1429,7 +1431,9 @@ libsane_pint_la_LIBADD = $(COMMON_LIBS) \ ../sanei/sanei_config.lo \ sane_strstatus.lo -libpixma_la_SOURCES = pixma/pixma.c \ +libpixma_la_SOURCES = \ + pixma/pixma_sane_options.h \ + pixma/pixma.c \ pixma/pixma.h \ pixma/pixma_io_sanei.c \ pixma/pixma_io.h \ @@ -1446,28 +1450,25 @@ 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: - $(AM_V_GEN) - @if $(AM_V_P); then echo Generating $@ from $(@D)/pixma.c; fi - @(cd $(@D); $(PYTHON) scripts/pixma_gen_options.py h < pixma.c > $(@F)) -$(srcdir)/pixma/pixma_sane_options.c: - $(AM_V_GEN) - @if $(AM_V_P); then echo Generating $@ from $(@D)/pixma.c; fi - @(cd $(@D); $(PYTHON) scripts/pixma_gen_options.py < pixma.c > $(@F)) +$(srcdir)/pixma/pixma_sane_options.h: $(srcdir)/pixma/pixma.c + @if $(AM_V_P); then \ + echo "Generating pixma/$(@F) from pixma/$(^F)"; \ + else \ + echo " GEN pixma/$(@F)"; \ + fi + @$(PYTHON) $(srcdir)/pixma/scripts/pixma_gen_options.py h < $^ > $@ +$(srcdir)/pixma/pixma_sane_options.c: $(srcdir)/pixma/pixma.c + @if $(AM_V_P); then \ + echo "Generating pixma/$(@F) from pixma/$(^F)"; \ + else \ + echo " GEN pixma/$(@F)"; \ + fi + @$(PYTHON) $(srcdir)/pixma/scripts/pixma_gen_options.py < $^ > $@ +BUILT_SOURCES += pixma/pixma_sane_options.c +BUILT_SOURCES += pixma/pixma_sane_options.h EXTRA_DIST += pixma/pixma_sane_options.c -EXTRA_DIST += pixma/pixma_sane_options.h EXTRA_DIST += pixma/scripts/pixma_gen_options.py -CLEANFILES += pixma/pixma_sane_options.c -CLEANFILES += pixma/pixma_sane_options.h nodist_libsane_pixma_la_SOURCES = pixma-s.c libsane_pixma_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=pixma @@ -1969,7 +1970,7 @@ 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 diff --git a/po/Makevars b/po/Makevars index 86f423ef3..ca2a5cce7 100644 --- a/po/Makevars +++ b/po/Makevars @@ -52,4 +52,4 @@ EXTRA_LOCALE_CATEGORIES = # Selected files in POTFILES.in are generated. Make sure they are # available when needed. $(top_srcdir)/backend/pixma/pixma_sane_options.c: - cd ../backend; make pixma/pixma_sane_options.c + $(MAKE) -C ../backend pixma/pixma_sane_options.c