From 8c3800ae893db65b44c5b82384e6e7d3750ddb55 Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Thu, 17 Nov 2022 23:12:14 -0500 Subject: [PATCH] Restructure icon rebuild rules a bit. The way that the build-icons rule is currently handled means that 'make install' is triggering compilation of the ewmhicon test program, even if the icons are already available. This is undesirable as 'make install' should normally not cause anything to be compiled like that. Split up the rules so that nothing gets built until after the rule has actually determined that one or more icons are missing. --- Makefile.am | 58 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/Makefile.am b/Makefile.am index d3ac6a9..c3efff6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -105,42 +105,52 @@ $(t_ewmhicon_OBJECTS): $(gnulib_headers) t_rng_test_LDADD = libgnu.a $(t_rng_test_OBJECTS): $(gnulib_headers) -GENPNG_V = $(GENPNG_V_@AM_V@) -GENPNG_V_ = $(GENPNG_V_@AM_DEFAULT_V@) -GENPNG_V_0 = @printf ' %$(DX_ALIGN_V)s %s\n' 'GEN ' $*.png; +SUFFIXES = .xpm .gen +XPMICONS = data/rr16x16.xpm data/rr24x24.xpm data/rr32x32.xpm data/rr48x48.xpm +PNGICONS = $(XPMICONS:.xpm=.png) -$(GENICONS:.png=.gen): - $(GENPNG_V) $(MKDIR_P) $(@D) +DISTCLEANFILES += $(XPMICONS) +MAINTAINERCLEANFILES += $(PNGICONS) + +$(XPMICONS): t/ewmhicon$(EXEEXT) + $(AM_V_GEN) $(MKDIR_P) $(@D) $(AM_V_at) s=`expr $(@F) : '[^0-9]*\([^.]*\)'`; \ - t/ewmhicon$(EXEEXT) -c yrwyogbbg "$$s" >$*.xpm + t/ewmhicon$(EXEEXT) -c yrwyogbbg "$$s" >$*-t.xpm + $(AM_V_at) mv -f $*-t.xpm $@ + +GENERIC_V = $(GENERIC_V_@AM_V@) +GENERIC_V_ = $(GENERIC_V_@AM_DEFAULT_V@) +GENERIC_V_0 = @printf '%2.0s%$(DX_ALIGN_V)s %s\n' + +data/rr16x16.gen: data/rr16x16.xpm +data/rr24x24.gen: data/rr24x24.xpm +data/rr32x32.gen: data/rr32x32.xpm +data/rr48x48.gen: data/rr48x48.xpm +$(PNGICONS:.png=.gen): + $(GENERIC_V) : 'GENDIST ' $*.png; $(MKDIR_P) $(@D) if USE_NETPBM - $(AM_V_at) $(XPMTOPPM) $*.xpm | $(PNMTOPNG) >$*-t.png -else -if USE_CONVERT - $(AM_V_at) $(CONVERT) $*.xpm $*-t.png + $(AM_V_at) $(XPMTOPPM) $? | $(PNMTOPNG) >$*-t.png endif +if USE_CONVERT + $(AM_V_at) $(CONVERT) $? $*-t.png endif $(AM_V_at) $(OPTIPNG) -o7 -quiet $*-t.png $(AM_V_at) mv -f $*-t.png $*.png -MOSTLYCLEANFILES += $(GENICONS:.png=-t.png) -DISTCLEANFILES += $(GENICONS:.png=.xpm) -MAINTAINERCLEANFILES += $(GENICONS) -SUFFIXES = .gen - -GENICONS = data/rr48x48.png data/rr32x32.png data/rr24x24.png data/rr16x16.png -$(GENICONS): ; - -build-icons: t/ewmhicon$(EXEEXT) $(GENICONS) - $(AM_V_at) set x $(GENICONS:.png=); shift; for f; do shift; \ - test -f "$$f.png" || test -f "$(srcdir)/$$f.png" || \ - { set x "$$@" "$$f.gen"; shift; }; \ - done; $(MAKE) $(AM_MAKEFLAGS) "$$@" +.PHONY: $(PNGICONS:.png=.gen) + +build-icons: + $(AM_V_at) list=; \ + for i in $(PNGICONS:.png=); do \ + test -f $$i.png || test -f $(srcdir)/$$i.png \ + || list="$$list $$i.gen"; \ + done; \ + test x"$$list" = x || $(MAKE) $(AM_MAKEFLAGS) $$list .PHONY: build-icons dist-hook: dist-icons dist-icons: build-icons $(MKDIR_P) $(distdir)/data - for f in $(GENICONS); do \ + for f in $(PNGICONS); do \ if test -f "$$f"; \ then cp "$$f" "$(distdir)/data" || exit; \ else cp "$(srcdir)/$$f" "$(distdir)/data" || exit; \ -- 2.43.2