Re: [PATCH] Makefile: replace most hardcoded object lists with $(wildcard)
- From
Paul Smith <paul@mad-scientist.net>
- Date
- Oct 30, 2021, 23:15 UTC
- Message-ID
- <f5807fd2eb0c16ab0400e8f3138a90f564fd303c.camel@mad-scientist.net>
- In-Reply-To
- <patch-1.1-bbacbed5c95-20211030T223011Z-avarab@gmail.com>
On Sun, 2021-10-31 at 00:32 +0200, Ævar Arnfjörð Bjarmason wrote:
> +LIB_OBJS += $(patsubst %.c,%.o,$(foreach dir,$(LIB_OBJS_DIRS),$(wildcard $(dir)/*.c)))
Another way to write this would be:
LIB_OBJS += $(patsubst %.c,%.o,$(wildcard $(addsuffix /*.c,$(LIB_OBJS_DIRS)))
I don't know that there's any reason to choose one over the other. I don't think there's any real performance difference although one could imagine this version to be VERY SLIGHTLY faster. Also this one is a little more "Lisp-ish"... that might be a pro or a con depending :).
Just kibitzing while waiting for dinner to arrive...