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

Re: [Minios-devel] [UNIKRAFT PATCH] build: Define preprocessing symbol for library name



Hey Costin,

my two cents to this patch: I remember a similar case that we had in lib/ukdebug: A header is exposing different definitions depending if it is included from within the library or externally. For this purpose, we add the define as library-local flag within its Makefile.uk instead:

   LIBUKDEBUG_CFLAGS-y   += -D__IN_LIBUKDEBUG__

Each library that needs something similar could solve the issue the same way (like lwip). The building blocks are already there. I think this is a more conservative and maybe also safer approach. Less flags are set automatically by the build system which may prevent us from conflicts at later points.

Thanks,

Simon

On 02.08.19 14:47, Costin Lupu wrote:
We define preprocessing symbols for library name in order to be able to protect
code based on the library name using #ifdef preprocessing directives (e.g.
"#ifdef __liblwip__"). The current solution also replaces dashes with
underscores given that we might have library names containing dashes (e.g.
for "pthread-embedded" library).

Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
  support/build/Makefile.rules | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/support/build/Makefile.rules b/support/build/Makefile.rules
index d90807e0..9666ead0 100644
--- a/support/build/Makefile.rules
+++ b/support/build/Makefile.rules
@@ -386,7 +386,7 @@ $(3): $(2) | prepare
                       $($(call vprefix_lib,$(1),CINCLUDES)) $($(call 
vprefix_lib,$(1),CINCLUDES-y)) \
                       $(CFLAGS) $(CFLAGS-y) \
                       $($(call vprefix_lib,$(1),CFLAGS)) $($(call 
vprefix_lib,$(1),CFLAGS-y)) \
-                      $(4) -D__LIBNAME__=$(1) -D__BASENAME__=$(notdir $(2)) \
+                      $(4) -D__LIBNAME__=$(1) -D__BASENAME__=$(notdir $(2)) 
-D__$(subst -,_,$(1))__ \
                       -c $(2) -o $(3) $(depflags)
  )

_______________________________________________
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®.