On Aug 5, 2022, at 17:45, Mark Brethen wrote: > Note that the pre-build approach is overriding the makefile cflags, makefile > was patched to cflags += , etc. How do I prevent this?
Setting variables like CFLAGS as arguments (e.g. build.args) overrides anything specified in the Makefile. That's the purpose of specifying them as args. If you don't want to override the Makefile, then specify them as environment variables instead (e.g. build.env). Note that *.args and *.env have different quoting rules. For *.args you would use e.g. build.args CFLAGS="foo bar baz" For *.env you would use e.g. build.env "CFLAGS=foo bar baz" You must also make sure that each environment variable is its own list item. In your portfile you're currently combining multiple different variables into a single string which isn't going to work for env. You'll want to use a list instead of a string. For example (untested): set args [list "CFLAGS=${cflags}" "FFLAGS=${fflags}" "LDFLAGS=${ldflags}"] build.args-append {*}${args}