]>
Commit | Line | Data |
---|---|---|
1 | ##--------------------------------------------------------------------- | |
2 | # Makefile for Libsystem | |
3 | # Call Makefile to do the work, but for the install case, we need to | |
4 | # call Makefile for each arch separately, and create fat dylibs at the | |
5 | # end. This is because the comm page symbols are added as a special segment, | |
6 | # which the linker will not thin, so we have to build thin and combine. | |
7 | ##--------------------------------------------------------------------- | |
8 | Project = Libsystem | |
9 | VersionLetter = B | |
10 | ||
11 | # Remove any NEXT_ROOT argument | |
12 | override MAKEOVERRIDES := $(filter-out NEXT_ROOT=%,$(MAKEOVERRIDES)) | |
13 | override MAKEFILEPATH := $(subst $(NEXT_ROOT),,$(MAKEFILEPATH)) | |
14 | unexport NEXT_ROOT | |
15 | ||
16 | include $(MAKEFILEPATH)/CoreOS/ReleaseControl/Common.make | |
17 | ||
18 | ifeq ($(Version),0) | |
19 | ifdef RC_ProjectSourceVersion | |
20 | Version = $(RC_ProjectSourceVersion) | |
21 | endif | |
22 | endif | |
23 | ||
24 | no_target: | |
25 | @$(MAKE) -f Makefile | |
26 | ||
27 | ifndef RC_TARGET_CONFIG | |
28 | export RC_TARGET_CONFIG = MacOSX | |
29 | endif | |
30 | ||
31 | # Default platform order file. The platform Makefile.inc can override. | |
32 | PLATFORM_ORDER_FILE = $(SRCROOT)/Platforms/$(RC_TARGET_CONFIG)/System.order | |
33 | ||
34 | include Platforms/$(RC_TARGET_CONFIG)/Makefile.inc | |
35 | ||
36 | ##--------------------------------------------------------------------- | |
37 | # For each arch, we setup the independent OBJROOT and DSTROOT, and adjust | |
38 | # the other flags. After all the archs are built, we copy over one on | |
39 | # time (for the non-dylib files), and then call lipo to create fat files | |
40 | # for the three dylibs. | |
41 | ##--------------------------------------------------------------------- | |
42 | NARCHS = $(words $(RC_ARCHS)) | |
43 | USRLIB = /usr/lib | |
44 | ifdef ALTUSRLOCALLIBSYSTEM | |
45 | LIBSYS = $(ALTUSRLOCALLIBSYSTEM) | |
46 | else | |
47 | LIBSYS = $(SDKROOT)/usr/local/lib/system | |
48 | endif | |
49 | FORMS = dynamic | |
50 | SUFFIX = '' | |
51 | ifdef FEATURE_DEBUG_DYLIB | |
52 | FORMS += debug | |
53 | SUFFIX += _debug | |
54 | endif | |
55 | ifdef FEATURE_PROFILE_DYLIB | |
56 | FORMS += profile | |
57 | SUFFIX += _profile | |
58 | endif | |
59 | BSD_LIBS = c info m pthread dbm poll dl rpcsvc proc | |
60 | FPATH = /System/Library/Frameworks/System.framework | |
61 | ||
62 | build:: fake libSystem | |
63 | @set -x && \ | |
64 | cd $(DSTROOT)/usr/lib && \ | |
65 | for i in $(BSD_LIBS); do \ | |
66 | $(LN) -sf libSystem.dylib lib$$i.dylib || exit 1; \ | |
67 | done | |
68 | $(FIND) $(DSTROOT) -type l ! -perm 755 | $(XARGS) chmod -hv 755 | |
69 | $(INSTALL_DIRECTORY) $(DSTROOT)$(FPATH)/Versions/$(VersionLetter)/Resources | |
70 | @set -x && \ | |
71 | cd $(DSTROOT)$(FPATH) && \ | |
72 | $(LN) -sf Versions/Current/PrivateHeaders && \ | |
73 | $(LN) -sf Versions/Current/Resources && \ | |
74 | for S in $(SUFFIX); do \ | |
75 | $(LN) -sf Versions/Current/System$$S || exit 1; \ | |
76 | done && \ | |
77 | cd Versions && \ | |
78 | $(LN) -sf $(VersionLetter) Current && \ | |
79 | cd $(VersionLetter) && \ | |
80 | for S in $(SUFFIX); do \ | |
81 | $(LN) -sf ../../../../../../usr/lib/libSystem.$(VersionLetter)$$S.dylib System$$S || exit 1; \ | |
82 | done && \ | |
83 | $(CP) $(SRCROOT)/Info.plist Resources | |
84 | ||
85 | # 4993197: force dependency generation for libsyscall.a | |
86 | fake: | |
87 | @set -x && \ | |
88 | cd $(OBJROOT) && \ | |
89 | $(ECHO) 'main() { __getpid(); return 0; }' > fake.c && \ | |
90 | $(CC) -c $(RC_CFLAGS) fake.c && \ | |
91 | $(LD) -r -o fake $(foreach ARCH,$(RC_ARCHS),-arch $(ARCH)) fake.o -lsyscall -L$(LIBSYS) | |
92 | ||
93 | libc: | |
94 | $(MKDIR) '$(OBJROOT)/libc' | |
95 | $(BSDMAKE) -C libsys install \ | |
96 | FEATURE_DEBUG_DYLIB=$(FEATURE_DEBUG_DYLIB) \ | |
97 | FEATURE_PROFILE_DYLIB=$(FEATURE_PROFILE_DYLIB) \ | |
98 | DSTROOT='$(DSTROOT)' \ | |
99 | OBJROOT='$(OBJROOT)/libc' \ | |
100 | SRCROOT='$(SRCROOT)' \ | |
101 | SYMROOT='$(SYMROOT)' | |
102 | ||
103 | libSystem: libc | |
104 | $(MKDIR) '$(OBJROOT)/libSystem' | |
105 | $(BSDMAKE) install \ | |
106 | FEATURE_LIBMATHCOMMON=$(FEATURE_LIBMATHCOMMON) \ | |
107 | PLATFORM_ORDER_FILE=$(PLATFORM_ORDER_FILE) \ | |
108 | FORMS='$(FORMS)' \ | |
109 | Version=$(Version) \ | |
110 | VersionLetter=$(VersionLetter) \ | |
111 | DSTROOT='$(DSTROOT)' \ | |
112 | OBJROOT='$(OBJROOT)/libSystem' \ | |
113 | SRCROOT='$(SRCROOT)' \ | |
114 | SYMROOT='$(SYMROOT)' |