Skip to content

Instantly share code, notes, and snippets.

@AhiyaHiya
Last active December 14, 2015 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AhiyaHiya/5105571 to your computer and use it in GitHub Desktop.
Save AhiyaHiya/5105571 to your computer and use it in GitHub Desktop.
FreeImage Makefile for Mac OS X. The original file came from https://gist.github.com/joonyou/1595931 , but I modified the file to work with the 10.10 SDK located within Xcode 6.3.2 running on Mac OS X 10.10
# -*- Makefile -*-
# Mac OSX makefile for FreeImage
# This file can be generated by ./gensrclist.sh
include Makefile.srcs
# General configuration variables:
CC_X86_64 = clang
CPP_X86_64 = clang++
COMPILERFLAGS = -Os -fexceptions -fvisibility=hidden -DNO_LCMS -D__ANSI__ -DDISABLE_PERF_MEASUREMENT
COMPILERFLAGS_X86_64 = -arch x86_64
COMPILERPPFLAGS = -Wno-ctor-dtor-privacy
MACOSX_10_10_SDK=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk
INCLUDE +=
INCLUDE_X86_64 = -isysroot $(MACOSX_10_10_SDK)
CFLAGS_X86_64 = $(COMPILERFLAGS) $(COMPILERFLAGS_X86_64) $(INCLUDE) $(INCLUDE_X86_64)
CPPFLAGS_X86_64 = $(COMPILERPPFLAGS) $(CFLAGS_X86_64)
LIBRARIES_X86_64 = -Wl,-syslibroot $(MACOSX_10_10_SDK)
LIBTOOL = libtool
LIPO = lipo
TARGET = freeimage
STATICLIB = lib$(TARGET).a
SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).$(VER_MINOR).dylib
LIBNAME = lib$(TARGET).$(VER_MAJOR).dylib
HEADER = Source/FreeImage.h
.SUFFIXES: .o-x86_64
MODULES_X86_64 = $(SRCS:.c=.o-x86_64)
MODULES_X86_64 := $(MODULES_X86_64:.cpp=.o-x86_64)
PREFIX = /usr/local
INSTALLDIR = $(PREFIX)/lib
INCDIR = $(PREFIX)/include
default: all
all: dist
dist: FreeImage
mkdir -p Dist
cp *.a Dist/
cp *.dylib Dist/
cp Source/FreeImage.h Dist/
FreeImage: $(STATICLIB) $(SHAREDLIB)
$(STATICLIB): $(STATICLIB)-x86_64
$(LIPO) -create $(STATICLIB)-x86_64 -output $(STATICLIB)
$(STATICLIB)-x86_64: $(MODULES_X86_64)
$(LIBTOOL) -arch_only x86_64 -o $@ $(MODULES_X86_64)
$(SHAREDLIB): $(SHAREDLIB)-x86_64
$(LIPO) -create $(SHAREDLIB)-x86_64 -output $(SHAREDLIB)
$(SHAREDLIB)-x86_64: $(MODULES_X86_64)
$(CPP_X86_64) -arch x86_64 -dynamiclib $(LIBRARIES_X86_64) -o $@ $(MODULES_X86_64)
.c.o-x86_64:
$(CC_X86_64) $(CFLAGS_X86_64) -c $< -o $@
.cpp.o-x86_64:
$(CPP_X86_64) $(CPPFLAGS_X86_64) -c $< -o $@
install:
install -d -m 755 -o root -g wheel $(INCDIR) $(INSTALLDIR)
install -m 644 -o root -g wheel $(HEADER) $(INCDIR)
install -m 644 -o root -g wheel $(SHAREDLIB) $(STATICLIB) $(INSTALLDIR)
ranlib -sf $(INSTALLDIR)/$(STATICLIB)
ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(LIBNAME)
clean:
rm -f core Dist/*.* u2dtmp* $(MODULES_X86_64) $(STATICLIB) $(SHAREDLIB) $(SHAREDLIB)-x86_64
@iamraafay
Copy link

Hey, can you get this modified for Mavericks?? I got sdk_root changes done but OpenEXR is still failing to find standard c functions.

I'd really appreciate your help here.

@AhiyaHiya
Copy link
Author

Maybe.

@AhiyaHiya
Copy link
Author

I had to actually use some tips listed at the end of this thread: http://sourceforge.net/p/freeimage/discussion/36110/thread/7e436844/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment