Commit | Line | Data |
---|---|---|
9ce05555 A |
1 | # Simple makefile for building CoreFoundation on Darwin |
2 | # | |
3 | # These make variables (or environment variables) are used | |
4 | # if defined: | |
5 | # SRCROOT path location of root of source hierarchy; | |
6 | # defaults to ".", but must be set to a | |
7 | # destination path for installsrc target. | |
8 | # OBJROOT path location where .o files will be put; | |
9 | # defaults to "/tmp/CoreFoundation.obj". | |
10 | # SYMROOT path location where build products will be | |
11 | # put; defaults to "/tmp/CoreFoundation.sym". | |
12 | # DSTROOT path location where installed products will | |
13 | # be put; defaults to "/tmp/CoreFoundation.dst". | |
14 | # OBJROOT and SYMROOT should not be directories shared with other | |
15 | # built projects, and should not be the same directory. | |
16 | # PLATFORM name of platform being built on | |
17 | # USER name of user building the project | |
18 | # ARCHS list of archs for which to build | |
19 | # RC_ARCHS more archs for which to build (build system) | |
20 | # OTHER_CFLAGS other flags to be passed to compiler | |
21 | # RC_CFLAGS more flags to be passed to compiler (build system) | |
22 | # OTHER_LFLAGS other flags to be passed to the link stage | |
23 | # | |
24 | ||
fe65cb98 | 25 | CURRENT_PROJECT_VERSION = 299.3 |
9ce05555 A |
26 | |
27 | # First figure out the platform if not specified, so we can use it in the | |
28 | # rest of this file. Currently defined values: Darwin, Linux, FreeBSD, WIN32 | |
29 | ifeq "$(PLATFORM)" "" | |
30 | PLATFORM := $(shell uname) | |
31 | endif | |
32 | ||
33 | ifeq "$(PLATFORM)" "Darwin" | |
34 | PLATFORM_CFLAGS = -D__MACH__=1 -fconstant-cfstrings | |
35 | endif | |
36 | ||
37 | ifeq "$(PLATFORM)" "Linux" | |
38 | PLATFORM_CFLAGS = -D__LINUX__=1 | |
39 | endif | |
40 | ||
41 | ifeq "$(PLATFORM)" "FreeBSD" | |
42 | PLATFORM_CFLAGS = -D__FREEBSD__=1 | |
43 | endif | |
44 | ||
45 | ifeq "$(PLATFORM)" "WIN32" | |
46 | PLATFORM_CFLAGS = -D__WIN32__=1 | |
47 | OBJROOT = CoreFoundation.obj | |
48 | SYMROOT = CoreFoundation.sym | |
49 | DSTROOT = CoreFoundation.dst | |
50 | endif | |
51 | ||
52 | ifndef SRCROOT | |
53 | SRCROOT = . | |
54 | endif | |
55 | ||
56 | ifndef OBJROOT | |
57 | OBJROOT = /tmp/CoreFoundation.obj | |
58 | endif | |
59 | ||
60 | ifndef SYMROOT | |
61 | SYMROOT = /tmp/CoreFoundation.sym | |
62 | endif | |
63 | ||
64 | ifndef DSTROOT | |
65 | DSTROOT = /tmp/CoreFoundation.dst | |
66 | endif | |
67 | ||
68 | SILENT = @ | |
69 | ifeq "$(PLATFORM)" "WIN32" | |
70 | CC = gcc | |
71 | ECHO = echo | |
72 | MKDIRS = mkdir -p | |
73 | COPY = cp | |
74 | COPY_RECUR = cp -r | |
75 | REMOVE = rm | |
76 | REMOVE_RECUR = rm -rf | |
77 | SYMLINK = ln -s | |
78 | CHMOD = chmod | |
79 | CHOWN = chown | |
80 | TAR = tar | |
81 | STRIP = strip | |
82 | DLLTOOL = dlltool | |
83 | else | |
84 | ifeq "$(PLATFORM)" "Darwin" | |
85 | CC = /usr/bin/cc | |
86 | else | |
87 | CC = /usr/bin/gcc | |
88 | endif | |
89 | ECHO = /bin/echo | |
90 | MKDIRS = /bin/mkdir -p | |
91 | COPY = /bin/cp | |
92 | COPY_RECUR = /bin/cp -r | |
93 | REMOVE = /bin/rm | |
94 | REMOVE_RECUR = /bin/rm -rf | |
95 | SYMLINK = /bin/ln -s | |
96 | CHMOD = /bin/chmod | |
97 | CHOWN = /usr/sbin/chown | |
98 | TAR = /usr/bin/tar | |
99 | STRIP = /usr/bin/strip | |
100 | endif | |
101 | ||
102 | ifeq "$(PLATFORM)" "Darwin" | |
103 | WARNING_FLAGS = -Wno-precomp -Wno-four-char-constants | |
104 | endif | |
105 | ||
106 | ifeq "$(PLATFORM)" "Darwin" | |
107 | ifneq "$(ARCHS)" "" | |
108 | ARCH_FLAGS = $(foreach A, $(ARCHS), $(addprefix -arch , $(A))) | |
109 | else | |
110 | ifneq "$(RC_ARCHS)" "" | |
111 | ARCH_FLAGS = $(foreach A, $(RC_ARCHS), $(addprefix -arch , $(A))) | |
112 | else | |
113 | ARCH_FLAGS = -arch ppc | |
114 | endif | |
115 | endif | |
116 | endif | |
117 | ||
118 | ifeq "$(PLATFORM)" "FreeBSD" | |
119 | ARCH_FLAGS = -march=i386 | |
120 | endif | |
121 | ||
122 | ifeq "$(PLATFORM)" "Linux" | |
123 | ARCH_FLAGS = | |
124 | endif | |
125 | ||
126 | ifeq "$(USER)" "" | |
127 | USER = unknown | |
128 | endif | |
129 | ||
130 | CFLAGS = -DCF_BUILDING_CF=1 -g -fno-common -pipe $(PLATFORM_CFLAGS) \ | |
131 | $(WARNING_FLAGS) -I$(SYMROOT)/ProjectHeaders -I. | |
132 | ||
133 | ifeq "$(PLATFORM)" "WIN32" | |
134 | LFLAGS = -lmsvcrt -lnetapi32 -lobjc -lole32 -lws2_32 | |
135 | else | |
136 | LFLAGS = | |
137 | endif | |
138 | ||
139 | ifeq "$(wildcard /System/Library/Frameworks)" "" | |
140 | LIBRARY_STYLE = Library | |
141 | LIBRARY_EXT = .so | |
142 | ifeq "$(PLATFORM)" "Linux" | |
143 | LIBRARY_EXT = .a | |
144 | endif | |
145 | ifeq "$(PLATFORM)" "WIN32" | |
146 | LIBRARY_EXT = .dll | |
147 | endif | |
148 | HEADER_INSTALLDIR = /usr/local/include/CoreFoundation | |
149 | INSTALLDIR = /usr/local/lib | |
150 | CHARACTERSETS_INSTALLDIR = /usr/local/share/CoreFoundation | |
151 | else | |
152 | LIBRARY_STYLE = Framework | |
153 | INSTALLDIR = /System/Library/Frameworks | |
154 | FRAMEWORK_DIR = /System/Library/Frameworks/CoreFoundation.framework | |
155 | CHARACTERSETS_INSTALLDIR = /System/Library/CoreServices | |
156 | endif | |
157 | ||
158 | ifeq "$(PLATFORM)" "Darwin" | |
159 | CFLAGS += $(ARCH_FLAGS) -F$(SYMROOT) | |
160 | LFLAGS += $(ARCH_FLAGS) -dynamiclib -dynamic -compatibility_version 150 \ | |
161 | -current_version $(CURRENT_PROJECT_VERSION) -Wl,-init,___CFInitialize | |
162 | endif | |
163 | ||
164 | ifeq "$(PLATFORM)" "FreeBSD" | |
165 | LFLAGS += -shared | |
166 | endif | |
167 | ||
168 | ifeq "$(PLATFORM)" "Linux" | |
169 | LFLAGS += -lpthread | |
170 | endif | |
171 | ||
172 | CFLAGS += $(OTHER_CFLAGS) $(RC_CFLAGS) | |
173 | LFLAGS += $(OTHER_LFLAGS) | |
174 | ||
175 | ||
176 | SUBPROJECTS = AppServices Base Collections Locale NumberDate Parsing PlugIn \ | |
177 | RunLoop String StringEncodings URL | |
178 | ||
179 | AppServices_PUBHEADERS = CFUserNotification.h | |
180 | AppServices_SOURCES = CFUserNotification.c | |
181 | Base_PROJHEADERS = CFPriv.h CFInternal.h ForFoundationOnly.h CFRuntime.h \ | |
182 | CFUtilities.h | |
183 | Base_PUBHEADERS = CFBase.h CFByteOrder.h CoreFoundation.h CFUUID.h | |
184 | Base_SOURCES = CFBase.c CFUtilities.c CFSortFunctions.c \ | |
185 | CFRuntime.c CFFileUtilities.c CFPlatform.c CFUUID.c uuid.c | |
186 | Collections_PROJHEADERS = CFStorage.h | |
187 | Collections_PUBHEADERS = CFArray.h CFBag.h CFBinaryHeap.h CFBitVector.h \ | |
188 | CFData.h CFDictionary.h CFSet.h CFTree.h | |
189 | Collections_SOURCES = CFArray.c CFBag.c CFBinaryHeap.c CFBitVector.c \ | |
190 | CFData.c CFDictionary.c CFSet.c CFStorage.c CFTree.c | |
191 | Locale_PUBHEADERS = CFLocale.h | |
192 | NumberDate_PROJHEADERS = | |
193 | NumberDate_PUBHEADERS = CFDate.h CFNumber.h CFTimeZone.h | |
194 | NumberDate_SOURCES = CFDate.c CFNumber.c CFTimeZone.c | |
195 | Parsing_PROJHEADERS = CFXMLInputStream.h | |
196 | Parsing_PUBHEADERS = CFPropertyList.h CFXMLParser.h CFXMLNode.h | |
197 | Parsing_SOURCES = CFBinaryPList.c CFPropertyList.c CFXMLParser.c \ | |
198 | CFXMLInputStream.c CFXMLNode.c CFXMLTree.c | |
199 | PlugIn_PROJHEADERS = CFBundlePriv.h CFBundle_BinaryTypes.h CFBundle_Internal.h \ | |
200 | CFPlugIn_Factory.h | |
201 | PlugIn_PUBHEADERS = CFBundle.h CFPlugIn.h CFPlugInCOM.h | |
202 | PlugIn_SOURCES = CFBundle.c CFBundle_Resources.c CFPlugIn.c CFPlugIn_Factory.c \ | |
203 | CFPlugIn_Instance.c CFPlugIn_PlugIn.c | |
204 | ifeq "$(PLATFORM)" "Darwin" | |
205 | RunLoop_PROJHEADERS = CFWindowsMessageQueue.h | |
206 | RunLoop_PUBHEADERS = CFRunLoop.h CFSocket.h CFMachPort.h CFMessagePort.h | |
207 | RunLoop_SOURCES = CFMachPort.c CFMessagePort.c CFRunLoop.c CFSocket.c \ | |
208 | CFWindowsMessageQueue.c | |
209 | endif | |
210 | ifeq "$(PLATFORM)" "WIN32" | |
211 | RunLoop_PROJHEADERS = | |
212 | RunLoop_PUBHEADERS = CFRunLoop.h CFMachPort.h CFMessagePort.h | |
213 | RunLoop_SOURCES = CFMachPort.c CFMessagePort.c CFRunLoop.c | |
214 | endif | |
215 | String_PROJHEADERS = CFCharacterSetPriv.h | |
216 | String_PUBHEADERS = CFCharacterSet.h CFString.h | |
217 | String_SOURCES = CFCharacterSet.c CFString.c CFStringEncodings.c \ | |
218 | CFStringScanner.c CFStringUtilities.c | |
219 | StringEncodings_PROJHEADERS = CFStringEncodingConverter.h CFUniChar.h \ | |
220 | CFStringEncodingConverterExt.h CFUniCharPriv.h \ | |
221 | CFStringEncodingConverterPriv.h CFUnicodeDecomposition.h \ | |
222 | CFUnicodePrecomposition.h | |
223 | StringEncodings_PUBHEADERS = | |
224 | StringEncodings_SOURCES = CFStringEncodingConverter.c CFBuiltinConverters.c \ | |
225 | CFUnicodeDecomposition.c CFUnicodePrecomposition.c CFUniChar.c | |
226 | URL_PROJHEADERS = | |
227 | URL_PUBHEADERS = CFURL.h CFURLAccess.h | |
228 | URL_SOURCES = CFURL.c CFURLAccess.c | |
229 | ||
230 | OTHER_SOURCES = version.c Makefile APPLE_LICENSE PropertyList.dtd | |
231 | ||
232 | default: build | |
233 | all: build | |
234 | build: prebuild actual-build postbuild | |
235 | ||
236 | # These are the main targets: | |
237 | # build builds the library to OBJROOT and SYMROOT | |
238 | # installsrc copies the sources to SRCROOT | |
239 | # installhdrs install only the headers to DSTROOT | |
240 | # install build, then install the headers and library to DSTROOT | |
241 | # clean removes build products in OBJROOT and SYMROOT | |
242 | ||
243 | installsrc: | |
244 | $(SILENT) $(ECHO) "Installing source..." | |
245 | ifeq "$(SRCROOT)" "." | |
246 | $(SILENT) $(ECHO) "SRCROOT must be defined to be the destination directory; it cannot be '.'" | |
247 | exit 1 | |
248 | endif | |
249 | $(SILENT) $(MKDIRS) $(SRCROOT) | |
250 | $(SILENT) $(MKDIRS) $(foreach S, $(SUBPROJECTS), $(SRCROOT)/$(S).subproj) | |
251 | -$(SILENT) $(foreach S, $(SUBPROJECTS), $(COPY) $(foreach F, $($(S)_SOURCES), $(S).subproj/$(F)) $(SRCROOT)/$(S).subproj;) | |
252 | -$(SILENT) $(foreach S, $(SUBPROJECTS), $(COPY) $(foreach F, $($(S)_PROJHEADERS), $(S).subproj/$(F)) $(SRCROOT)/$(S).subproj;) | |
253 | -$(SILENT) $(foreach S, $(SUBPROJECTS), $(COPY) $(foreach F, $($(S)_PUBHEADERS), $(S).subproj/$(F)) $(SRCROOT)/$(S).subproj;) | |
254 | $(SILENT) $(COPY) $(OTHER_SOURCES) $(SRCROOT) | |
255 | $(SILENT) $(COPY_RECUR) CharacterSets $(SRCROOT) | |
256 | $(SILENT) $(REMOVE_RECUR) $(SRCROOT)/CharacterSets/CVS | |
257 | ||
258 | installhdrs: | |
259 | $(SILENT) $(ECHO) "Installing headers..." | |
260 | ifeq "$(LIBRARY_STYLE)" "Framework" | |
261 | $(SILENT) $(REMOVE) -f $(DSTROOT)/$(FRAMEWORK_DIR)/Headers | |
262 | $(SILENT) $(REMOVE) -f $(DSTROOT)/$(FRAMEWORK_DIR)/PrivateHeaders | |
263 | $(SILENT) $(REMOVE) -f $(DSTROOT)/$(FRAMEWORK_DIR)/Versions/Current | |
264 | $(SILENT) $(MKDIRS) $(DSTROOT)/$(FRAMEWORK_DIR)/Versions/A/Headers | |
265 | $(SILENT) $(MKDIRS) $(DSTROOT)/$(FRAMEWORK_DIR)/Versions/A/PrivateHeaders | |
266 | $(SILENT) $(SYMLINK) A $(DSTROOT)/$(FRAMEWORK_DIR)/Versions/Current | |
267 | $(SILENT) $(SYMLINK) Versions/Current/Headers $(DSTROOT)/$(FRAMEWORK_DIR)/Headers | |
268 | $(SILENT) $(SYMLINK) Versions/Current/PrivateHeaders $(DSTROOT)/$(FRAMEWORK_DIR)/PrivateHeaders | |
269 | -$(SILENT) $(CHMOD) +w $(DSTROOT)/$(FRAMEWORK_DIR)/Versions/A/Headers/*.h | |
270 | -$(SILENT) $(CHMOD) +w $(DSTROOT)/$(FRAMEWORK_DIR)/Versions/A/PrivateHeaders/*.h | |
271 | $(SILENT) $(COPY) $(foreach S, $(SUBPROJECTS), $(foreach F, $($(S)_PUBHEADERS), $(SRCROOT)/$(S).subproj/$(F))) $(DSTROOT)/$(FRAMEWORK_DIR)/Versions/A/Headers | |
272 | $(SILENT) $(COPY) Base.subproj/CFPriv.h Base.subproj/CFRuntime.h $(DSTROOT)/$(FRAMEWORK_DIR)/Versions/A/PrivateHeaders | |
273 | $(SILENT) $(CHOWN) -R root:wheel $(DSTROOT)/$(FRAMEWORK_DIR) | |
274 | -$(SILENT) $(CHMOD) -w $(DSTROOT)/$(FRAMEWORK_DIR)/Versions/A/Headers/*.h | |
275 | -$(SILENT) $(CHMOD) -w $(DSTROOT)/$(FRAMEWORK_DIR)/Versions/A/PrivateHeaders/*.h | |
276 | endif | |
277 | ifeq "$(LIBRARY_STYLE)" "Library" | |
278 | $(SILENT) $(MKDIRS) $(DSTROOT)/$(HEADER_INSTALLDIR) | |
279 | -$(SILENT) $(CHMOD) +w $(DSTROOT)/$(HEADER_INSTALLDIR)/*.h | |
280 | $(SILENT) $(COPY) $(foreach S, $(SUBPROJECTS), $(foreach F, $($(S)_PUBHEADERS), $(SRCROOT)/$(S).subproj/$(F))) $(DSTROOT)/$(HEADER_INSTALLDIR) | |
281 | $(SILENT) $(CHMOD) -w $(DSTROOT)/$(HEADER_INSTALLDIR)/*.h | |
282 | endif | |
283 | ||
284 | install: build | |
285 | $(SILENT) $(ECHO) "Installing..." | |
286 | ifeq "$(LIBRARY_STYLE)" "Framework" | |
287 | $(SILENT) $(MKDIRS) $(DSTROOT)/$(FRAMEWORK_DIR) | |
288 | -$(SILENT) $(CHMOD) -R +w $(DSTROOT)/$(FRAMEWORK_DIR) | |
289 | $(SILENT) $(REMOVE_RECUR) $(DSTROOT)/$(FRAMEWORK_DIR) | |
290 | $(SILENT) (cd $(SYMROOT) && $(TAR) -cf - CoreFoundation.framework) | (cd $(DSTROOT)/$(INSTALLDIR) && $(TAR) -xf -) | |
291 | $(SILENT) $(STRIP) -S $(DSTROOT)/$(FRAMEWORK_DIR)/Versions/A/CoreFoundation | |
292 | $(SILENT) $(STRIP) -S $(DSTROOT)/$(FRAMEWORK_DIR)/Versions/A/CoreFoundation_debug | |
293 | $(SILENT) $(STRIP) -S $(DSTROOT)/$(FRAMEWORK_DIR)/Versions/A/CoreFoundation_profile | |
294 | $(SILENT) $(CHMOD) -R ugo-w $(DSTROOT)/$(FRAMEWORK_DIR) | |
295 | $(SILENT) $(CHMOD) -R o+rX $(DSTROOT)/$(FRAMEWORK_DIR) | |
296 | $(SILENT) $(CHOWN) -R root:wheel $(DSTROOT)/$(FRAMEWORK_DIR) | |
297 | endif | |
298 | ifeq "$(LIBRARY_STYLE)" "Library" | |
299 | $(SILENT) $(MKDIRS) $(DSTROOT)/$(INSTALLDIR) | |
300 | -$(SILENT) $(CHMOD) +w $(DSTROOT)/$(INSTALLDIR) | |
301 | $(SILENT) $(REMOVE) -f $(DSTROOT)/$(INSTALLDIR)/libCoreFoundation$(LIBRARY_EXT) | |
302 | $(SILENT) $(REMOVE) -f $(DSTROOT)/$(INSTALLDIR)/libCoreFoundation_debug$(LIBRARY_EXT) | |
303 | $(SILENT) $(REMOVE) -f $(DSTROOT)/$(INSTALLDIR)/libCoreFoundation_profile$(LIBRARY_EXT) | |
304 | $(SILENT) $(COPY) $(SYMROOT)/libCoreFoundation$(LIBRARY_EXT) $(DSTROOT)/$(INSTALLDIR)/libCoreFoundation$(LIBRARY_EXT) | |
305 | ifneq "$(LIBRARY_EXT)" ".a" | |
306 | $(SILENT) $(COPY) $(SYMROOT)/libCoreFoundation_debug$(LIBRARY_EXT) $(DSTROOT)/$(INSTALLDIR)/libCoreFoundation_debug$(LIBRARY_EXT) | |
307 | $(SILENT) $(COPY) $(SYMROOT)/libCoreFoundation_profile$(LIBRARY_EXT) $(DSTROOT)/$(INSTALLDIR)/libCoreFoundation_profile$(LIBRARY_EXT) | |
308 | endif | |
309 | -$(SILENT) $(CHOWN) root:wheel $(DSTROOT)/$(INSTALLDIR)/libCoreFoundation$(LIBRARY_EXT) | |
310 | -$(SILENT) $(CHOWN) root:wheel $(DSTROOT)/$(INSTALLDIR)/libCoreFoundation_debug$(LIBRARY_EXT) | |
311 | -$(SILENT) $(CHOWN) root:wheel $(DSTROOT)/$(INSTALLDIR)/libCoreFoundation_profile$(LIBRARY_EXT) | |
312 | $(SILENT) $(CHMOD) 755 $(DSTROOT)/$(INSTALLDIR)/libCoreFoundation$(LIBRARY_EXT) | |
313 | ifneq "$(LIBRARY_EXT)" ".a" | |
314 | $(SILENT) $(CHMOD) 755 $(DSTROOT)/$(INSTALLDIR)/libCoreFoundation_debug$(LIBRARY_EXT) | |
315 | $(SILENT) $(CHMOD) 755 $(DSTROOT)/$(INSTALLDIR)/libCoreFoundation_profile$(LIBRARY_EXT) | |
316 | endif | |
317 | $(SILENT) $(MKDIRS) $(DSTROOT)/$(HEADER_INSTALLDIR) | |
318 | -$(SILENT) $(CHMOD) +w $(DSTROOT)/$(HEADER_INSTALLDIR)/*.h | |
319 | $(SILENT) $(COPY) $(foreach S, $(SUBPROJECTS), $(foreach F, $($(S)_PUBHEADERS), $(SRCROOT)/$(S).subproj/$(F))) $(DSTROOT)/$(HEADER_INSTALLDIR) | |
320 | $(SILENT) $(CHMOD) -w $(DSTROOT)/$(HEADER_INSTALLDIR)/*.h | |
321 | endif | |
322 | $(SILENT) $(MKDIRS) $(DSTROOT)/$(CHARACTERSETS_INSTALLDIR) | |
323 | -$(SILENT) $(CHMOD) 755 $(DSTROOT)/$(CHARACTERSETS_INSTALLDIR) | |
324 | $(SILENT) $(MKDIRS) $(DSTROOT)/$(CHARACTERSETS_INSTALLDIR)/CharacterSets | |
325 | -$(SILENT) $(CHMOD) -R +w $(DSTROOT)/$(CHARACTERSETS_INSTALLDIR)/CharacterSets | |
326 | $(SILENT) $(REMOVE_RECUR) $(DSTROOT)/$(CHARACTERSETS_INSTALLDIR)/CharacterSets | |
327 | $(SILENT) $(COPY_RECUR) $(SRCROOT)/CharacterSets $(DSTROOT)/$(CHARACTERSETS_INSTALLDIR) | |
328 | $(SILENT) $(REMOVE_RECUR) $(DSTROOT)/$(CHARACTERSETS_INSTALLDIR)/CharacterSets/CVS | |
329 | $(SILENT) $(CHOWN) -R root:wheel $(DSTROOT)/$(CHARACTERSETS_INSTALLDIR)/CharacterSets | |
330 | $(SILENT) $(CHMOD) 444 $(DSTROOT)/$(CHARACTERSETS_INSTALLDIR)/CharacterSets/* | |
331 | $(SILENT) $(CHMOD) 755 $(DSTROOT)/$(CHARACTERSETS_INSTALLDIR)/CharacterSets | |
332 | ||
333 | clean: | |
334 | $(SILENT) $(ECHO) "Deleting build products..." | |
335 | $(SILENT) $(REMOVE_RECUR) $(SYMROOT)/ProjectHeaders | |
336 | ifeq "$(LIBRARY_STYLE)" "Framework" | |
337 | $(SILENT) $(REMOVE_RECUR) $(SYMROOT)/CoreFoundation.framework | |
338 | endif | |
339 | ifeq "$(LIBRARY_STYLE)" "Library" | |
340 | $(SILENT) $(REMOVE) -f $(SYMROOT)/libCoreFoundation$(LIBRARY_EXT) | |
341 | $(SILENT) $(REMOVE) -f $(SYMROOT)/libCoreFoundation_debug$(LIBRARY_EXT) | |
342 | $(SILENT) $(REMOVE) -f $(SYMROOT)/libCoreFoundation_profile$(LIBRARY_EXT) | |
343 | endif | |
344 | ifeq "$(PLATFORM)" "WIN32" | |
345 | $(SILENT) $(REMOVE) -f $(SYMROOT)/CoreFoundation*$(LIBRARY_EXT) | |
346 | $(SILENT) $(REMOVE) -f $(SYMROOT)/CoreFoundation*.lib | |
347 | endif | |
348 | $(SILENT) $(REMOVE) -f $(OBJROOT)/*.o | |
349 | ||
350 | prebuild: | |
351 | $(SILENT) $(ECHO) "Prebuild-setup..." | |
352 | ifeq "$(LIBRARY_STYLE)" "Framework" | |
353 | $(SILENT) $(MKDIRS) $(SYMROOT) | |
354 | $(SILENT) $(REMOVE_RECUR) $(SYMROOT)/ProjectHeaders | |
355 | $(SILENT) $(MKDIRS) $(SYMROOT)/ProjectHeaders | |
356 | # $(SILENT) $(REMOVE_RECUR) $(SYMROOT)/CoreFoundation.framework | |
357 | $(SILENT) $(REMOVE) -f $(SYMROOT)/CoreFoundation.framework/Versions/Current | |
358 | $(SILENT) $(REMOVE) -f $(SYMROOT)/CoreFoundation.framework/Headers | |
359 | $(SILENT) $(REMOVE) -f $(SYMROOT)/CoreFoundation.framework/PrivateHeaders | |
360 | $(SILENT) $(REMOVE) -f $(SYMROOT)/CoreFoundation.framework/Resources | |
361 | $(SILENT) $(MKDIRS) $(SYMROOT)/CoreFoundation.framework/Versions/A/Headers | |
362 | $(SILENT) $(MKDIRS) $(SYMROOT)/CoreFoundation.framework/Versions/A/PrivateHeaders | |
363 | $(SILENT) $(MKDIRS) $(SYMROOT)/CoreFoundation.framework/Versions/A/Resources | |
364 | $(SILENT) $(SYMLINK) A $(SYMROOT)/CoreFoundation.framework/Versions/Current | |
365 | $(SILENT) $(SYMLINK) Versions/Current/Headers $(SYMROOT)/CoreFoundation.framework/Headers | |
366 | $(SILENT) $(SYMLINK) Versions/Current/PrivateHeaders $(SYMROOT)/CoreFoundation.framework/PrivateHeaders | |
367 | $(SILENT) $(SYMLINK) Versions/Current/Resources $(SYMROOT)/CoreFoundation.framework/Resources | |
368 | $(SILENT) $(ECHO) "Copying headers..." | |
369 | $(SILENT) $(COPY) $(foreach S, $(SUBPROJECTS), $(foreach F, $($(S)_PROJHEADERS), $(SRCROOT)/$(S).subproj/$(F))) $(SYMROOT)/ProjectHeaders | |
370 | $(SILENT) $(COPY) $(foreach S, $(SUBPROJECTS), $(foreach F, $($(S)_PUBHEADERS), $(SRCROOT)/$(S).subproj/$(F))) $(SYMROOT)/CoreFoundation.framework/Versions/A/Headers | |
371 | $(SILENT) $(COPY) Base.subproj/CFPriv.h Base.subproj/CFRuntime.h $(SYMROOT)/CoreFoundation.framework/Versions/A/PrivateHeaders | |
372 | endif | |
373 | ifeq "$(LIBRARY_STYLE)" "Library" | |
374 | $(SILENT) $(MKDIRS) $(SYMROOT) | |
375 | $(SILENT) $(REMOVE_RECUR) $(SYMROOT)/ProjectHeaders | |
376 | $(SILENT) $(MKDIRS) $(SYMROOT)/ProjectHeaders | |
377 | $(SILENT) $(ECHO) "Copying headers..." | |
378 | $(SILENT) $(COPY) $(foreach S, $(SUBPROJECTS), $(foreach F, $($(S)_PROJHEADERS), $(SRCROOT)/$(S).subproj/$(F))) $(SYMROOT)/ProjectHeaders | |
379 | $(SILENT) $(MKDIRS) $(SYMROOT)/ProjectHeaders/CoreFoundation | |
380 | $(SILENT) $(COPY) $(foreach S, $(SUBPROJECTS), $(foreach F, $($(S)_PUBHEADERS), $(SRCROOT)/$(S).subproj/$(F))) $(SYMROOT)/ProjectHeaders/CoreFoundation | |
381 | endif | |
382 | ||
383 | actual-build: | |
384 | $(SILENT) $(ECHO) "Building..." | |
385 | $(SILENT) $(MKDIRS) $(OBJROOT) | |
386 | $(SILENT) for x in $(foreach S, $(SUBPROJECTS), $(foreach F, $($(S)_SOURCES), $(SRCROOT)/$(S).subproj/$(F))) ; do \ | |
387 | if [ ! $(OBJROOT)/`basename $$x .c`.opt.o -nt $$x ] ; then \ | |
388 | $(ECHO) " ..." $$x " (optimized)" ; \ | |
389 | $(CC) $(CFLAGS) $$x -O -c -o $(OBJROOT)/`basename $$x .c`.opt.o ; \ | |
390 | fi ; \ | |
391 | if [ ! $(OBJROOT)/`basename $$x .c`.debug.o -nt $$x ] ; then \ | |
392 | $(ECHO) " ..." $$x " (debug)" ; \ | |
393 | $(CC) $(CFLAGS) $$x -DDEBUG -c -o $(OBJROOT)/`basename $$x .c`.debug.o ; \ | |
394 | fi ; \ | |
395 | if [ ! $(OBJROOT)/`basename $$x .c`.profile.o -nt $$x ] ; then \ | |
396 | $(ECHO) " ..." $$x " (profile)" ; \ | |
397 | $(CC) $(CFLAGS) $$x -DPROFILE -pg -O -c -o $(OBJROOT)/`basename $$x .c`.profile.o ; \ | |
398 | fi \ | |
399 | done | |
400 | $(SILENT) $(CC) $(CFLAGS) $(SRCROOT)/version.c -DVERSION=$(CURRENT_PROJECT_VERSION) -DUSER=$(USER) -O -c -o $(OBJROOT)/version.opt.o | |
401 | $(SILENT) $(CC) $(CFLAGS) $(SRCROOT)/version.c -DVERSION=$(CURRENT_PROJECT_VERSION) -DUSER=$(USER) -DDEBUG -c -o $(OBJROOT)/version.debug.o | |
402 | $(SILENT) $(CC) $(CFLAGS) $(SRCROOT)/version.c -DVERSION=$(CURRENT_PROJECT_VERSION) -DUSER=$(USER) -DPROFILE -pg -O -c -o $(OBJROOT)/version.profile.o | |
403 | $(SILENT) $(ECHO) "Linking..." | |
404 | ifeq "$(PLATFORM)" "Darwin" | |
405 | $(SILENT) $(CC) $(LFLAGS) -O -install_name $(FRAMEWORK_DIR)/Versions/A/CoreFoundation -o $(SYMROOT)/CoreFoundation.framework/Versions/A/CoreFoundation $(OBJROOT)/*.opt.o | |
406 | $(SILENT) $(CC) $(LFLAGS) -install_name $(FRAMEWORK_DIR)/Versions/A/CoreFoundation_debug -o $(SYMROOT)/CoreFoundation.framework/Versions/A/CoreFoundation_debug $(OBJROOT)/*.debug.o | |
407 | $(SILENT) $(CC) $(LFLAGS) -pg -O -install_name $(FRAMEWORK_DIR)/Versions/A/CoreFoundation_profile -o $(SYMROOT)/CoreFoundation.framework/Versions/A/CoreFoundation_profile $(OBJROOT)/*.profile.o | |
408 | endif | |
409 | ifeq "$(PLATFORM)" "Linux" | |
410 | $(SILENT) $(ECHO) "NOTE: Producing static libraries on Linux" | |
411 | $(SILENT) ar cr $(SYMROOT)/libCoreFoundation$(LIBRARY_EXT) $(OBJROOT)/*.opt.o | |
412 | $(SILENT) ar cr $(SYMROOT)/libCoreFoundation_debug$(LIBRARY_EXT) $(OBJROOT)/*.debug.o | |
413 | $(SILENT) ar cr $(SYMROOT)/libCoreFoundation_profile$(LIBRARY_EXT) $(OBJROOT)/*.profile.o | |
414 | endif | |
415 | ifeq "$(PLATFORM)" "FreeBSD" | |
416 | $(SILENT) $(CC) $(LFLAGS) -O -o $(SYMROOT)/libCoreFoundation$(LIBRARY_EXT) (OBJROOT)/*.opt.o | |
417 | $(SILENT) $(CC) $(LFLAGS) -o $(SYMROOT)/libCoreFoundation_debug$(LIBRARY_EXT) (OBJROOT)/*.debug.o | |
418 | $(SILENT) $(CC) $(LFLAGS) -pg -O -o $(SYMROOT)/libCoreFoundation_profile$(LIBRARY_EXT) (OBJROOT)/*.profile.o | |
419 | endif | |
420 | ifeq "$(PLATFORM)" "WIN32" | |
421 | $(SILENT) $(DLLTOOL) -e CoreFoundation -l CoreFoundation.lib $(OBJROOT)/*.opt.o | |
422 | $(SILENT) $(CC) -mdll $(OBJROOT)/*.opt.o CoreFoundation -o CoreFoundation$(LIBRARY_EXT) $(LFLAGS) | |
423 | $(SILENT) $(DLLTOOL) -e CoreFoundation_debug -l CoreFoundation_debug.lib $(OBJROOT)/*.debug.o | |
424 | $(SILENT) $(CC) -mdll $(OBJROOT)/*.debug.o CoreFoundation_debug -o CoreFoundation_debug$(LIBRARY_EXT) $(LFLAGS) | |
425 | $(SILENT) $(COPY) *.lib $(SYMROOT) | |
426 | $(SILENT) $(COPY) *.dll $(SYMROOT) | |
427 | $(SILENT) $(REMOVE) *.dll *.lib CoreFoundation CoreFoundation_debug | |
428 | endif | |
429 | $(SILENT) $(ECHO) "Done!" | |
430 | ||
431 | postbuild: | |
432 | ifeq "$(LIBRARY_STYLE)" "Framework" | |
433 | -$(SILENT) $(SYMLINK) Versions/Current/CoreFoundation $(SYMROOT)/CoreFoundation.framework/CoreFoundation | |
434 | -$(SILENT) $(SYMLINK) Versions/Current/CoreFoundation_debug $(SYMROOT)/CoreFoundation.framework/CoreFoundation_debug | |
435 | -$(SILENT) $(SYMLINK) Versions/Current/CoreFoundation_profile $(SYMROOT)/CoreFoundation.framework/CoreFoundation_profile | |
436 | endif |