New review comment by meator on void-packages repository https://github.com/void-linux/void-packages/pull/39583#discussion_r1065890177 Comment: > cmt's makefile defines CFLAGS and CXXFLAGS with `=` which completely overrides external variables as far as I can tell. When `$make_use_env` is unset, xbps-src [very explicitly](https://github.com/void-linux/void-packages/blob/master/common/build-style/gnu-makefile.sh#L7-L13) overrides all relevant variables set in the makefile. It doesn't matter what cmt's makefile wants to do, xbps-src will set it (unless it would be using the `override` keyword or other shenanigans but no one does that for `CFLAGS`). But as I said it would still omit `-fPIC` which is undesirable. > Using sed to stuff it with void's flags just because `-fPIC` is present there looks overcomplicated and unnecessary. > > In this case I can suggest the following (I forgot `vsed` must be used instead of `sed`): I agree that it looks overcomplicated. I think using sed in general isn't really fit for this situation. I'll make an actual patch that fixes this. While I'm at it I'll try to contact upstream about this. > > `-fPIC` could be added to `make_build_args` > > Based on my previous answer (I have had overlooked this flag for reasons unknown), I believe it should be left in the makefile since the fix above allows to use void's flags with those in the makefile together without that ugly hack. This is the best solution. Template files shouldn't be responsible for this. I have experience with writing makefiles. The absolute best solution is https://www.gnu.org/software/make/manual/make.html#Command-Variables or (my favorite) presume that `CFLAGS` and similar variables are user input and put mandatory flags right into the rule from the beginning like this: ```makefile a.o : a.c b.c $(CC) -c -fPIC --you-can't-override-me-when-I'm-hardcoded=true $(CFLAGS) $(CPPFLAGS) a.c b.c -o a.o ``` but it isn't xbps-src's responsibility to fix build system of other programs and both of these changes would require large patches so I'll make something simpler (probably just change `=` to `+=` but I'm not sure yet). I will propose one of the "correct" solutions to upstream.