-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMakefile.clang
116 lines (93 loc) · 2.6 KB
/
Makefile.clang
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
.POSIX:
.SUFFIXES: .c .cc .bc .m .S .o
VERSION = 4.6.0
#CC=clang
CFLAGS += -fPIC -g
CPPFLAGS += -DTYPE_DEPENDENT_DISPATCH -DGNUSTEP
CPPFLAGS += -D__OBJC_RUNTIME_INTERNAL__=1 -D_XOPEN_SOURCE=500
PREFIX?= /usr/local
LIB_DIR= ${PREFIX}/lib
HEADER_DIR= ${PREFIX}/include
OBJECTS = \
arc.bc\
associate.bc\
gc_none.bc\
NSBlocks.bc\
Protocol2.bc\
abi_version.bc\
alias_table.bc\
blocks_runtime.bc\
block_to_imp.bc\
caps.bc\
category_loader.bc\
class_table.bc\
dtable.bc\
eh_personality.bc\
encoding2.bc\
hash_table.bc\
hooks.bc\
ivar.bc\
legacy_malloc.bc\
loader.bc\
mutation.bc\
properties.bc\
protocol.bc\
runtime.bc\
sarray2.bc\
selector_table.bc\
sendmsg2.bc\
statics_loader.bc\
toydispatch.bc
NATIVE_OBJECTS=\
block_trampolines.o\
objc_msgSend.o
CXX_OBJECTS=\
objcxx_eh.bc
all: libobjc.so.$(VERSION) libobjc.a libobjcxx.so.$(VERSION)
@echo "'Makefile.clang' is deprecated. Please use 'Makefile' or 'GNUmakefile'"
libobjcxx.so.$(VERSION): libobjc.so.$(VERSION) libobjcxx.o
@echo Linking shared C++ library...
@clang++ -shared -o $@ libobjcxx.o -L./ -lobjc
libobjcxx.o: libobjcxx.bc
@echo Generating native C++ object code...
@llc -relocation-model=pic -O3 -filetype=obj -o $@ libobjcxx.bc
libobjcxx.bc: $(CXX_OBJECTS)
@echo Linking C++ bitcode...
@llvm-ld -internalize -link-as-library -native -o libobjcxx.bc $(CXX_OBJECTS)
libobjc.so.$(VERSION): libobjc.o
@echo Linking shared library...
@clang -shared -o $@ libobjc.o -lpthread
libobjc.a: libobjc.o $(NATIVE_OBJECTS)
@echo Linking static library...
@ld -r -s -o $@ libobjc.o $(NATIVE_OBJECTS)
libobjc.o: libobjc.bc
@echo Generating native object code...
@llc -relocation-model=pic -O3 -filetype=obj -o libobjc.o libobjc.bc
libobjc.bc: $(OBJECTS)
@echo Linking bitcode...
@llvm-ld -internalize -link-as-library -native -o libobjc.bc $(OBJECTS)
.c.bc:
@echo Compiling $<...
@clang $(CPPFLAGS) $(CFLAGS) -emit-llvm -c $< -o $@
.cc.bc:
@echo Compiling $<...
@clang++ $(CPPFLAGS) $(CFLAGS) -emit-llvm -c $< -o $@
.m.bc:
@echo Compiling $<...
@clang $(CPPFLAGS) $(CFLAGS) -emit-llvm -c $< -o $@
.S.o:
@echo Assembling `basename $<`...
@clang $(CPPFLAGS) -no-integrated-as -c $< -o $@
install: all
install -m 444 libobjc.so.$(VERSION) $(LIB_DIR)
install -m 444 libobjc.a $(LIB_DIR)
ln -sf $(LIB_DIR)/libobjc.so.$(VERSION) $(LIB_DIR)/libobjc.so
install -d $(HEADER_DIR)/objc
install -m 444 objc/*.h $(HEADER_DIR)/objc
clean:
@echo Cleaning...
@rm -f $(NATIVE_OBJECTS)
@rm -f $(OBJECTS)
@rm -f $(CXX_OBJECTS)
@rm -f libobjc.a libobjc.o libobjcxx.o libobjc.bc libobjcxx.bc
@rm -f libobjc.so.$(VERSION) libobjcxx.so.$(VERSION)