Subject: Re: [PATCH v2 07/12] fsmonitor: prepare to share code between Mac OS and Linux

From: Junio C Hamano <[email-masked]>
Date: Mon, 17 Oct 2022 23:31:16 -0700

Eric DeCosta <[email-masked]> writes:

>> Ugly.
>> 
>> One overrides backend with common, while the other one doesn't.
>> That asymmetry alone should stop us and wonder if there is something fishy
>> in the approach that can be improved.  It makes it look like the word
>> "common" means something quite different between the -ipc and the -
>> settings world.
>> 
>> I suspect that in both, you should not expose "unix" to this part of the
>> Makefile.  Linux and macOS occasionally being similar in some places does
>> not have to be exposed here.  INstead you can use backend "linux" and
>> "macos", whose C sources may include from a separate C source file whose
>> name may contain "unix".  That would allow you to get rid of
>> FSMONITOR_DAEMON_COMMON in a cleaner way.
>
> Let me see if I am understanding you correctly. Are you suggesting something like:

Not really.

What I had in mind was an arrangement more like

    $ for variant in linux macos; do grep include fsm-ipc-$variant.c; done
    #include "fsm-ipc-common-unix.cinclude"
    #include "fsm-ipc-common-unix.cinclude"

and COMPAT_OBJS knowning only about fsm-ipc-linux.o or
fsm-ipc-macos.o, depending on which platform you are building.