forked from greenjava/FreeImage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.osx
114 lines (89 loc) · 3.59 KB
/
Makefile.osx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# -*- 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
CC_X86_64 = gcc-4.0
CPP_PPC = g++-4.0
CPP_I386 = g++-4.0
CPP_X86_64 = g++-4.0
COMPILERFLAGS = -Os -fexceptions -fvisibility=hidden -DNO_LCMS
COMPILERFLAGS_PPC = -arch ppc
COMPILERFLAGS_I386 = -arch i386
COMPILERFLAGS_X86_64 = -arch x86_64
COMPILERPPFLAGS = -Wno-ctor-dtor-privacy
INCLUDE +=
INCLUDE_PPC = -isysroot /Developer/SDKs/MacOSX10.5.sdk
INCLUDE_I386 = -isysroot /Developer/SDKs/MacOSX10.5.sdk
INCLUDE_X86_64 = -isysroot /Developer/SDKs/MacOSX10.6.sdk
CFLAGS_PPC = $(COMPILERFLAGS) $(COMPILERFLAGS_PPC) $(INCLUDE) $(INCLUDE_PPC)
CFLAGS_I386 = $(COMPILERFLAGS) $(COMPILERFLAGS_I386) $(INCLUDE) $(INCLUDE_I386)
CFLAGS_X86_64 = $(COMPILERFLAGS) $(COMPILERFLAGS_X86_64) $(INCLUDE) $(INCLUDE_X86_64)
CPPFLAGS_PPC = $(COMPILERPPFLAGS) $(CFLAGS_PPC)
CPPFLAGS_I386 = $(COMPILERPPFLAGS) $(CFLAGS_I386)
CPPFLAGS_X86_64 = $(COMPILERPPFLAGS) $(CFLAGS_X86_64)
LIBRARIES_PPC = -Wl,-syslibroot /Developer/SDKs/MacOSX10.5.sdk
LIBRARIES_I386 = -Wl,-syslibroot /Developer/SDKs/MacOSX10.5.sdk
LIBRARIES_X86_64 = -Wl,-syslibroot /Developer/SDKs/MacOSX10.6.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-ppc .o-i386 .o-x86_64
MODULES_PPC = $(SRCS:.c=.o-ppc)
MODULES_I386 = $(SRCS:.c=.o-i386)
MODULES_X86_64 = $(SRCS:.c=.o-x86_64)
MODULES_PPC := $(MODULES_PPC:.cpp=.o-ppc)
MODULES_I386 := $(MODULES_I386:.cpp=.o-i386)
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
cp *.a Dist
cp *.dylib Dist
cp Source/FreeImage.h Dist
FreeImage: $(STATICLIB) $(SHAREDLIB)
$(STATICLIB): $(STATICLIB)-ppc $(STATICLIB)-i386 $(STATICLIB)-x86_64
$(LIPO) -create $(STATICLIB)-ppc $(STATICLIB)-i386 $(STATICLIB)-x86_64 -output $(STATICLIB)
$(STATICLIB)-ppc: $(MODULES_PPC)
$(LIBTOOL) -arch_only ppc -o $@ $(MODULES_PPC)
$(STATICLIB)-i386: $(MODULES_I386)
$(LIBTOOL) -arch_only i386 -o $@ $(MODULES_I386)
$(STATICLIB)-x86_64: $(MODULES_X86_64)
$(LIBTOOL) -arch_only x86_64 -o $@ $(MODULES_X86_64)
$(SHAREDLIB): $(SHAREDLIB)-ppc $(SHAREDLIB)-i386 $(SHAREDLIB)-x86_64
$(LIPO) -create $(SHAREDLIB)-ppc $(SHAREDLIB)-i386 $(SHAREDLIB)-x86_64 -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)
$(SHAREDLIB)-x86_64: $(MODULES_X86_64)
$(CPP_X86_64) -arch x86_64 -dynamiclib $(LIBRARIES_X86_64) -o $@ $(MODULES_X86_64)
.c.o-ppc:
$(CC_PPC) $(CFLAGS_PPC) -c $< -o $@
.c.o-i386:
$(CC_I386) $(CFLAGS_I386) -c $< -o $@
.c.o-x86_64:
$(CC_X86_64) $(CFLAGS_X86_64) -c $< -o $@
.cpp.o-ppc:
$(CPP_PPC) $(CPPFLAGS_PPC) -c $< -o $@
.cpp.o-i386:
$(CPP_I386) $(CPPFLAGS_I386) -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_PPC) $(MODULES_I386) $(MODULES_X86_64) $(STATICLIB) $(STATICLIB)-ppc $(STATICLIB)-i386 $(SHAREDLIB) $(SHAREDLIB)-ppc $(SHAREDLIB)-i386 $(SHAREDLIB)-x86_64