1 export USE_APPLE_PB_SUPPORT
= all
4 SDK
= -isysroot
$(SDKROOT
)
5 CC
= $(shell xcrun
-find
-sdk
$(SDKROOT
) cc)
6 CXX
= $(shell xcrun
-find
-sdk
$(SDKROOT
) c
++)
7 DSYMUTIL
= $(shell xcrun
-find
-sdk
${SDKROOT} dsymutil
)
8 LIBTOOL
= $(shell xcrun
-find
-sdk
$(SDKROOT
) libtool
)
17 CFLAGS
= $(OFLAG
) $(LTO
) $(TRIE
) -g
-Wall \
18 -I
$(SRCROOT
) -I
$(SRCROOT
)/..
/include -I
$(OFILE_DIR
) $(SDK
) \
19 -I
$(DT_TOOLCHAIN_DIR
)/usr
/local
/include
21 LIBSTUFF
= -L
$(SYMROOT
)/..
/libstuff
-lstuff
22 CXXLIB
= -stdlib
=libc
++
27 LIB_PRUNETRIE
= -L
$(DT_TOOLCHAIN_DIR
)/usr
/local
/lib
-lprunetrie
30 MKDIRS
= /bin
/mkdir
-p
33 OFILE_DIR
= $(OBJROOT
)
39 LOCBINDIR
= /usr
/local
/bin
40 LOCLIBDIR
= /usr
/local
/lib
43 CFILES2
= lipo.c size.c strings.c nm.c checksyms.c inout.c \
44 indr.c
strip.c segedit.c cmpdylib.c \
45 pagestuff.c redo_prebinding.c seg_addr_table.c \
46 check_dylib.c seg_hack.c install_name_tool.c \
47 codesign_allocate.c ctf_insert.c bitcode_strip.c
48 INSTALL_FILES
= $(CFILES1
) $(CFILES2
) Makefile notes Info.plist
50 OS_PROGS
= lipo.NEW strings.NEW
52 PROGS
= $(OS_PROGS
) size.NEW nm.NEW libtool.NEW checksyms.NEW \
53 indr.NEW
strip.NEW nmedit.NEW segedit.NEW cmpdylib.NEW \
54 pagestuff.NEW redo_prebinding.NEW seg_addr_table.NEW check_dylib.NEW \
55 seg_hack.NEW install_name_tool.NEW codesign_allocate.NEW \
56 ctf_insert.NEW bitcode_strip.NEW
58 all: $(OFILE_DIR
) $(SYMROOT
) $(PROGS
) lib_ofiles
60 os_tools
: $(OFILE_DIR
) $(SYMROOT
) $(OS_PROGS
)
62 lib_ofiles
: $(OFILE_DIR
) $(SYMROOT
) libredo_prebinding.a
65 $(CC
) $(CFLAGS
) $(RC_CFLAGS
) -c
-o
$(OFILE_DIR
)/$*.o
$<
67 libredo_prebinding.o
: redo_prebinding.c
68 $(CC
) $(CFLAGS
) $(RC_CFLAGS
) -c \
69 -o
$(OFILE_DIR
)/$*.o
$(SRCROOT
)/redo_prebinding.c
-DLIBRARY_API
71 checksyms.NEW
: checksyms.o
72 $(CC
) $(RC_CFLAGS
) -nostdlib
-r \
73 -o
$(OBJROOT
)/checksyms.private.o \
74 $(OFILE_DIR
)/checksyms.o
$(LIBSTUFF
)
75 $(CC
) $(RC_CFLAGS
) $(SDK
) -o
$(SYMROOT
)/checksyms.NEW \
76 $(OFILE_DIR
)/checksyms.private.o
77 $(DSYMUTIL
) $(SYMROOT
)/checksyms.NEW
79 cmpdylib.NEW
: cmpdylib.o
80 $(CC
) $(RC_CFLAGS
) -nostdlib
-r \
81 -o
$(OBJROOT
)/cmpdylib.private.o \
82 $(OFILE_DIR
)/cmpdylib.o
$(LIBSTUFF
)
83 $(CC
) $(RC_CFLAGS
) $(SDK
) -o
$(SYMROOT
)/cmpdylib.NEW \
84 $(OFILE_DIR
)/cmpdylib.private.o
85 $(DSYMUTIL
) $(SYMROOT
)/cmpdylib.NEW
88 $(CC
) $(RC_CFLAGS
) -nostdlib
-r \
89 -o
$(OBJROOT
)/lipo.private.o \
90 $(OFILE_DIR
)/lipo.o
$(LIBSTUFF
)
91 $(CC
) $(RC_CFLAGS
) $(SDK
) -o
$(SYMROOT
)/lipo.NEW \
92 $(OFILE_DIR
)/lipo.private.o
93 $(DSYMUTIL
) $(SYMROOT
)/lipo.NEW
96 $(CC
) $(RC_CFLAGS
) -nostdlib
-r \
97 -o
$(OBJROOT
)/size.private.o \
98 $(OFILE_DIR
)/size.o
$(LIBSTUFF
)
99 $(CC
) $(RC_CFLAGS
) $(SDK
) -o
$(SYMROOT
)/size.NEW \
100 $(OFILE_DIR
)/size.private.o
101 $(DSYMUTIL
) $(SYMROOT
)/size.NEW
103 strings.NEW
: strings.o
104 $(CC
) $(RC_CFLAGS
) -nostdlib
-r \
105 -o
$(OBJROOT
)/strings.private.o \
106 $(OFILE_DIR
)/strings.o
$(LIBSTUFF
)
107 $(CC
) $(RC_CFLAGS
) $(SDK
) -o
$(SYMROOT
)/strings.NEW \
108 $(OFILE_DIR
)/strings.private.o
109 $(DSYMUTIL
) $(SYMROOT
)/strings.NEW
112 $(CC
) $(RC_CFLAGS
) -nostdlib
-r \
113 -o
$(OBJROOT
)/nm.private.o \
114 $(OFILE_DIR
)/nm.o
$(LIBSTUFF
)
115 $(CC
) $(RC_CFLAGS
) $(SDK
) -o
$(SYMROOT
)/nm.NEW \
116 $(OFILE_DIR
)/nm.private.o
117 $(DSYMUTIL
) $(SYMROOT
)/nm.NEW
119 libtool.NEW
: libtool.o
120 $(CC
) $(RC_CFLAGS
) -nostdlib
-r \
121 -o
$(OBJROOT
)/libtool.private.o \
122 $(OFILE_DIR
)/libtool.o
$(LIBSTUFF
)
123 $(CC
) $(RC_CFLAGS
) $(SDK
) -o
$(SYMROOT
)/libtool.NEW \
124 $(OFILE_DIR
)/libtool.private.o
125 $(DSYMUTIL
) $(SYMROOT
)/libtool.NEW
127 redo_prebinding.NEW
: redo_prebinding.o
128 $(CC
) $(RC_CFLAGS
) -nostdlib
-r \
129 -o
$(OBJROOT
)/redo_prebinding.private.o \
130 $(OFILE_DIR
)/redo_prebinding.o
$(LIBSTUFF
)
131 $(CC
) $(RC_CFLAGS
) $(SDK
) -o
$(SYMROOT
)/redo_prebinding.NEW \
132 $(OFILE_DIR
)/redo_prebinding.private.o
133 $(DSYMUTIL
) $(SYMROOT
)/redo_prebinding.NEW
135 libredo_prebinding.a
: libredo_prebinding.o
136 $(CC
) $(RC_CFLAGS
) -nostdlib
-r
-o
$(OBJROOT
)/libredo.o \
137 libredo_prebinding.o
$(LIBSTUFF
)
138 $(LIBTOOL
) -static
-o
$(SYMROOT
)/libredo_prebinding.a
$(OBJROOT
)/libredo.o
140 seg_addr_table.NEW
: seg_addr_table.o
141 $(CC
) $(RC_CFLAGS
) -nostdlib
-r \
142 -o
$(OBJROOT
)/seg_addr_table.private.o \
143 $(OFILE_DIR
)/seg_addr_table.o
$(LIBSTUFF
)
144 $(CC
) $(RC_CFLAGS
) $(SDK
) -o
$(SYMROOT
)/seg_addr_table.NEW \
145 $(OFILE_DIR
)/seg_addr_table.private.o
146 $(DSYMUTIL
) $(SYMROOT
)/seg_addr_table.NEW
148 check_dylib.NEW
: check_dylib.o
149 $(CC
) $(RC_CFLAGS
) -nostdlib
-r \
150 -o
$(OBJROOT
)/check_dylib.private.o \
151 $(OFILE_DIR
)/check_dylib.o
$(LIBSTUFF
)
152 $(CC
) $(RC_CFLAGS
) $(SDK
) -o
$(SYMROOT
)/check_dylib.NEW \
153 $(OFILE_DIR
)/check_dylib.private.o
154 $(DSYMUTIL
) $(SYMROOT
)/check_dylib.NEW
157 $(CC
) $(RC_CFLAGS
) -nostdlib
-r \
158 -o
$(OBJROOT
)/inout.private.o \
159 $(OFILE_DIR
)/inout.o
$(LIBSTUFF
)
160 $(CC
) $(RC_CFLAGS
) $(SDK
) -o
$(SYMROOT
)/inout.NEW \
161 $(OFILE_DIR
)/inout.private.o
162 $(DSYMUTIL
) $(SYMROOT
)/inout.NEW
164 codesign_allocate.NEW
: codesign_allocate.o
165 $(CC
) $(RC_CFLAGS
) -nostdlib
-r \
166 -o
$(OBJROOT
)/codesign_allocate.private.o \
167 $(OFILE_DIR
)/codesign_allocate.o
$(LIBSTUFF
)
168 $(CC
) $(RC_CFLAGS
) $(SDK
) -o
$(SYMROOT
)/codesign_allocate.NEW \
169 -sectcreate __TEXT __info_plist Info.plist \
170 $(OFILE_DIR
)/codesign_allocate.private.o
171 $(DSYMUTIL
) $(SYMROOT
)/codesign_allocate.NEW
173 ctf_insert.NEW
: ctf_insert.o
174 $(CC
) $(RC_CFLAGS
) -nostdlib
-r \
175 -o
$(OBJROOT
)/ctf_insert.private.o \
176 $(OFILE_DIR
)/ctf_insert.o
$(LIBSTUFF
)
177 $(CC
) $(RC_CFLAGS
) $(SDK
) -o
$(SYMROOT
)/ctf_insert.NEW \
178 $(OFILE_DIR
)/ctf_insert.private.o
179 $(DSYMUTIL
) $(SYMROOT
)/ctf_insert.NEW
181 seg_hack.NEW
: seg_hack.o
182 $(CC
) $(RC_CFLAGS
) -nostdlib
-r \
183 -o
$(OBJROOT
)/seg_hack.private.o \
184 $(OFILE_DIR
)/seg_hack.o
$(LIBSTUFF
)
185 $(CC
) $(RC_CFLAGS
) $(SDK
) -o
$(SYMROOT
)/seg_hack.NEW \
186 $(OFILE_DIR
)/seg_hack.private.o
187 $(DSYMUTIL
) $(SYMROOT
)/seg_hack.NEW
189 install_name_tool.NEW
: install_name_tool.o
190 $(CC
) $(RC_CFLAGS
) -nostdlib
-r \
191 -o
$(OBJROOT
)/install_name_tool.private.o \
192 $(OFILE_DIR
)/install_name_tool.o
$(LIBSTUFF
)
193 $(CC
) $(RC_CFLAGS
) $(SDK
) -o
$(SYMROOT
)/install_name_tool.NEW \
194 $(OFILE_DIR
)/install_name_tool.private.o
195 $(DSYMUTIL
) $(SYMROOT
)/install_name_tool.NEW
198 $(CC
) $(RC_CFLAGS
) -nostdlib
-r \
199 -o
$(OBJROOT
)/indr.private.o \
200 $(OFILE_DIR
)/indr.o
$(LIBSTUFF
)
201 $(CC
) $(RC_CFLAGS
) $(SDK
) -o
$(SYMROOT
)/indr.NEW \
202 $(OFILE_DIR
)/indr.private.o
203 $(DSYMUTIL
) $(SYMROOT
)/indr.NEW
206 $(CC
) $(RC_CFLAGS
) -nostdlib
-r \
207 -o
$(OBJROOT
)/strip.private.o \
208 $(OFILE_DIR
)/strip.o
$(LIBSTUFF
)
209 $(CXX
) $(RC_CFLAGS
) $(SDK
) -o
$(SYMROOT
)/strip.NEW \
210 $(OFILE_DIR
)/strip.private.o
$(LIB_PRUNETRIE
) $(CXXLIB
)
211 $(DSYMUTIL
) $(SYMROOT
)/strip.NEW
214 $(CC
) $(RC_CFLAGS
) -nostdlib
-r \
215 -o
$(OBJROOT
)/nmedit.private.o \
216 $(OFILE_DIR
)/nmedit.o
$(LIBSTUFF
)
217 $(CC
) $(RC_CFLAGS
) $(SDK
) -o
$(SYMROOT
)/nmedit.NEW \
218 $(OFILE_DIR
)/nmedit.private.o
219 $(DSYMUTIL
) $(SYMROOT
)/nmedit.NEW
222 $(CC
) $(CFLAGS
) $(RC_CFLAGS
) -c \
223 -o
$(OFILE_DIR
)/nmedit.o
$(SRCROOT
)/strip.c
-DNMEDIT
225 segedit.NEW
: segedit.o
226 $(CC
) $(RC_CFLAGS
) -nostdlib
-r \
227 -o
$(OBJROOT
)/segedit.private.o \
228 $(OFILE_DIR
)/segedit.o
$(LIBSTUFF
)
229 $(CC
) $(RC_CFLAGS
) $(SDK
) -o
$(SYMROOT
)/segedit.NEW \
230 $(OFILE_DIR
)/segedit.private.o
231 $(DSYMUTIL
) $(SYMROOT
)/segedit.NEW
233 pagestuff.NEW
: pagestuff.o
234 $(CC
) $(RC_CFLAGS
) -nostdlib
-r \
235 -o
$(OBJROOT
)/pagestuff.private.o \
236 $(OFILE_DIR
)/pagestuff.o
$(LIBSTUFF
)
237 $(CC
) $(RC_CFLAGS
) $(SDK
) -o
$(SYMROOT
)/pagestuff.NEW \
238 $(OFILE_DIR
)/pagestuff.private.o
239 $(DSYMUTIL
) $(SYMROOT
)/pagestuff.NEW
241 bitcode_strip.NEW
: bitcode_strip.o
242 $(CC
) $(RC_CFLAGS
) -nostdlib
-r \
243 -o
$(OBJROOT
)/bitcode_strip.private.o \
244 $(OFILE_DIR
)/bitcode_strip.o
$(LIBSTUFF
)
245 $(CC
) $(RC_CFLAGS
) $(SDK
) -o
$(SYMROOT
)/bitcode_strip.NEW \
246 $(OFILE_DIR
)/bitcode_strip.private.o
247 $(DSYMUTIL
) $(SYMROOT
)/bitcode_strip.NEW
252 $(SYMROOT
)/lipo.NEW \
253 $(SYMROOT
)/size.NEW \
254 $(SYMROOT
)/strings.NEW \
256 $(SYMROOT
)/libtool.NEW \
257 $(SYMROOT
)/checksyms.NEW \
258 $(SYMROOT
)/seg_addr_table.NEW \
259 $(SYMROOT
)/check_dylib.NEW \
260 $(SYMROOT
)/inout.NEW \
261 $(SYMROOT
)/codesign_allocate.NEW \
262 $(SYMROOT
)/ctf_insert.NEW \
263 $(SYMROOT
)/seg_hack.NEW \
264 $(SYMROOT
)/install_name_tool.NEW \
265 $(SYMROOT
)/codesign_allocate.NEW \
266 $(SYMROOT
)/indr.NEW \
267 $(SYMROOT
)/strip.NEW \
268 $(SYMROOT
)/nmedit.NEW \
269 $(SYMROOT
)/segedit.NEW \
270 $(SYMROOT
)/pagestuff.NEW \
271 $(SYMROOT
)/redo_prebinding.NEW \
272 $(SYMROOT
)/libredo_prebinding.a \
273 $(SYMROOT
)/cmpdylib.NEW \
274 $(SYMROOT
)/bitcode_strip.NEW
278 $(OFILE_DIR
)/lipo.o \
279 $(OFILE_DIR
)/size.o \
280 $(OFILE_DIR
)/strings.o \
282 $(OFILE_DIR
)/libtool.o \
283 $(OFILE_DIR
)/make.h \
284 $(OFILE_DIR
)/checksyms.o \
285 $(OFILE_DIR
)/inout.o \
286 $(OFILE_DIR
)/codesign_allocate.o \
287 $(OFILE_DIR
)/ctf_insert.o \
288 $(OFILE_DIR
)/seg_hack.o \
289 $(OFILE_DIR
)/install_name_tool.o \
290 $(OFILE_DIR
)/indr.o \
291 $(OFILE_DIR
)/segedit.o \
292 $(OFILE_DIR
)/pagestuff.o \
293 $(OFILE_DIR
)/redo_prebinding.o \
294 $(OFILE_DIR
)/libredo_prebinding.o \
295 $(OFILE_DIR
)/libredo.o \
296 $(OFILE_DIR
)/seg_addr_table.o \
297 $(OFILE_DIR
)/check_dylib.o \
298 $(OFILE_DIR
)/cmpdylib.o \
299 $(OFILE_DIR
)/nmedit.o \
300 $(OFILE_DIR
)/strip.o \
301 $(OFILE_DIR
)/lipo.private.o \
302 $(OFILE_DIR
)/size.private.o \
303 $(OFILE_DIR
)/strings.private.o \
304 $(OFILE_DIR
)/nm.private.o \
305 $(OFILE_DIR
)/bitcode_strip.o \
306 $(OFILE_DIR
)/libtool.private.o \
307 $(OFILE_DIR
)/checksyms.private.o \
308 $(OFILE_DIR
)/inout.private.o \
309 $(OFILE_DIR
)/codesign_allocate.private.o \
310 $(OFILE_DIR
)/ctf_insert.private.o \
311 $(OFILE_DIR
)/seg_hack.private.o \
312 $(OFILE_DIR
)/install_name_tool.private.o \
313 $(OFILE_DIR
)/indr.private.o \
314 $(OFILE_DIR
)/segedit.private.o \
315 $(OFILE_DIR
)/pagestuff.private.o \
316 $(OFILE_DIR
)/redo_prebinding.private.o \
317 $(OFILE_DIR
)/seg_addr_table.private.o \
318 $(OFILE_DIR
)/check_dylib.private.o \
319 $(OFILE_DIR
)/cmpdylib.private.o \
320 $(OFILE_DIR
)/nmedit.private.o \
321 $(OFILE_DIR
)/strip.private.o \
322 $(OFILE_DIR
)/bitcode_strip.private.o
326 install: all dt_install os_tools_install
328 install_os_tools
: os_tools os_tools_install
331 $(MKDIRS
) $(DSTROOT
)$(USRBINDIR
)
332 install -c
-s
-m
555 $(SYMROOT
)/strings.NEW \
333 $(DSTROOT
)$(USRBINDIR
)/strings
334 install -c
-s
-m
555 $(SYMROOT
)/lipo.NEW
$(DSTROOT
)$(USRBINDIR
)/lipo
337 $(MKDIRS
) $(DSTROOT
)$(USRBINDIR
)
338 install -c
-s
-m
555 $(SYMROOT
)/strip.NEW
$(DSTROOT
)$(USRBINDIR
)/strip
339 install -c
-s
-m
555 $(SYMROOT
)/size.NEW
$(DSTROOT
)$(USRBINDIR
)/size-classic
340 (cd
$(DSTROOT
)$(USRBINDIR
); rm -f size
; ln
-s llvm-size size
)
341 install -c
-s
-m
555 $(SYMROOT
)/nm.NEW
$(DSTROOT
)$(USRBINDIR
)/nm-classic
342 (cd
$(DSTROOT
)$(USRBINDIR
); rm -f nm
; ln
-s llvm-nm nm
)
343 install -c
-s
-m
555 $(SYMROOT
)/libtool.NEW \
344 $(DSTROOT
)$(USRBINDIR
)/libtool
345 (cd
$(DSTROOT
)$(USRBINDIR
); rm -f ranlib
; ln
-s libtool ranlib
)
346 install -c
-s
-m
555 $(SYMROOT
)/segedit.NEW \
347 $(DSTROOT
)$(USRBINDIR
)/segedit
348 install -c
-s
-m
555 $(SYMROOT
)/cmpdylib.NEW \
349 $(DSTROOT
)$(USRBINDIR
)/cmpdylib
350 install -c
-s
-m
555 $(SYMROOT
)/pagestuff.NEW \
351 $(DSTROOT
)$(USRBINDIR
)/pagestuff
352 install -c
-s
-m
555 $(SYMROOT
)/redo_prebinding.NEW \
353 $(DSTROOT
)$(USRBINDIR
)/redo_prebinding
354 install -c
-s
-m
555 $(SYMROOT
)/nmedit.NEW
$(DSTROOT
)$(USRBINDIR
)/nmedit
355 install -c
-s
-m
555 $(SYMROOT
)/install_name_tool.NEW \
356 $(DSTROOT
)$(USRBINDIR
)/install_name_tool
357 install -c
-s
-m
555 $(SYMROOT
)/codesign_allocate.NEW \
358 $(DSTROOT
)$(USRBINDIR
)/codesign_allocate
359 $(MKDIRS
) $(RAW_DSTROOT
)/usr
/libexec
/DeveloperTools
360 cp
$(DSTROOT
)$(USRBINDIR
)/codesign_allocate \
361 $(RAW_DSTROOT
)/usr
/libexec
/DeveloperTools
362 install -c
-s
-m
555 $(SYMROOT
)/ctf_insert.NEW \
363 $(DSTROOT
)$(USRBINDIR
)/ctf_insert
364 install -c
-s
-m
555 $(SYMROOT
)/bitcode_strip.NEW \
365 $(DSTROOT
)$(USRBINDIR
)/bitcode_strip
366 $(MKDIRS
) $(DSTROOT
)$(LOCBINDIR
)
367 install -c
-s
-m
555 $(SYMROOT
)/checksyms.NEW \
368 $(DSTROOT
)$(LOCBINDIR
)/checksyms
369 install -c
-s
-m
555 $(SYMROOT
)/seg_addr_table.NEW \
370 $(DSTROOT
)$(LOCBINDIR
)/seg_addr_table
371 install -c
-s
-m
555 $(SYMROOT
)/check_dylib.NEW \
372 $(DSTROOT
)$(LOCBINDIR
)/check_dylib
373 install -c
-s
-m
555 $(SYMROOT
)/indr.NEW
$(DSTROOT
)$(LOCBINDIR
)/indr
374 install -c
-s
-m
555 $(SYMROOT
)/seg_hack.NEW \
375 $(DSTROOT
)$(LOCBINDIR
)/seg_hack
377 lib_ofiles_install
: lib_ofiles
378 $(MKDIRS
) $(DSTROOT
)$(LOCLIBDIR
)
379 install -p
-c
-m
444 $(SYMROOT
)/libredo_prebinding.a \
380 $(DSTROOT
)$(LOCLIBDIR
)/libredo_prebinding.a
385 gnutar cf
- $(INSTALL_FILES
) |
(cd
$(SRCROOT
); gnutar xf
-)
386 chmod
444 $(SRCROOT
)/*
388 $(OFILE_DIR
) $(SYMROOT
):