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

[UNIKRAFT/LIBP11-KIT 3/3] Add Makefile.uk with the build logic



The makefile uses the build system of the library (meson + ninja)
first to generate the object files in such a way that they compile
successfully. Afterwards they are linked with the object files from
unikraft.
Test object files can be added by making 'TESTS' 'YES' in menuconfig.

The only problem of this approach is that meson checks the system
first for available functions, components, etc. Because of this,
it checks the host system, not the future guest OS.

Signed-off-by: Cezar Craciunoiu <cezar.craciunoiu@xxxxxxxxx>
---
 Makefile.uk | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 123 insertions(+)
 create mode 100644 Makefile.uk

diff --git a/Makefile.uk b/Makefile.uk
new file mode 100644
index 0000000..9e26177
--- /dev/null
+++ b/Makefile.uk
@@ -0,0 +1,123 @@
+#  libp11kit Makefile.uk
+#
+#  Authors: Cezar Craciunoiu <cezar.craciunoiu@xxxxxxxxx>
+#
+#  Copyright (c) 2020, Politehnica University of Bucharest. All rights 
reserved.
+#
+#  Redistribution and use in source and binary forms, with or without
+#  modification, are permitted provided that the following conditions
+#  are met:
+#
+#  1. Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#  2. Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+#  3. Neither the name of the copyright holder nor the names of its
+#     contributors may be used to endorse or promote products derived from
+#     this software without specific prior written permission.
+#
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+#  POSSIBILITY OF SUCH DAMAGE.
+#
+#  THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
+#
+
+################################################################################
+# Library registration
+################################################################################
+$(eval $(call addlib_s,libp11kit,$(CONFIG_LIBP11KIT)))
+
+################################################################################
+# Sources
+################################################################################
+LIBP11KIT_VER=0.23.21
+LIBP11KIT_URL=https://github.com/p11-glue/p11-kit/archive/$(LIBP11KIT_VER).zip
+$(eval $(call fetch,libp11kit,$(LIBP11KIT_URL)))
+
+################################################################################
+# Helpers
+################################################################################
+LIBP11KIT_PATH=$(LIBP11KIT_ORIGIN)/p11-kit-$(LIBP11KIT_VER)
+LIBP11KIT_BUILD_PATH=$(LIBP11KIT_PATH)/_build
+LIBP11KIT_COMM_BUILD_PATH=$(LIBP11KIT_BUILD_PATH)/common/92a5dc0@@p11-common@sta
+LIBP11KIT_P11_BUILD_PATH=$(LIBP11KIT_BUILD_PATH)/p11-kit/077403d@@p11-kit@sha
+LIBP11KIT_COMM_TESTS_PATH=$(LIBP11KIT_BUILD_PATH)/common/92a5dc0@@p11-test@sta
+
+################################################################################
+# Library includes
+################################################################################
+LIBP11KIT_COMM_INCLUDES-y += -I$(LIBP11KIT_PATH)
+CXXINCLUDES-$(CONFIG_LIBP11KIT) += -I$(LIBP11KIT_PATH)
+CINCLUDES-$(CONFIG_LIBP11KIT) += -I$(LIBP11KIT_PATH)
+
+LIBP11KIT_CINCLUDES += -I$(LIBP11KIT_PATH)
+LIBP11KIT_CXXINCLUDES += -I$(LIBP11KIT_PATH)
+
+################################################################################
+# Global flags
+################################################################################
+LIBP11KIT_SUPPRESS_FLAGS += -Wno-unused-parameter \
+       -Wno-unused-variable -Wno-unused-value -Wno-unused-function \
+       -Wno-missing-field-initializers -Wno-implicit-fallthrough
+LIBP11KIT_CFLAGS-y += $(LIBP11KIT_SUPPRESS_FLAGS) \
+       -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast
+LIBP11KIT_CXXFLAGS-y += $(LIBP11KIT_SUPPRESS_FLAGS)
+
+################################################################################
+# Library sources
+################################################################################
+UK_ALIBS-y += $(LIBP11KIT_BUILD_PATH)/p11-kit/libp11-kit-internal.a
+UK_ALIBS-y += $(LIBP11KIT_BUILD_PATH)/common/libp11-library.a
+
+LIBP11KIT_SRCS-y += $(LIBP11KIT_BASE)/glue.c
+
+UK_OLIBS-y += $(LIBP11KIT_P11_BUILD_PATH)/iter.c.o
+UK_OLIBS-y += $(LIBP11KIT_P11_BUILD_PATH)/messages.c.o
+UK_OLIBS-y += $(LIBP11KIT_P11_BUILD_PATH)/modules.c.o
+UK_OLIBS-y += $(LIBP11KIT_P11_BUILD_PATH)/pin.c.o
+UK_OLIBS-y += $(LIBP11KIT_P11_BUILD_PATH)/proxy.c.o
+UK_OLIBS-y += $(LIBP11KIT_P11_BUILD_PATH)/proxy-init.c.o
+UK_OLIBS-y += $(LIBP11KIT_P11_BUILD_PATH)/rpc-server.c.o
+UK_OLIBS-y += $(LIBP11KIT_P11_BUILD_PATH)/uri.c.o
+UK_OLIBS-y += $(LIBP11KIT_P11_BUILD_PATH)/util.c.o
+
+UK_OLIBS-y += $(LIBP11KIT_COMM_BUILD_PATH)/argv.c.o
+UK_OLIBS-y += $(LIBP11KIT_COMM_BUILD_PATH)/attrs.c.o
+UK_OLIBS-y += $(LIBP11KIT_COMM_BUILD_PATH)/debug.c.o
+UK_OLIBS-y += $(LIBP11KIT_COMM_BUILD_PATH)/hash.c.o
+UK_OLIBS-y += $(LIBP11KIT_COMM_BUILD_PATH)/message.c.o
+UK_OLIBS-y += $(LIBP11KIT_COMM_BUILD_PATH)/runtime.c.o
+UK_OLIBS-y += $(LIBP11KIT_COMM_BUILD_PATH)/vsock.c.o
+UK_OLIBS-y += $(LIBP11KIT_COMM_BUILD_PATH)/array.c.o
+UK_OLIBS-y += $(LIBP11KIT_COMM_BUILD_PATH)/buffer.c.o
+UK_OLIBS-y += $(LIBP11KIT_COMM_BUILD_PATH)/constants.c.o
+UK_OLIBS-y += $(LIBP11KIT_COMM_BUILD_PATH)/dict.c.o
+UK_OLIBS-y += $(LIBP11KIT_COMM_BUILD_PATH)/lexer.c.o
+UK_OLIBS-y += $(LIBP11KIT_COMM_BUILD_PATH)/path.c.o
+UK_OLIBS-y += $(LIBP11KIT_COMM_BUILD_PATH)/url.c.o
+
+ifdef CONFIG_TESTS_ACTIVATED
+UK_OLIBS-y += $(LIBP11KIT_COMM_TESTS_PATH)/mock.c.o
+UK_OLIBS-y += $(LIBP11KIT_COMM_TESTS_PATH)/test.c.o
+endif
+
+################################################################################
+# P11-kit prepare
+################################################################################
+# Use the native build system to generate the object files, then link them
+
+$(LIBP11KIT_BUILD)/.prepared: $(LIBP11KIT_BUILD)/.origin
+       $(call verbose_cmd,CONFIG,libsoldeploy: $(notdir $@), \
+       cd $(LIBP11KIT_PATH) && meson _build && ninja -C _build)
+
+UK_PREPARE-$(CONFIG_LIBP11KIT) += $(LIBP11KIT_BUILD)/.prepared
-- 
2.20.1




 


Rackspace

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