[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [UNIKRAFT PATCH 4/7] build: Pre-processing rule for AWK progfiles


  • To: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
  • From: Vlad-Andrei BĂDOIU <vlad_andrei.badoiu@xxxxxx>
  • Date: Mon, 19 Apr 2021 13:05:53 +0300 (EEST)
  • Cc: minios-devel <minios-devel@xxxxxxxxxxxxx>
  • Delivery-date: Mon, 19 Apr 2021 10:05:59 +0000
  • Dkim-filter: OpenDKIM Filter v2.10.3 mx.upb.ro 7E8A1B5600B2
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>
  • Thread-index: xWtImWh53SnMAr2IdDTU/Bp11WJc7g==
  • Thread-topic: build: Pre-processing rule for AWK progfiles

Reviewed-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@xxxxxx>

----- Original Message -----
From: "Simon Kuenzer" <simon.kuenzer@xxxxxxxxx>
To: "minios-devel" <minios-devel@xxxxxxxxxxxxx>
Cc: "Simon Kuenzer" <simon.kuenzer@xxxxxxxxx>
Sent: Friday, December 18, 2020 8:09:21 PM
Subject: [UNIKRAFT PATCH 4/7] build: Pre-processing rule for AWK progfiles

Introduces an AWK pre-processing rule as another way for generating source
files based on AWK progfiles. One intention of this is to simplify
`Makefile.uk` of `lib/syscall_shim`.
The source file is treated as the AWK progfile which will be executed over
given includes (`AWKINCLUDES[-y]`). Because global flags and includes
would not be meaningful for AWK rules, we support only library-local and
file-local scopes.

Example of compiling `uk_syscall6.o` from `uk_syscall6.awk`
in `lib/syscall_shim`:
 LIBSYSCALL_SHIM_SRCS += $(LIBSYSCALL_SHIM_BASE)/gen_uk_syscall6.awk>.c
 LIBSYSCALL_SHIM_GEN_UK_SYSCALL6_AWKFLAGS    += -F '-'
 LIBSYSCALL_SHIM_GEN_UK_SYSCALL6_AWKINCLUDES += 
$(LIBSYSCALL_SHIM_BUILD)/provided_syscalls.h.in

Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
 support/build/Makefile.rules | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/support/build/Makefile.rules b/support/build/Makefile.rules
index 6a8c2099..e1c078c3 100644
--- a/support/build/Makefile.rules
+++ b/support/build/Makefile.rules
@@ -634,6 +634,30 @@ UK_SRCS-y += $(2)
 $(eval $(call vprefix_lib,$(1),CLEAN-y) += $(call build_clean,$(3)))
 endef
 
+# Pre-processing rule for awk progs
+# NOTES:
+#  $source is the awk progfile and AWKINCLUDES specify the input files to
+#  process. There are no global scopes for AWKINCLUDES and AWKFLAGS available
+#  because it would not be meaningful.
+define preprule_awk =
+$(3): $(2) \
+      $$($(call vprefix_lib,$(1),AWKINCLUDES)) $$($(call 
vprefix_lib,$(1),AWKINCLUDES-y)) \
+      $$($(call vprefix_src,$(1),$(2),,AWKINCLUDES)) $$($(call 
vprefix_src,$(1),$(2),,AWKINCLUDES-y)) \
+      | prepare
+       $(call build_cmd,AWK,$(1),$(3),\
+               $(AWK) -f $(2) \
+                      $$($(call vprefix_lib,$(1),AWKFLAGS)) $$($(call 
vprefix_lib,$(1),AWKFLAGS-y)) \
+                      $$($(call vprefix_src,$(1),$(2),,AWKFLAGS)) $$($(call 
vprefix_src,$(1),$(2),,AWKFLAGS-y)) \
+                      $(4) \
+                      $$($(call vprefix_lib,$(1),AWKINCLUDES)) $$($(call 
vprefix_lib,$(1),AWKINCLUDES-y)) \
+                      $$($(call vprefix_src,$(1),$(2),,AWKINCLUDES)) $$($(call 
vprefix_src,$(1),$(2),,AWKINCLUDES-y)) \
+                      > $(3)
+       )
+
+UK_SRCS-y += $(2)
+$(eval $(call vprefix_lib,$(1),CLEAN-y) += $(call build_clean,$(3)))
+endef
+
 # wrapper for preprule_*,
 # selects appropriate pre-process rule depending on file extension
 # if there is no such pre-process rule available, we throw an error.
-- 
2.20.1



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.