-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
129 lines (108 loc) · 3.57 KB
/
Makefile
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
.POSIX:
.SUFFIXES: .cc .c .m .o .S
MAJOR_VERSION = 4
MINOR_VERSION = 6
SUBMINOR_VERSION = 0
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(SUBMINOR_VERSION)
LIBOBJCLIBNAME=objc
LIBOBJC=libobjc
LIBOBJCXX=libobjcxx
SILENT=@
CFLAGS += -std=gnu99 -fPIC -fexceptions
CFLAGS += -Wno-deprecated-objc-isa-usage
CXXFLAGS += -fPIC -fexceptions
CPPFLAGS += -DTYPE_DEPENDENT_DISPATCH -DGNUSTEP
CPPFLAGS += -D__OBJC_RUNTIME_INTERNAL__=1 -D_XOPEN_SOURCE=500 -D__BSD_VISIBLE=1 -D_BSD_SOURCE=1
ASMFLAGS += `if $(CC) -v 2>&1| grep -q 'clang' ; then echo -no-integrated-as ; fi`
STRIP=`if [ "$(strip)" = "yes" ] ; then echo -s ; fi`
# Suppress warnings about incorrect selectors
CPPFLAGS += -DNO_SELECTOR_MISMATCH_WARNINGS
# Some helpful flags for debugging.
#CPPFLAGS += -g -O0 -fno-inline
CPPFLAGS += -O3
PREFIX?= /usr/local
LIB_DIR= ${PREFIX}/lib
HEADER_DIR= ${PREFIX}/include
OBJCXX_OBJECTS = \
objcxx_eh.o
OBJECTS = \
NSBlocks.o\
Protocol2.o\
abi_version.o\
alias_table.o\
arc.o\
associate.o\
blocks_runtime.o\
block_to_imp.o\
block_trampolines.o\
objc_msgSend.o\
caps.o\
category_loader.o\
class_table.o\
dtable.o\
eh_personality.o\
encoding2.o\
gc_none.o\
hash_table.o\
hooks.o\
ivar.o\
legacy_malloc.o\
loader.o\
mutation.o\
properties.o\
protocol.o\
runtime.o\
sarray2.o\
selector_table.o\
sendmsg2.o\
statics_loader.o\
toydispatch.o
all: $(LIBOBJC).a $(LIBOBJCXX).so.$(VERSION)
$(LIBOBJCXX).so.$(VERSION): $(LIBOBJC).so.$(VERSION) $(OBJCXX_OBJECTS)
$(SILENT)echo Linking shared Objective-C++ runtime library...
$(SILENT)$(CXX) -shared \
-Wl,-soname=$(LIBOBJCXX).so.$(MAJOR_VERSION) \
-o $@ $(OBJCXX_OBJECTS)
$(LIBOBJC).so.$(VERSION): $(OBJECTS)
$(SILENT)echo Linking shared Objective-C runtime library...
$(SILENT)$(CC) -shared -rdynamic \
-Wl,-soname=$(LIBOBJC).so.$(MAJOR_VERSION) \
-o $@ $(OBJECTS)
$(LIBOBJC).a: $(OBJECTS)
$(SILENT)echo Linking static Objective-C runtime library...
$(SILENT)ld -r -s -o $@ $(OBJECTS)
.cc.o: Makefile
$(SILENT)echo Compiling `basename $<`...
$(SILENT)$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
.c.o: Makefile
$(SILENT)echo Compiling `basename $<`...
$(SILENT)$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
.m.o: Makefile
$(SILENT)echo Compiling `basename $<`...
$(SILENT)$(CC) $(CPPFLAGS) $(CFLAGS) -fobjc-exceptions -c $< -o $@
.S.o: Makefile
$(SILENT)echo Assembling `basename $<`...
$(SILENT)$(CC) $(CPPFLAGS) $(ASMFLAGS) -c $< -o $@
install: all
$(SILENT)echo Installing libraries...
$(SILENT)install -d $(LIB_DIR)
$(SILENT)install -m 444 $(STRIP) $(LIBOBJC).so.$(VERSION) $(LIB_DIR)
$(SILENT)install -m 444 $(STRIP) $(LIBOBJCXX).so.$(VERSION) $(LIB_DIR)
$(SILENT)install -m 444 $(STRIP) $(LIBOBJC).a $(LIB_DIR)
$(SILENT)echo Creating symbolic links...
$(SILENT)ln -sf $(LIBOBJC).so.$(VERSION) $(LIB_DIR)/$(LIBOBJC).so
$(SILENT)ln -sf $(LIBOBJC).so.$(VERSION) $(LIB_DIR)/$(LIBOBJC).so.$(MAJOR_VERSION)
$(SILENT)ln -sf $(LIBOBJC).so.$(VERSION) $(LIB_DIR)/$(LIBOBJC).so.$(MAJOR_VERSION).$(MINOR_VERSION)
$(SILENT)ln -sf $(LIBOBJCXX).so.$(VERSION) $(LIB_DIR)/$(LIBOBJCXX).so
$(SILENT)ln -sf $(LIBOBJCXX).so.$(VERSION) $(LIB_DIR)/$(LIBOBJCXX).so.$(MAJOR_VERSION)
$(SILENT)ln -sf $(LIBOBJCXX).so.$(VERSION) $(LIB_DIR)/$(LIBOBJCXX).so.$(MAJOR_VERSION).$(MINOR_VERSION)
$(SILENT)echo Installing headers...
$(SILENT)install -d $(HEADER_DIR)/objc
$(SILENT)install -m 444 objc/*.h $(HEADER_DIR)/objc
clean:
$(SILENT)echo Cleaning...
$(SILENT)rm -f $(OBJECTS)
$(SILENT)rm -f $(OBJCXX_OBJECTS)
$(SILENT)rm -f $(LIBOBJC).so.$(VERSION)
$(SILENT)rm -f $(LIBOBJCXX).so.$(VERSION)
$(SILENT)rm -f $(LIBOBJC).a