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

[Minios-devel] [UNIKRAFT PATCH] build/rules: M4 macro processor support



Adds a pre-processing rule generator for M4 macro processor
files (`.m4` extension).

Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
 Makefile                     |  1 +
 Makefile.uk                  |  2 ++
 support/build/Makefile.rules | 19 ++++++++++++++++++-
 3 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index f0d1ad47..5846a772 100644
--- a/Makefile
+++ b/Makefile
@@ -440,6 +440,7 @@ READELF             := $(CONFIG_CROSS_COMPILE)readelf
 STRIP          := $(CONFIG_CROSS_COMPILE)strip
 OBJCOPY                := $(CONFIG_CROSS_COMPILE)objcopy
 OBJDUMP                := $(CONFIG_CROSS_COMPILE)objdump
+M4             := m4
 AR             := ar
 CAT            := cat
 SED            := sed
diff --git a/Makefile.uk b/Makefile.uk
index c7a08fb0..50dff8d2 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -62,6 +62,8 @@ CFLAGS   += -DUK_FULLVERSION=$(UK_FULLVERSION)
 CXXFLAGS += -D __Unikraft__ -DUK_CODENAME="$(UK_CODENAME)"
 CXXFLAGS += -DUK_VERSION=$(UK_VERSION).$(UK_SUBVERSION)
 CXXFLAGS += -DUK_FULLVERSION=$(UK_FULLVERSION)
+M4FLAGS  += -D __Unikraft__ -DUK_CODENAME="$(UK_CODENAME)"
+M4FLAGS  += -DUK_VERSION=$(UK_VERSION).$(UK_SUBVERSION)
 
 # If GCC supports "-no-pie" flag, we will add this flag to link flags to
 # override "pie" option, because some distributions will set
diff --git a/support/build/Makefile.rules b/support/build/Makefile.rules
index 8579cf7d..3de13b66 100644
--- a/support/build/Makefile.rules
+++ b/support/build/Makefile.rules
@@ -462,12 +462,29 @@ endef
 #
 # preprule_* $libname,$source,$preptarget,$extraflags(optional)
 
+define preprule_m4 =
+$(3): $(2) | prepare
+       $(call build_cmd,M4,$(1),$(3),\
+               $(M4)  $(M4INCLUDES) $(M4INCLUDES-y) \
+                      $($(call vprefix_lib,$(1),M4INCLUDES)) $($(call 
vprefix_lib,$(1),M4INCLUDES-y)) \
+                      $(M4FLAGS) $(M4FLAGS-y) \
+                      $($(call vprefix_lib,$(1),M4FLAGS)) $($(call 
vprefix_lib,$(1),M4FLAGS-y)) \
+                      $(4) \
+                      $(2) > $(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
 #
 # preprule $libname,$source,$preptarget,$extraflags(optional)
 define preprule =
-$(error $(3): missing pre-processing rule for source type $(suffix $(2)))
+$(if $(filter %.m4   ,$(2)),$(call preprule_m4 ,$(1),$(2),$(3),$(4)),\
+$(error $(3): missing pre-processing rule for source type $(suffix $(2))) \
+)
 endef
 
 
-- 
2.20.1


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

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