On Fri, Mar 13, 2020 at 02:59:46PM +0100, Daniel Kiper wrote: > Patrick, please make Argon2 functionality enabled/disabled by the > ./configure. By default it have to be disabled. Additionally, please add > to the grub-dev.texi an explanation what is the impact of enabling Argon2. Is there any obvious way to conditionally build modules and libs into the kernel based on a feature flag? The only way I see it to be doable is by re-using groups as known by gentpl.py, so that I may do the following: # Makefile.util.def library = { name = libgrubkern.a; cflags = '$(CFLAGS_GNULIB)'; cppflags = '$(CPPFLAGS_GNULIB) -I$(srcdir)/grub-core/lib/json'; argon2_cppflags = '$(CPPFLAGS_GNULIB) -I$(srcdir)/grub-core/lib/json -I$(srcdir)/grub-core/lib/argon2'; common = util/misc.c; common = grub-core/kern/command.c; common = grub-core/kern/device.c; ... argon2 = grub-core/lib/argon2/argon2.c; argon2 = grub-core/lib/argon2/core.c; argon2 = grub-core/lib/argon2/ref.c; argon2 = grub-core/lib/argon2/blake2/blake2b.c; }; # grub-core/Makefile.core.def module = { name = argon2; common = lib/argon2/argon2.c; common = lib/argon2/core.c; common = lib/argon2/ref.c; common = lib/argon2/blake2/blake2b.c; enable = argon2; }; module = { name = luks2; common = disk/luks2.c; common = lib/gnulib/base64.c; cflags = '$(CFLAGS_POSIX) $(CFLAGS_GNULIB)'; cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB) -I$(srcdir)/lib/json'; argon2_cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB) -I$(srcdir)/lib/json -I$(srcdir)/lib/argon2'; }; I don't think that gentpl.py is currently able to act based on configure options, but only decides by build platforms. Please let me know I'm missing the bigger picture here, and if there's any module that already does that kind of stuff that'd be a great help. Patrick