utzig / lm4tools

Tools to enable multi-platform development on the TI Stellaris Launchpad boards
203 stars 46 forks source link

Added OS X support to the Makefile #21

Closed timothybrown closed 8 years ago

timothybrown commented 9 years ago

Changed CFLAGS and LDFLAGS to find libusb-1.0 as installed by Homebrew. The existing Linux flags are used if OS != Darwin. With these changes it compiles with a simple make command and I was able to upload a .bin file to my TM4C129x LaunchPad.

karlp commented 9 years ago

Looks good to me, but perhaps the CC?=gcc/clang should just be dropped entirely?

utzig commented 9 years ago

I do most development on OS X and had no problems building. Aren't you missing pkg-config installation on homebrew?

timothybrown commented 9 years ago

@utzig You’re right, I actually don’t have pkg-config installed on this system, but after installing it, I’m still getting a linker error. (Tried it on a fresh VM install of 10.10 with the latest Xcode, command line tools and Homebrew installed. I’ll investigate this further.) While it simply worked with my Makefile changes. Personally, I think it’s simpler this way as it works out of the box, but up to you.

@karlp I agree. It’s an edge case for sure, as I’ve never seen a system that didn’t have cc symlinked to gcc or whatever. The only reason I changed it in the first place was because I know some people have GCC installed side-by-side with clang. I think for those users they can easily just pass the correct compiler via the command line.

utzig commented 9 years ago

The pkg-config files are symlinked under /usr/local/lib/pkgconfig. Maybe you didn't have that directory in the first place when you installed all your other packages. Also you can't assume paths based on the fact the a user is running OS X. If you used Macports, Fink, pkgsrc to manage your packages, your libusb would not be at the same path.