I hope you'll be o.k. with me bringing this back to the list...
On Thu, 2015-12-17 at 23:57 +0100, katja wrote:
On Wed, Dec 16, 2015 at 5:57 PM, Roman Haefeli reduzent@gmail.com wrote: ...
ifeq ($(uname), MINGW) ldlibs = -lwsock32 endif
...
Without that clause, building fails on mingw-w64. Without the conditional, it breaks other platforms. I can't tell you why, but it works.
I wonder what makes it work because variable 'uname' should be empty at the point where you test it.
You're right (and I seem to have already forgotten what I actually did). Sorry for the confusion. Here is the full story. I was looking for a way to cross-compile for Windows on Linux using the pd-lib-builder Makefile. So I checked how the Makefile detects the platform and I forced the platform in order to be able to cross-compile by naively setting the desired destination platform like this:
$ make uname=MINGW CC=i686-w64-mingw32-gcc
And later when I encountered linking issues, I added a conditional that checks for a value that I set myself.
Actually, it's not uname that is set later in the Makefile (line 438), but uname is used to set the system variable to 'Windows'.
It seems to me that using the same platform detection mechanism as the Makefile would be a proper(er) way to add platform specific flags. Do you think it is a good idea to do something like that:
ifeq ($(findstring MINGW, $(uname)), MINGW) ldlibs = -lwsock32 endif
Can you run 'make vars' and check values of variables 'uname' and 'ldlibs'?
~/pd-src/mrpeach/osc$ make uname=MINGW CC=i686-w64-mingw32-gcc vars [...] variable ldlibs = -lwsock32 [...] variable system = Windows [...]
There is no variable 'uname', only 'system'.
I invite you to join the discussion on this particular topic here: https://github.com/pure-data/pd-lib-builder/issues/7.
Thanks for the hint. I'll do.
Roman