[haiku-development] Re: Services Kit Project Setup (was: Beta3 status update)

  • From: "Adrien Destugues" <pulkomandy@xxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Thu, 21 Jan 2021 17:12:01 +0000

I am trying to make this happen, but I am running into some build
system questions. I have moved the source files to their own
directory, and use the MergeObject rule to create an object that can
be linked into the existing libnetapi.so. I am also making a separate
libnetservices.a.

In order to not have any clashes, for libnetservices.a I want to put
the objects in their own namespace. In order not to duplicate the
code, I am putting the namespace guards in an #ifndef
LIBNETAPI_DEPRECATED block. I then want to build the libnetapi.so
merge object with LIBNETAPI_DEPRECATED defined, and the other without.
What would be the best way to build all the C++ files twice, without
creating two .o files in the same output directory (thus overwriting
the LIBNETAPI_DEPRECATED variant with the independent variant)?

You can decide where .o files go with MakeLocate. However, we usually don't
do that manually, instead, we use multiple jamfiles in different directories.

One example of this is the big-endian BFS code:
https://git.haiku-os.org/haiku/tree/src/add-ons/kernel/file_systems/bfs/JamCommon
https://git.haiku-os.org/haiku/tree/src/add-ons/kernel/file_systems/bfs_big/Jamfile

Key things to look for:

- How the directory is used to set the define (if $(SUBDIR:B) = bfs_big)
- How to search for the sources at the right place (SEARCH on [ FGristFiles 
$(bfsSources) ])

We use a similar approach to share some code between the kernel and the 
bootloader.

-- 
Adrien.


Other related posts: