gltut / FreeImage / Makefile.osx

# -*- Makefile -*-
# Mac OSX makefile for FreeImage

# This file can be generated by ./gensrclist.sh
include Makefile.srcs

# General configuration variables:
CC_PPC = gcc-4.0
CC_I386 = gcc-4.0
CPP_PPC = g++-4.0
CPP_I386 = g++-4.0
COMPILERFLAGS = -Os -fexceptions -fvisibility=hidden -DNO_LCMS
COMPILERFLAGS_PPC = -arch ppc
COMPILERFLAGS_I386 = -arch i386
COMPILERPPFLAGS = -Wno-ctor-dtor-privacy
INCLUDE += 
INCLUDE_PPC = -isysroot /Developer/SDKs/MacOSX10.3.9.sdk
INCLUDE_I386 = -isysroot /Developer/SDKs/MacOSX10.4u.sdk
CFLAGS_PPC = $(COMPILERFLAGS) $(COMPILERFLAGS_PPC) $(INCLUDE) $(INCLUDE_PPC)
CFLAGS_I386 = $(COMPILERFLAGS) $(COMPILERFLAGS_I386) $(INCLUDE) $(INCLUDE_I386)
CPPFLAGS_PPC = $(COMPILERPPFLAGS) $(CFLAGS_PPC)
CPPFLAGS_I386 = $(COMPILERPPFLAGS) $(CFLAGS_I386)
LIBRARIES_PPC = -Wl
LIBRARIES_I386 = -Wl
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-ppc .o-i386
MODULES_PPC = $(SRCS:.c=.o-ppc)
MODULES_I386 = $(SRCS:.c=.o-i386)
MODULES_PPC := $(MODULES_PPC:.cpp=.o-ppc)
MODULES_I386 := $(MODULES_I386:.cpp=.o-i386)

PREFIX = /usr/local
INSTALLDIR = $(PREFIX)/lib
INCDIR = $(PREFIX)/include

default: all

all: dist

dist: FreeImage
	cp *.a Dist
	cp *.dylib Dist
	cp Source/FreeImage.h Dist

FreeImage: $(STATICLIB) $(SHAREDLIB)

$(STATICLIB): $(STATICLIB)-ppc $(STATICLIB)-i386
	$(LIPO) -create $(STATICLIB)-ppc $(STATICLIB)-i386 -output $(STATICLIB)

$(STATICLIB)-ppc: $(MODULES_PPC)
	$(LIBTOOL) -arch_only ppc -o $@ $(MODULES_PPC)

$(STATICLIB)-i386: $(MODULES_I386)
	$(LIBTOOL) -arch_only i386 -o $@ $(MODULES_I386)

$(SHAREDLIB): $(SHAREDLIB)-ppc $(SHAREDLIB)-i386
	$(LIPO) -create $(SHAREDLIB)-ppc $(SHAREDLIB)-i386 -output $(SHAREDLIB)

$(SHAREDLIB)-ppc: $(MODULES_PPC)
	$(CPP_PPC) -arch ppc -dynamiclib $(LIBRARIES_PPC) -o $@ $(MODULES_PPC)

$(SHAREDLIB)-i386: $(MODULES_I386)
	$(CPP_I386) -arch i386 -dynamiclib $(LIBRARIES_I386) -o $@ $(MODULES_I386)

.c.o-ppc:
	$(CC_PPC) $(CFLAGS_PPC) -c $< -o $@

.c.o-i386:
	$(CC_I386) $(CFLAGS_I386) -c $< -o $@

.cpp.o-ppc:
	$(CPP_PPC) $(CPPFLAGS_PPC) -c $< -o $@

.cpp.o-i386:
	$(CPP_I386) $(CPPFLAGS_I386) -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_PPC) $(MODULES_I386) $(STATICLIB) $(STATICLIB)-ppc $(STATICLIB)-i386 $(SHAREDLIB) $(SHAREDLIB)-ppc $(SHAREDLIB)-i386
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.