[PATCH] Makefile: Consolidate gnuefi compilation rules

3 views
Skip to first unread message

Jan Kiszka

unread,
Nov 12, 2021, 11:23:18 AM11/12/21
to efibootguard-dev
From: Jan Kiszka <jan.k...@siemens.com>

Using a macro saves several identically repeated lines.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
Makefile.am | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index f278593..8babc2c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -224,21 +224,22 @@ efibootguard_DATA = $(efi_loadername)
CLEANFILES += $(efi_objects) $(efi_solib) $(efi_loadername)
EXTRA_DIST += $(efi_sources)

+define gnuefi_compile
+ $(AM_V_CC) $(MKDIR_P) $(shell dirname $@)/; \
+ $(GNUEFI_CC) $(efi_cppflags) $(efi_cflags) -c $< -o $@
+endef
+
$(top_builddir)/%.o: $(top_srcdir)/%.c
- @$(MKDIR_P) $(shell dirname $@)/
- $(AM_V_CC)$(GNUEFI_CC) $(efi_cppflags) $(efi_cflags) -c $< -o $@
+ $(call gnuefi_compile)

$(top_builddir)/env/%.o: $(top_srcdir)/env/%.c
- @$(MKDIR_P) $(shell dirname $@)/
- $(AM_V_CC)$(GNUEFI_CC) $(efi_cppflags) $(efi_cflags) -c $< -o $@
+ $(call gnuefi_compile)

$(top_builddir)/drivers/watchdog/%.o: $(top_srcdir)/drivers/watchdog/%.c
- @$(MKDIR_P) $(shell dirname $@)/
- $(AM_V_CC)$(GNUEFI_CC) $(efi_cppflags) $(efi_cflags) -c $< -o $@
+ $(call gnuefi_compile)

$(top_builddir)/drivers/watchdog/%.o: $(top_srcdir)/drivers/watchdog/%.S
- @$(MKDIR_P) $(shell dirname $@)/
- $(AM_V_CC)$(GNUEFI_CC) $(efi_cppflags) $(efi_cflags) -c $< -o $@
+ $(call gnuefi_compile)

$(top_builddir)/main.o: $(GEN_VERSION_H)

--
2.31.1
Reply all
Reply to author
Forward
0 new messages