> On Nov 28, 2021, at 8:05 AM, Christos Zoulas <[email protected]> wrote: > > The change is correct; this is how it is done everywhere else in the tree. > You are right about -pthread doing more than adding -lpthread, but > in that case, the -pthread should be added to CFLAGS/COPTS etc, > not LDADD so that it is effective during the compilation phase too, > not just the link phase. When I made the change, I considered going > through the tree and adding -pthread to the CFLAGS/COPTS in the > Makefiles where -pthread is in LDADD, but I did not want to do a > half-assed job without thinking about it more: > > 1. which compilation flag should we add -pthread to? CFLAGS or > COPTS? What about c++?
GCC defines some preprocessor macros in response to -pthread, so … CPPFLAGS? Perhaps a better choice is to have a USE_PTHREADS that individual program / library Makefiles can set to YES to cause the right magic to happen in bsd.sys.mk? > 2. do we remove the LDADD/DPADD pthread settings? I am thinking > perhaps not, it does not hurt, plus the DPADD will cause a rebuild > when libpthread changes. That could be hidden away by the above suggestion. -- thorpej
