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 ##---------------------------------------------------------------------
11 include $(MAKEFILEPATH)/CoreOS/ReleaseControl/Common.make
14 ifdef RC_ProjectSourceVersion
15 Version = $(RC_ProjectSourceVersion)
22 ifndef RC_TARGET_CONFIG
23 export RC_TARGET_CONFIG = MacOSX
25 include Platforms/$(RC_TARGET_CONFIG)/Makefile.inc
27 ##---------------------------------------------------------------------
28 # For each arch, we setup the independent OBJROOT and DSTROOT, and adjust
29 # the other flags. After all the archs are built, we copy over one on
30 # time (for the non-dylib files), and then call lipo to create fat files
31 # for the three dylibs.
32 ##---------------------------------------------------------------------
33 NARCHS = $(words $(RC_ARCHS))
35 ifdef ALTUSRLOCALLIBSYSTEM
36 LIBSYS = $(ALTUSRLOCALLIBSYSTEM)
38 LIBSYS = $(SDKROOT)/usr/local/lib/system
42 ifdef FEATURE_DEBUG_DYLIB
46 ifdef FEATURE_PROFILE_DYLIB
50 BSD_LIBS = c info m pthread dbm poll dl rpcsvc proc
51 FPATH = /System/Library/Frameworks/System.framework
53 build:: fake libSystem
55 cd $(DSTROOT)/usr/lib && \
56 for i in $(BSD_LIBS); do \
57 ln -sf libSystem.dylib lib$$i.dylib || exit 1; \
59 find $(DSTROOT) -type l ! -perm 755 | xargs chmod -hv 755
60 install -d $(DSTROOT)$(FPATH)/Versions/$(VersionLetter)/Resources
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; \
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; \
74 cp -f $(SRCROOT)/Info.plist Resources
76 # 4993197: force dependency generation for libsyscall.a
80 echo 'main() { __getpid(); return 0; }' > fake.c && \
81 cc -c $(RC_CFLAGS) fake.c && \
82 ld -r -o fake $(foreach ARCH,$(RC_ARCHS),-arch $(ARCH)) fake.o -lsyscall -L$(LIBSYS)
85 mkdir -p '$(OBJROOT)/libc'
86 bsdmake -C libsys install \
87 DSTROOT='$(DSTROOT)' \
88 OBJROOT='$(OBJROOT)/libc' \
89 SRCROOT='$(SRCROOT)' \
93 mkdir -p '$(OBJROOT)/libSystem'
95 FEATURE_LIBMATHCOMMON=$(FEATURE_LIBMATHCOMMON) \
96 FEATURE_ORDER_FILE=$(FEATURE_ORDER_FILE) \
99 VersionLetter=$(VersionLetter) \
100 DSTROOT='$(DSTROOT)' \
101 OBJROOT='$(OBJROOT)/libSystem' \
102 SRCROOT='$(SRCROOT)' \