On 2023-07-16 15:58, Alejandro Colomar wrote:
Wow!  That's a great help for debugging the Linux man-pages's makefiles,
which don't need to be remade.  It was very painful to me to ignore so
much make -d output.  I applied the following patch, and it works like
a charm.

<https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/?id=c98d237c22e9e898ae7d05e2222e7eac47791bd3>

Why are you wasting time doing grep when you can have find return just those files that ends with .mk? Also, why need to sort the list when it's only for make to define a rule?

I would have done something along these lines if I were in your shoes:

MK := $(srcdir)/Makefile
MK += $(shell $(FIND) $(MAKEFILEDIR) -type f -name '*.mk')


Or, a more cleaner solution would have been to define the MK-array in the $(srcdir)/Makefile as you have it hard coded for the include statements now.

MK :=                           \
$(MAKEFILEDIR)/check/_.mk       \
$(MAKEFILEDIR)/check/catman.mk  \
$(MAKEFILEDIR)/build/_.mk       \
$(MAKEFILEDIR)/build/catman.mk  \
$(MAKEFILEDIR)/build/html.mk    \
$(MAKEFILEDIR)/build/pdf.mk     \
$(MAKEFILEDIR)/build/pre.mk     \
$(MAKEFILEDIR)/build/ps.mk      \
$(MAKEFILEDIR)/build/src.mk     \
$(MAKEFILEDIR)/dist.mk          \
$(MAKEFILEDIR)/install/_.mk     \
$(MAKEFILEDIR)/install/html.mk  \
$(MAKEFILEDIR)/install/man.mk   \
$(MAKEFILEDIR)/lint/_.mk        \
$(MAKEFILEDIR)/lint/c.mk        \
$(MAKEFILEDIR)/lint/man/_.mk    \
$(MAKEFILEDIR)/lint/man/man.mk  \
$(MAKEFILEDIR)/lint/man/mdoc.mk \
$(MAKEFILEDIR)/make.mk          \
$(MAKEFILEDIR)/verbose.mk

include $(MK)
$(srcdir)/Makefile $(MK):: ;


Kind regards,
Torbjörn

Reply via email to