1 # use LDFLAGS not LFLAGS
3 # Simple makefile for building objc4 on Darwin
5 # These make variables (or environment variables) are used
7 # SRCROOT path location of root of source hierarchy;
8 # defaults to ".", but must be set to a
9 # destination path for installsrc target.
10 # OBJROOT path location where .o files will be put;
11 # defaults to SRCROOT.
12 # SYMROOT path location where build products will be
13 # put; defaults to SRCROOT.
14 # DSTROOT path location where installed products will
15 # be put; defaults to / .
16 # OBJROOT and SYMROOT should not be directories shared with other
18 # PLATFORM name of platform being built on
19 # USER name of user building the project
20 # ARCHS list of archs for which to build
21 # RC_ARCHS more archs for which to build (build system)
22 # OTHER_CFLAGS other flags to be passed to compiler
23 # RC_CFLAGS more flags to be passed to compiler (build system)
24 # OTHER_LDFLAGS other flags to be passed to the link stage
35 .PHONY: default all test build optimized debug profile installsrc installhdrs install clean prebuild build-optimized build-debug build-profile prebuild-optimized prebuild-debug prebuild-profile compile-optimized compile-debug compile-profile link-optimized link-debug link-profile postbuild
37 CURRENT_PROJECT_VERSION = 227
41 # First figure out the platform if not specified, so we can use it in the
42 # rest of this file. Currently defined values: Darwin
44 PLATFORM := $(shell uname)
63 ifeq "$(PLATFORM)" "Darwin"
70 MKDIRS = /bin/mkdir -p
73 COPY_RECUR = /bin/cp -r
75 REMOVE_RECUR = /bin/rm -rf
78 CHOWN = /usr/sbin/chown
80 STRIP = /usr/bin/strip
81 NMEDIT = /usr/bin/nmedit
84 ifeq "$(PLATFORM)" "Darwin"
85 WARNING_FLAGS = -Wall -Wno-four-char-constants -Wshorten-64-to-32 -Wno-deprecated-declarations
89 ifeq "$(PLATFORM)" "Darwin"
94 ifneq "$(RC_ARCHS)" ""
95 ARCH_LIST += $(RC_ARCHS)
97 ARCH_LIST += $(shell /usr/bin/arch)
101 ARCH_FLAGS = $(foreach A, $(ARCH_LIST), $(addprefix -arch , $(A)))
106 ifeq "$(ORDERFILE)" ""
107 ORDERFILE = $(SRCROOT)/libobjc.order
109 ifneq "$(ORDERFILE)" ""
110 ORDER = -Wl,-order_file,$(ORDERFILE)
119 CFLAGS = -g -fno-common -fdollars-in-identifiers -pipe $(PLATFORM_CFLAGS) $(WARNING_FLAGS) -I$(SYMROOT) -I. -I$(SYMROOT)/ProjectHeaders
124 PUBLIC_HEADER_INSTALLDIR = usr/include/objc
125 OTHER_HEADER_INSTALLDIR = usr/local/include/objc
128 ifeq "$(PLATFORM)" "Darwin"
129 LDFLAGS += -dynamiclib -dynamic -compatibility_version 1 -current_version $(CURRENT_PROJECT_VERSION)
132 ifeq "$(PLATFORM)" "Darwin"
135 #CFLAGS += -fobjc-gc -Wassign-intercept
138 CFLAGS += $(OTHER_CFLAGS) $(RC_CFLAGS)
139 LDFLAGS += $(OTHER_LDFLAGS)
141 ifndef OPTIMIZATION_CFLAGS
142 OPTIMIZATION_CFLAGS = -Os -DNDEBUG
145 DEBUG_CFLAGS = -DDEBUG
147 ifndef PROFILE_CFLAGS
148 PROFILE_CFLAGS = -DPROFILE -pg -Os -DNDEBUG
151 CFLAGS_OPTIMIZED = $(OPTIMIZATION_CFLAGS) $(CFLAGS)
152 CFLAGS_DEBUG = $(DEBUG_CFLAGS) $(CFLAGS)
153 CFLAGS_PROFILE = $(PROFILE_CFLAGS) $(CFLAGS)
155 LDFLAGS_OPTIMIZED = $(LDFLAGS) -g
156 LDFLAGS_DEBUG = $(LDFLAGS) -g
157 LDFLAGS_PROFILE = $(LDFLAGS) -g -pg
159 SUBDIRS = . runtime runtime/OldClasses.subproj runtime/Messengers.subproj runtime/Accessors.subproj runtime/Auto.subproj
163 # files to compile into separate linker modules
165 # files to not compile
167 # headers to install in /usr/include/objc
169 # headers that don't get installed
171 # headers to install in /usr/local/include/objc
175 SOURCES += $(addprefix runtime/, \
176 Object.m Protocol.m hashtable2.m maptable.m objc-class.m \
177 objc-errors.m objc-cache.m objc-initialize.m \
178 objc-file.m objc-load.m objc-runtime.m objc-sel.m \
179 objc-sync.m objc-exception.m objc-auto.m objc-sel-set.m objc-rtp.m \
180 objc-layout.m objc-loadmethod.m objc-class-old.m objc-runtime-old.m \
181 objc-runtime-new.m objc-typeencoding.m objc-lockdebug.m \
184 PUBLIC_HEADERS += $(addprefix runtime/, \
185 objc.h runtime.h message.h \
186 objc-class.h objc-api.h objc-load.h objc-runtime.h Object.h \
187 objc-sync.h objc-exception.h objc-auto.h \
188 Protocol.h error.h hashtable2.h \
190 PRIVATE_HEADERS += $(addprefix runtime/, \
191 objc-private.h objc-config.h objc-sel-table.h objc-sel-set.h \
192 objc-rtp.h objc-initialize.h objc-loadmethod.h objc-runtime-new.h \
193 phash.h lookupa.h standard.h \
195 OTHER_HEADERS += runtime/maptable.h runtime/objc-auto.h
198 SOURCES += runtime/OldClasses.subproj/List.m
199 PUBLIC_HEADERS += runtime/OldClasses.subproj/List.h
202 SOURCES += runtime/Messengers.subproj/objc-msg.s
203 OTHER_SOURCES += runtime/Messengers.subproj/objc-msg-ppc.s runtime/Messengers.subproj/objc-msg-ppc64.s runtime/Messengers.subproj/objc-msg-i386.s runtime/Messengers.subproj/objc-msg-x86_64.s
206 SOURCES += runtime/Accessors.subproj/objc-accessors.m runtime/Accessors.subproj/objc-accessors-arch.s
207 PRIVATE_HEADERS += runtime/Accessors.subproj/objc-accessors.h runtime/Accessors.subproj/objc-accessors-table.h
208 OTHER_SOURCES += runtime/Accessors.subproj/objc-accessors-ppc.s runtime/Accessors.subproj/objc-accessors-ppc64.s
209 OTHER_SOURCES += runtime/Accessors.subproj/objc-accessors-i386.s runtime/Accessors.subproj/objc-accessors-x86_64.s
212 SOURCES += runtime/Auto.subproj/objc-auto.s
213 OTHER_SOURCES += runtime/Auto.subproj/objc-auto-ppc.s runtime/Auto.subproj/objc-auto-ppc64.s runtime/Auto.subproj/objc-auto-i386.s runtime/Auto.subproj/objc-auto-x86_64.s
215 # RTP symbols for gdb
216 # See also $(OBJROOT)/runtime/objc-rtp-sym.ppc.o rule below.
217 OTHER_SOURCES += runtime/objc-rtp-sym.s
219 # Interposing support.
220 # This code is built into a second module so dyld's function interposing
221 # can manipulate the calls.
222 MODULE_SOURCES += runtime/Messengers.subproj/objc-msg-stub.s
223 OTHER_SOURCES += runtime/Messengers.subproj/objc-msg-stub-ppc.s runtime/Messengers.subproj/objc-msg-stub-ppc64.s runtime/Messengers.subproj/objc-msg-stub-i386.s runtime/Messengers.subproj/objc-msg-stub-x86_64.s
226 OTHER_SOURCES += Makefile APPLE_LICENSE libobjc.order
228 # The GC Mark tool that marks our .o files as if they had been compiled with write-barriers
229 OTHER_SOURCES += markgc.c
230 MARKGC = $(OBJROOT)/markgc
233 OBJECTS = $(addprefix $(OBJROOT)/, $(addsuffix .o, $(basename $(SOURCES) ) ) )
234 OBJECTS_OPTIMIZED = $(OBJECTS:.o=.opt.o)
235 OBJECTS_DEBUG = $(OBJECTS:.o=.debug.o)
236 OBJECTS_PROFILE = $(OBJECTS:.o=.profile.o)
238 MODULE_OBJECTS = $(addprefix $(OBJROOT)/, $(addsuffix .o, $(basename $(MODULE_SOURCES) ) ) )
239 MODULE_OBJECTS_OPTIMIZED = $(MODULE_OBJECTS:.o=.opt.o)
240 MODULE_OBJECTS_DEBUG = $(MODULE_OBJECTS:.o=.debug.o)
241 MODULE_OBJECTS_PROFILE = $(MODULE_OBJECTS:.o=.profile.o)
243 # For simplicity, each object target depends on all objc headers. Most of
244 # them come close to requiring this anyway, and rebuild from scratch is fast.
245 DEPEND_HEADERS = $(addprefix $(SRCROOT)/, \
246 $(PUBLIC_HEADERS) $(PRIVATE_HEADERS) $(OTHER_HEADERS) )
248 $(OBJROOT)/%.opt.o : $(SRCROOT)/%.m $(DEPEND_HEADERS) $(MARKGC)
249 $(SILENT) $(ECHO) " ... $<"
250 $(SILENT) $(CC) $(ARCH_FLAGS) $(CFLAGS_OPTIMIZED) "$<" -c -o "$@"
251 $(SILENT) $(MARKGC) -p "$@"
253 $(OBJROOT)/%.debug.o : $(SRCROOT)/%.m $(DEPEND_HEADERS) $(MARKGC)
254 $(SILENT) $(ECHO) " ... $<"
255 $(SILENT) $(CC) $(ARCH_FLAGS) $(CFLAGS_DEBUG) "$<" -c -o "$@"
256 $(SILENT) $(MARKGC) -p "$@"
258 $(OBJROOT)/%.profile.o : $(SRCROOT)/%.m $(DEPEND_HEADERS) $(MARKGC)
259 $(SILENT) $(ECHO) " ... $<"
260 $(SILENT) $(CC) $(ARCH_FLAGS) $(CFLAGS_PROFILE) "$<" -c -o "$@"
261 $(SILENT) $(MARKGC) -p "$@"
263 $(OBJROOT)/%.opt.o : $(SRCROOT)/%.c $(DEPEND_HEADERS)
264 $(SILENT) $(ECHO) " ... $<"
265 $(SILENT) $(CC) $(ARCH_FLAGS) $(CFLAGS_OPTIMIZED) "$<" -c -o "$@"
267 $(OBJROOT)/%.debug.o : $(SRCROOT)/%.c $(DEPEND_HEADERS)
268 $(SILENT) $(ECHO) " ... $<"
269 $(SILENT) $(CC) $(ARCH_FLAGS) $(CFLAGS_DEBUG) "$<" -c -o "$@"
271 $(OBJROOT)/%.profile.o : $(SRCROOT)/%.c $(DEPEND_HEADERS)
272 $(SILENT) $(ECHO) " ... $<"
273 $(SILENT) $(CC) $(ARCH_FLAGS) $(CFLAGS_PROFILE) "$<" -c -o "$@"
275 $(OBJROOT)/%.opt.o : $(SRCROOT)/%.s $(DEPEND_HEADERS)
276 $(SILENT) $(ECHO) " ... $<"
277 $(SILENT) $(CC) $(ARCH_FLAGS) $(CFLAGS_OPTIMIZED) "$<" -c -o "$@"
279 $(OBJROOT)/%.debug.o : $(SRCROOT)/%.s $(DEPEND_HEADERS)
280 $(SILENT) $(ECHO) " ... $<"
281 $(SILENT) $(CC) $(ARCH_FLAGS) $(CFLAGS_DEBUG) "$<" -c -o "$@"
283 $(OBJROOT)/%.profile.o : $(SRCROOT)/%.s $(DEPEND_HEADERS)
284 $(SILENT) $(ECHO) " ... $<"
285 $(SILENT) $(CC) $(ARCH_FLAGS) $(CFLAGS_PROFILE) "$<" -c -o "$@"
287 # Additional dependency: objc-msg.s depends on objc-msg-ppc.s and
288 # objc-msg-i386.s, which it includes.
289 $(OBJROOT)/runtime/Messengers.subproj/objc-msg.opt.o \
290 $(OBJROOT)/runtime/Messengers.subproj/objc-msg.debug.o \
291 $(OBJROOT)/runtime/Messengers.subproj/objc-msg.profile.o : \
292 $(SRCROOT)/runtime/Messengers.subproj/objc-msg-ppc.s \
293 $(SRCROOT)/runtime/Messengers.subproj/objc-msg-ppc64.s \
294 $(SRCROOT)/runtime/Messengers.subproj/objc-msg-i386.s \
295 $(SRCROOT)/runtime/Messengers.subproj/objc-msg-x86_64.s
297 # Additional dependency: objc-msg-sutb.s depends on objc-msg-stub-ppc.s and
298 # objc-msg-stub-i386.s, which it includes.
299 $(OBJROOT)/runtime/Messengers.subproj/objc-msg-stub.opt.o \
300 $(OBJROOT)/runtime/Messengers.subproj/objc-msg-stub.debug.o \
301 $(OBJROOT)/runtime/Messengers.subproj/objc-msg-stub.profile.o : \
302 $(SRCROOT)/runtime/Messengers.subproj/objc-msg-stub-ppc.s \
303 $(SRCROOT)/runtime/Messengers.subproj/objc-msg-stub-ppc64.s \
304 $(SRCROOT)/runtime/Messengers.subproj/objc-msg-stub-i386.s \
305 $(SRCROOT)/runtime/Messengers.subproj/objc-msg-stub-x86_64.s
307 # Additional dependency: objc-auto.s depends on objc-auto-ppc.s and
308 # objc-auto-i386.s, which it includes.
309 $(OBJROOT)/runtime/Auto.subproj/objc-auto.opt.o \
310 $(OBJROOT)/runtime/Auto.subproj/objc-auto.debug.o \
311 $(OBJROOT)/runtime/Auto.subproj/objc-auto.profile.o : \
312 $(SRCROOT)/runtime/Auto.subproj/objc-auto-ppc.s \
313 $(SRCROOT)/runtime/Auto.subproj/objc-auto-ppc64.s \
314 $(SRCROOT)/runtime/Auto.subproj/objc-auto-i386.s \
315 $(SRCROOT)/runtime/Auto.subproj/objc-auto-x86_64.s
317 # Additional rules: objc-rtp-sym.s needs to be built with a per-arch seg1addr,
318 # and need to be stripped here because stripping the dylib does not remove
319 # debug info from the magic sections.
320 # objc-rtp-sym.s is not in SOURCES, and objc-rtp-sym.o is not in OBJECTS
321 $(OBJROOT)/runtime/objc-rtp-sym.ppc.o: $(SRCROOT)/runtime/objc-rtp-sym.s
322 $(SILENT) $(CC) $(CFLAGS_OPTIMIZED) -arch ppc "$<" -c -o "$@.temp"
323 $(SILENT) $(STRIP) -S "$@.temp"
324 $(SILENT) $(LD) -arch ppc -seg1addr 0xfffec000 "$@.temp" -r -o "$@"
326 $(OBJROOT)/runtime/objc-rtp-sym.ppc64.o: $(SRCROOT)/runtime/objc-rtp-sym.s
327 $(SILENT) $(CC) $(CFLAGS_OPTIMIZED) -arch ppc64 "$<" -c -o "$@.temp"
328 $(SILENT) $(STRIP) -S "$@.temp"
329 $(SILENT) $(LD) -arch ppc64 -seg1addr 0xfffffffffffec000 "$@.temp" -r -o "$@"
331 $(OBJROOT)/runtime/objc-rtp-sym.i386.o: $(SRCROOT)/runtime/objc-rtp-sym.s
332 $(SILENT) $(CC) $(CFLAGS_OPTIMIZED) -arch i386 "$<" -c -o "$@.temp"
333 $(SILENT) $(STRIP) -S "$@.temp"
334 $(SILENT) $(LD) -arch i386 -seg1addr 0xfffe8000 "$@.temp" -r -o "$@"
336 $(OBJROOT)/runtime/objc-rtp-sym.x86_64.o: $(SRCROOT)/runtime/objc-rtp-sym.s
337 $(SILENT) $(CC) $(CFLAGS_OPTIMIZED) -arch x86_64 "$<" -c -o "$@.temp"
338 $(SILENT) $(STRIP) -S "$@.temp"
339 $(SILENT) $(LD) -arch x86_64 -seg1addr 0xfffffffffffec000 "$@.temp" -r -o "$@"
341 # Additional rule: markgc tool to pretend we compiled with GC write-barriers
342 $(MARKGC): $(SRCROOT)/markgc.c
343 $(SILENT) $(ECHO) "Building markgc tool ..."
344 $(SILENT) $(CC) -std=gnu99 "$<" -o "$@"
346 # Additional linkage: LP64 targets require libstdc++
347 LIBS_ppc64 = -lstdc++
348 LIBS_x86_64 = -lstdc++
350 # These are the main targets:
351 # build builds the library to OBJROOT and SYMROOT
352 # installsrc copies the sources to SRCROOT
353 # installhdrs install only the headers to DSTROOT
354 # install build, then install the headers and library to DSTROOT
355 # clean removes build products in OBJROOT and SYMROOT
357 # optimized same as 'build' but builds optimized library only
358 # debug same as 'build' but builds debug library only
359 # profile same as 'build' but builds profile library only
361 # Default build doesn't currently build the debug library.
362 build: prebuild build-optimized build-profile postbuild
364 optimized: prebuild build-optimized postbuild
365 debug: prebuild build-debug postbuild
366 profile: prebuild build-profile postbuild
369 $(SILENT) $(ECHO) "Installing source from . to $(SRCROOT)..."
370 ifeq "$(SRCROOT)" "."
371 $(SILENT) $(ECHO) "SRCROOT must be defined to be the destination directory; it cannot be '.'"
374 $(SILENT) $(TAR) -cf $(SRCROOT)/objc4.sources.tar $(SOURCES) $(PUBLIC_HEADERS) $(PRIVATE_HEADERS) $(OTHER_HEADERS) $(OTHER_SOURCES) $(MODULE_SOURCES)
375 $(SILENT) $(CD) $(SRCROOT) && $(TAR) -xf $(SRCROOT)/objc4.sources.tar
376 $(SILENT) $(REMOVE) -f $(SRCROOT)/objc4.sources.tar
379 $(SILENT) $(ECHO) "Installing headers from $(SRCROOT) to $(DSTROOT)/$(HEADER_INSTALLDIR)..."
381 $(SILENT) $(MKDIRS) $(DSTROOT)/$(PUBLIC_HEADER_INSTALLDIR)
382 -$(SILENT) $(CHMOD) +w $(DSTROOT)/$(PUBLIC_HEADER_INSTALLDIR)/*.h
383 $(SILENT) $(COPY) $(addprefix $(SRCROOT)/, $(PUBLIC_HEADERS) ) \
384 $(DSTROOT)/$(PUBLIC_HEADER_INSTALLDIR)
385 # duplicate hashtable2.h to hashtable.h
386 $(SILENT) $(COPY) $(DSTROOT)/$(PUBLIC_HEADER_INSTALLDIR)/hashtable2.h \
387 $(DSTROOT)/$(PUBLIC_HEADER_INSTALLDIR)/hashtable.h
388 $(SILENT) $(CHMOD) -w $(DSTROOT)/$(PUBLIC_HEADER_INSTALLDIR)/*.h
389 $(SILENT) $(CHMOD) a+r $(DSTROOT)/$(PUBLIC_HEADER_INSTALLDIR)/*.h
391 $(SILENT) $(MKDIRS) $(DSTROOT)/$(OTHER_HEADER_INSTALLDIR)
392 -$(SILENT) $(CHMOD) +w $(DSTROOT)/$(OTHER_HEADER_INSTALLDIR)/*.h
393 $(SILENT) $(COPY) $(addprefix $(SRCROOT)/, $(OTHER_HEADERS) ) \
394 $(DSTROOT)/$(OTHER_HEADER_INSTALLDIR)
395 $(SILENT) $(CHMOD) -w $(DSTROOT)/$(OTHER_HEADER_INSTALLDIR)/*.h
396 $(SILENT) $(CHMOD) a+r $(DSTROOT)/$(OTHER_HEADER_INSTALLDIR)/*.h
399 $(SILENT) $(RM) -f $(DSTROOT)$(PUBLIC_HEADER_DIR)$(PUBLIC_HEADER_DIR_SUFFIX)/hashtable.h
402 install: build installhdrs
403 $(SILENT) $(ECHO) "Installing products from $(SYMROOT) to $(DSTROOT)..."
405 $(SILENT) $(MKDIRS) $(DSTROOT)/$(INSTALLDIR)
406 -$(SILENT) $(CHMOD) +w $(DSTROOT)/$(INSTALLDIR)
408 $(SILENT) $(REMOVE) -f $(DSTROOT)/$(INSTALLDIR)/libobjc.$(VERSION_NAME)$(LIBRARY_EXT)
409 $(SILENT) $(REMOVE) -f $(DSTROOT)/$(INSTALLDIR)/libobjc_debug.$(VERSION_NAME)$(LIBRARY_EXT)
410 $(SILENT) $(REMOVE) -f $(DSTROOT)/$(INSTALLDIR)/libobjc_profile.$(VERSION_NAME)$(LIBRARY_EXT)
413 $(SILENT) $(COPY) $(SYMROOT)/libobjc.$(VERSION_NAME)$(LIBRARY_EXT) $(DSTROOT)/$(INSTALLDIR)
414 $(SILENT) $(STRIP) -S $(DSTROOT)/$(INSTALLDIR)/libobjc.$(VERSION_NAME)$(LIBRARY_EXT)
415 -$(SILENT) $(CHOWN) root:wheel $(DSTROOT)/$(INSTALLDIR)/libobjc.$(VERSION_NAME)$(LIBRARY_EXT)
416 $(SILENT) $(CHMOD) 755 $(DSTROOT)/$(INSTALLDIR)/libobjc.$(VERSION_NAME)$(LIBRARY_EXT)
417 $(SILENT) $(CD) $(DSTROOT)/$(INSTALLDIR) && \
418 $(SYMLINK) libobjc.$(VERSION_NAME)$(LIBRARY_EXT) libobjc$(LIBRARY_EXT)
420 # debug (allowed not to exist)
421 -$(SILENT) $(COPY) $(SYMROOT)/libobjc_debug.$(VERSION_NAME)$(LIBRARY_EXT) $(DSTROOT)/$(INSTALLDIR)
422 -$(SILENT) $(CHOWN) root:wheel $(DSTROOT)/$(INSTALLDIR)/libobjc_debug.$(VERSION_NAME)$(LIBRARY_EXT)
423 -$(SILENT) $(CHMOD) 755 $(DSTROOT)/$(INSTALLDIR)/libobjc_debug.$(VERSION_NAME)$(LIBRARY_EXT)
424 -$(SILENT) $(CD) $(DSTROOT)/$(INSTALLDIR) && \
425 test -e libobjc_debug.$(VERSION_NAME)$(LIBRARY_EXT) && \
426 $(SYMLINK) libobjc_debug.$(VERSION_NAME)$(LIBRARY_EXT) libobjc_debug$(LIBRARY_EXT) && \
427 $(SYMLINK) libobjc_debug.$(VERSION_NAME)$(LIBRARY_EXT) libobjc.$(VERSION_NAME)_debug$(LIBRARY_EXT)
430 # profile (allowed not to exist)
431 -$(SILENT) $(COPY) $(SYMROOT)/libobjc_profile.$(VERSION_NAME)$(LIBRARY_EXT) $(DSTROOT)/$(INSTALLDIR)
432 -$(SILENT) $(CHOWN) root:wheel $(DSTROOT)/$(INSTALLDIR)/libobjc_profile.$(VERSION_NAME)$(LIBRARY_EXT)
433 -$(SILENT) $(CHMOD) 755 $(DSTROOT)/$(INSTALLDIR)/libobjc_profile.$(VERSION_NAME)$(LIBRARY_EXT)
434 -$(SILENT) $(CD) $(DSTROOT)/$(INSTALLDIR) && \
435 test -e libobjc_profile.$(VERSION_NAME)$(LIBRARY_EXT) && \
436 $(SYMLINK) libobjc_profile.$(VERSION_NAME)$(LIBRARY_EXT) libobjc_profile$(LIBRARY_EXT) && \
437 $(SYMLINK) libobjc_profile.$(VERSION_NAME)$(LIBRARY_EXT) libobjc.$(VERSION_NAME)_profile$(LIBRARY_EXT)
441 $(SILENT) $(ECHO) "Deleting build products..."
442 $(SILENT) $(REMOVE) -f \
443 $(foreach A, $(ARCH_LIST), \
444 $(OBJROOT)/libobjc_debug.$A.$(VERSION_NAME)$(LIBRARY_EXT) \
445 $(OBJROOT)/libobjc_profile.$A.$(VERSION_NAME)$(LIBRARY_EXT) \
446 $(OBJROOT)/libobjc.$A.$(VERSION_NAME)$(LIBRARY_EXT) \
447 $(OBJROOT)/runtime/objc-rtp-sym.$A.o \
448 $(OBJROOT)/runtime/objc-rtp-sym.$A.o.temp \
451 $(SILENT) $(REMOVE) -f $(SYMROOT)/libobjc.optimized.o
452 $(SILENT) $(REMOVE) -f $(SYMROOT)/libobjc.debug.o
453 $(SILENT) $(REMOVE) -f $(SYMROOT)/libobjc.profile.o
455 $(SILENT) $(REMOVE) -f $(SYMROOT)/libobjc.$(VERSION_NAME)$(LIBRARY_EXT)
456 $(SILENT) $(REMOVE) -f $(SYMROOT)/libobjc_debug.$(VERSION_NAME)$(LIBRARY_EXT)
457 $(SILENT) $(REMOVE) -f $(SYMROOT)/libobjc_profile.$(VERSION_NAME)$(LIBRARY_EXT)
459 $(SILENT) $(REMOVE) -f $(OBJECTS_OPTIMIZED)
460 $(SILENT) $(REMOVE) -f $(OBJECTS_DEBUG)
461 $(SILENT) $(REMOVE) -f $(OBJECTS_PROFILE)
463 $(SILENT) $(REMOVE) -f $(MODULE_OBJECTS_OPTIMIZED)
464 $(SILENT) $(REMOVE) -f $(MODULE_OBJECTS_DEBUG)
465 $(SILENT) $(REMOVE) -f $(MODULE_OBJECTS_PROFILE)
467 $(SILENT) $(REMOVE) -rf $(SYMROOT)/ProjectHeaders
469 $(SILENT) $(REMOVE) -f $(MARKGC)
472 $(SILENT) $(ECHO) "Prebuild-setup..."
474 # Install headers into $(SYMROOT)/ProjectHeaders so #includes can find them
475 # even if they're not installed in /usr.
476 $(SILENT) $(MKDIRS) $(SYMROOT)
477 $(SILENT) $(REMOVE_RECUR) $(SYMROOT)/ProjectHeaders
478 $(SILENT) $(MKDIRS) $(SYMROOT)/ProjectHeaders
479 $(SILENT) $(ECHO) "Copying headers from $(SRCROOT) to $(SYMROOT)/ProjectHeaders..."
480 $(SILENT) $(COPY) $(addprefix $(SRCROOT)/, $(PRIVATE_HEADERS) ) $(SYMROOT)/ProjectHeaders
481 $(SILENT) $(MKDIRS) $(SYMROOT)/ProjectHeaders/objc
482 $(SILENT) $(COPY) $(addprefix $(SRCROOT)/, $(PUBLIC_HEADERS) ) $(SYMROOT)/ProjectHeaders/objc
483 $(SILENT) $(COPY) $(addprefix $(SRCROOT)/, $(OTHER_HEADERS) ) $(SYMROOT)/ProjectHeaders/objc
487 build-optimized: prebuild-optimized compile-optimized link-optimized
488 build-debug: prebuild-debug compile-debug link-debug
489 build-profile: prebuild-profile compile-profile link-profile
493 $(SILENT) $(ECHO) "Building (optimized) ..."
494 $(SILENT) $(MKDIRS) $(foreach S, $(SUBDIRS), $(OBJROOT)/$(S) )
497 $(SILENT) $(ECHO) "Building (debug) ..."
498 $(SILENT) $(MKDIRS) $(foreach S, $(SUBDIRS), $(OBJROOT)/$(S) )
501 $(SILENT) $(ECHO) "Building (profile) ..."
502 $(SILENT) $(MKDIRS) $(foreach S, $(SUBDIRS), $(OBJROOT)/$(S) )
505 compile-optimized: $(OBJECTS_OPTIMIZED) $(MODULE_OBJECTS_OPTIMIZED) $(foreach A, $(ARCH_LIST), $(OBJROOT)/runtime/objc-rtp-sym.$A.o )
506 compile-debug: $(OBJECTS_DEBUG) $(MODULE_OBJECTS_DEBUG) $(foreach A, $(ARCH_LIST), $(OBJROOT)/runtime/objc-rtp-sym.$A.o )
507 compile-profile: $(OBJECTS_PROFILE) $(MODULE_OBJECTS_PROFILE) $(foreach A, $(ARCH_LIST), $(OBJROOT)/runtime/objc-rtp-sym.$A.o )
510 # link lib-suffix, LDFLAGS, OBJECTS, MODULE_OBJECTS
511 # libsuffix should be "" or _debug or _profile
512 ifeq "$(PLATFORM)" "Darwin"
515 $(foreach A, $(ARCH_LIST), \
518 -o $(OBJROOT)/libobjc$1.$A.o \
524 -sectcreate __DATA __commpage $(OBJROOT)/runtime/objc-rtp-sym.$A.o \
525 -install_name /$(INSTALLDIR)/libobjc$1.$(VERSION_NAME)$(LIBRARY_EXT) \
526 -o $(OBJROOT)/libobjc$1.$A.$(VERSION_NAME)$(LIBRARY_EXT) \
527 $(OBJROOT)/libobjc$1.$A.o $4 ; \
530 -create -output $(SYMROOT)/libobjc$1.$(VERSION_NAME)$(LIBRARY_EXT) \
531 $(foreach A, $(ARCH_LIST), -arch $A $(OBJROOT)/libobjc$1.$A.$(VERSION_NAME)$(LIBRARY_EXT) )
537 $(SILENT) $(ECHO) "Don't know how to link for platform '$(PLATFORM)'"
544 $(SILENT) $(ECHO) "Linking (optimized)..."
545 $(call link,,$(LDFLAGS_OPTIMIZED),$(OBJECTS_OPTIMIZED),$(MODULE_OBJECTS_OPTIMIZED) )
548 $(SILENT) $(ECHO) "Linking (debug)..."
549 $(call link,_debug,$(LDFLAGS_DEBUG),$(OBJECTS_DEBUG),$(MODULE_OBJECTS_DEBUG) )
552 $(SILENT) $(ECHO) "Linking (profile)..."
553 $(call link,_profile,$(LDFLAGS_PROFILE),$(OBJECTS_PROFILE),$(MODULE_OBJECTS_PROFILE) )
557 $(SILENT) $(ECHO) "Done!"