]>
Commit | Line | Data |
---|---|---|
e29534dc A |
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 | ##--------------------------------------------------------------------- | |
c9e8bbd6 A |
8 | Project = Libsystem |
9 | VersionLetter = B | |
10 | ||
11 | include $(MAKEFILEPATH)/CoreOS/ReleaseControl/Common.make | |
12 | ||
13 | ifeq ($(Version),0) | |
14 | ifdef RC_ProjectSourceVersion | |
15 | Version = $(RC_ProjectSourceVersion) | |
16 | endif | |
17 | endif | |
e29534dc A |
18 | |
19 | no_target: | |
20 | @$(MAKE) -f Makefile | |
21 | ||
c9e8bbd6 A |
22 | ifndef RC_TARGET_CONFIG |
23 | export RC_TARGET_CONFIG = MacOSX | |
24 | endif | |
25 | include Platforms/$(RC_TARGET_CONFIG)/Makefile.inc | |
26 | ||
e29534dc A |
27 | ##--------------------------------------------------------------------- |
28 | # For each arch, we setup the independent OBJROOT and DSTROOT, and adjust | |
10dba534 | 29 | # the other flags. After all the archs are built, we copy over one on |
e29534dc A |
30 | # time (for the non-dylib files), and then call lipo to create fat files |
31 | # for the three dylibs. | |
32 | ##--------------------------------------------------------------------- | |
e29534dc A |
33 | NARCHS = $(words $(RC_ARCHS)) |
34 | USRLIB = /usr/lib | |
7a301563 A |
35 | ifdef ALTUSRLOCALLIBSYSTEM |
36 | LIBSYS = $(ALTUSRLOCALLIBSYSTEM) | |
37 | else | |
c9e8bbd6 | 38 | LIBSYS = $(SDKROOT)/usr/local/lib/system |
7a301563 | 39 | endif |
c9e8bbd6 A |
40 | FORMS = dynamic |
41 | SUFFIX = '' | |
42 | ifdef FEATURE_DEBUG_DYLIB | |
43 | FORMS += debug | |
44 | SUFFIX += _debug | |
45 | endif | |
46 | ifdef FEATURE_PROFILE_DYLIB | |
47 | FORMS += profile | |
48 | SUFFIX += _profile | |
49 | endif | |
50 | BSD_LIBS = c info m pthread dbm poll dl rpcsvc proc | |
51 | FPATH = /System/Library/Frameworks/System.framework | |
e29534dc | 52 | |
c9e8bbd6 | 53 | build:: fake libSystem |
7a301563 | 54 | @set -x && \ |
c9e8bbd6 A |
55 | cd $(DSTROOT)/usr/lib && \ |
56 | for i in $(BSD_LIBS); do \ | |
57 | ln -sf libSystem.dylib lib$$i.dylib || exit 1; \ | |
e29534dc | 58 | done |
c9e8bbd6 A |
59 | find $(DSTROOT) -type l ! -perm 755 | xargs chmod -hv 755 |
60 | install -d $(DSTROOT)$(FPATH)/Versions/$(VersionLetter)/Resources | |
7a301563 | 61 | @set -x && \ |
c9e8bbd6 A |
62 | cd $(DSTROOT)$(FPATH) && \ |
63 | ln -sf Versions/Current/PrivateHeaders && \ | |
64 | ln -sf Versions/Current/Resources && \ | |
65 | for S in $(SUFFIX); do \ | |
66 | ln -sf Versions/Current/System$$S || exit 1; \ | |
67 | done && \ | |
68 | cd Versions && \ | |
69 | ln -sf $(VersionLetter) Current && \ | |
70 | cd $(VersionLetter) && \ | |
71 | for S in $(SUFFIX); do \ | |
72 | ln -sf ../../../../../../usr/lib/libSystem.$(VersionLetter)$$S.dylib System$$S || exit 1; \ | |
73 | done && \ | |
74 | cp -f $(SRCROOT)/Info.plist Resources | |
7a301563 A |
75 | |
76 | # 4993197: force dependency generation for libsyscall.a | |
77 | fake: | |
78 | @set -x && \ | |
79 | cd $(OBJROOT) && \ | |
80 | echo 'main() { __getpid(); return 0; }' > fake.c && \ | |
c9e8bbd6 A |
81 | cc -c $(RC_CFLAGS) fake.c && \ |
82 | ld -r -o fake $(foreach ARCH,$(RC_ARCHS),-arch $(ARCH)) fake.o -lsyscall -L$(LIBSYS) | |
e29534dc | 83 | |
c9e8bbd6 A |
84 | libc: |
85 | mkdir -p '$(OBJROOT)/libc' | |
86 | bsdmake -C libsys install \ | |
87 | DSTROOT='$(DSTROOT)' \ | |
88 | OBJROOT='$(OBJROOT)/libc' \ | |
89 | SRCROOT='$(SRCROOT)' \ | |
90 | SYMROOT='$(SYMROOT)' | |
e29534dc | 91 | |
c9e8bbd6 A |
92 | libSystem: libc |
93 | mkdir -p '$(OBJROOT)/libSystem' | |
94 | bsdmake install \ | |
95 | FEATURE_LIBMATHCOMMON=$(FEATURE_LIBMATHCOMMON) \ | |
96 | FEATURE_ORDER_FILE=$(FEATURE_ORDER_FILE) \ | |
97 | FORMS='$(FORMS)' \ | |
98 | Version=$(Version) \ | |
99 | VersionLetter=$(VersionLetter) \ | |
100 | DSTROOT='$(DSTROOT)' \ | |
101 | OBJROOT='$(OBJROOT)/libSystem' \ | |
102 | SRCROOT='$(SRCROOT)' \ | |
103 | SYMROOT='$(SYMROOT)' |