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

[UNIKRAFT PATCH 5/7] build: Introduce pre-processing build stage (`preprocess`)



Introduces the pre-process build stage which is executed after
`prepare` and before compiling object files. This is done in
order to let header files be generated later.

Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
 Makefile                     |  9 ++++++++-
 support/build/Makefile.rules | 18 ++++++++++--------
 2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/Makefile b/Makefile
index 76145d27..63e42067 100644
--- a/Makefile
+++ b/Makefile
@@ -278,6 +278,8 @@ UK_FETCH:=
 UK_FETCH-y:=
 UK_PREPARE:=
 UK_PREPARE-y:=
+UK_PREPROCESS:=
+UK_PREPROCESS-y:=
 UK_PLATS:=
 UK_PLATS-y:=
 UK_LIBS:=
@@ -652,7 +654,7 @@ endif
 # include Makefile for platform linking (`Linker.uk`)
 $(foreach plat,$(UK_PLATS),$(eval $(call _import_linker,$(plat))))
 
-.PHONY: prepare image libs objs clean
+.PHONY: prepare preprocess image libs objs clean
 
 fetch: $(UK_FETCH) $(UK_FETCH-y)
 
@@ -665,6 +667,8 @@ $(UK_CONFIG_OUT): $(UK_CONFIG)
 prepare: $(KCONFIG_AUTOHEADER) $(UK_CONFIG_OUT) $(UK_PREPARE) $(UK_PREPARE-y)
 prepare: $(UK_FIXDEP) | fetch
 
+preprocess: $(UK_PREPROCESS) $(UK_PREPROCESS-y) | prepare
+
 objs: $(UK_OBJS) $(UK_OBJS-y)
 
 libs: $(UK_ALIBS) $(UK_ALIBS-y) $(UK_OLIBS) $(UK_OLIBS-y)
@@ -719,6 +723,8 @@ fetch: ukconfig
 
 prepare: ukconfig
 
+preprocess: ukconfig
+
 objs: ukconfig
 
 libs: ukconfig
@@ -991,6 +997,7 @@ help:
        @echo '  libs                   - build libraries and objects'
        @echo '  [LIBNAME]              - build a single library'
        @echo '  objs                   - build objects only'
+       @echo '  preprocess             - run preprocessing steps'
        @echo '  prepare                - run preparation steps'
        @echo '  fetch                  - fetch, extract, and patch remote code'
        @echo ''
diff --git a/support/build/Makefile.rules b/support/build/Makefile.rules
index e1c078c3..1797d134 100644
--- a/support/build/Makefile.rules
+++ b/support/build/Makefile.rules
@@ -390,7 +390,7 @@ endef
 # buildrule_* $libname,$source,$variant,$target,$extraflags
 
 define buildrule_S_ =
-$(4): $(2) | prepare
+$(4): $(2) | preprocess
        $(call build_cmd_fixdep,AS,$(1),$(4),\
                $(AS)  $$(COMPFLAGS) $$(COMPFLAGS-y) \
                       $$($(call vprefix_lib,$(1),COMPFLAGS)) $$($(call 
vprefix_lib,$(1),COMPFLAGS-y)) \
@@ -417,7 +417,7 @@ endef
 buildrule_sx = $(call buildrule_S_,$(1),$(2),$(3),$(4))
 
 define buildrule_s =
-$(4): $(2) | prepare
+$(4): $(2) | preprocess
        $(call build_cmd,AS,$(1),$(4),\
                $(AS)  $$(COMPFLAGS) $$(COMPFLAGS-y) \
                       $$($(call vprefix_lib,$(1),COMPFLAGS)) $$($(call 
vprefix_lib,$(1),COMPFLAGS-y)) \
@@ -442,7 +442,7 @@ $(eval $(call vprefix_lib,$(1),CLEAN-y) += $(call 
build_clean,$(4)) $(call out2d
 endef
 
 define buildrule_c =
-$(4): $(2) | prepare
+$(4): $(2) | preprocess
        $(call build_cmd_fixdep,CC,$(1),$(4),\
                $(CC)  $$(COMPFLAGS) $$(COMPFLAGS-y) \
                       $$($(call vprefix_lib,$(1),COMPFLAGS)) $$($(call 
vprefix_lib,$(1),COMPFLAGS-y)) \
@@ -467,7 +467,7 @@ $(eval $(call vprefix_lib,$(1),CLEAN-y) += $(call 
build_clean,$(4)) $(call out2d
 endef
 
 define buildrule_cxx =
-$(4): $(2) | prepare
+$(4): $(2) | preprocess
        $(call build_cmd_fixdep,CXX,$(1),$(4),\
                $(CXX) $$(COMPFLAGS) $$(COMPFLAGS-y) \
                       $$(CXXINCLUDES) $$(CXXINCLUDES-y) \
@@ -499,7 +499,7 @@ buildrule_C   = $(call buildrule_cxx,$(1),$(2),$(3),$(4))
 buildrule_c$(plus)$(plus) = $(call buildrule_cxx,$(1),$(2),$(3),$(4))
 
 define buildrule_go =
-$(4): $(2) | prepare
+$(4): $(2) | preprocess
        $(call build_cmd,GOC,$(1),$(4),\
                $(GOC) $$(COMPFLAGS) $$(COMPFLAGS-y) \
                       $$(GOCINCLUDES) $$(GOCINCLUDES-y) \
@@ -531,7 +531,7 @@ $(eval EXTRA_LD_SCRIPT-y += $(1))
 endef
 
 define buildrule_S_lds =
-$(4): $(2) | prepare
+$(4): $(2) | preprocess
        $(call build_cmd_fixdep,LDS,$(1),$(4),\
                $(AS)  -E -P -x assembler-with-cpp $$(COMPFLAGS) 
$$(COMPFLAGS-y) \
                       $$(ASINCLUDES) $$(ASINCLUDES-y) \
@@ -569,7 +569,7 @@ endef
 
 ## Add the linker file to the common variable used for linker script
 define buildrule_ld  =
-$(2): | prepare
+$(2): | preprocess
 
 $(eval $(call vprefix_lib,$(1),LDS-y) += $(2))
 
@@ -583,7 +583,7 @@ $(if $(strip $($(call uc,$(1))_PLATS)),\
 endef
 
 define buildrule_dts =
-$(4) : $(2) | prepare
+$(4) : $(2) | preprocess
        $(call build_cmd,DTC,$(1),$(4),\
               $(DTC) -I dts -O dtb -o $$(@) $$(<)\
        )
@@ -631,6 +631,7 @@ $(3): $(2) | prepare
        )
 
 UK_SRCS-y += $(2)
+UK_PREPROCESS-y += $(3)
 $(eval $(call vprefix_lib,$(1),CLEAN-y) += $(call build_clean,$(3)))
 endef
 
@@ -655,6 +656,7 @@ $(3): $(2) \
        )
 
 UK_SRCS-y += $(2)
+UK_PREPROCESS-y += $(3)
 $(eval $(call vprefix_lib,$(1),CLEAN-y) += $(call build_clean,$(3)))
 endef
 
-- 
2.20.1



 


Rackspace

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