]> git.saurik.com Git - apple/libsystem.git/blob - GNUmakefile
Libsystem-111.1.3.tar.gz
[apple/libsystem.git] / GNUmakefile
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 include $(MAKEFILEPATH)/CoreOS/ReleaseControl/Common.make
12
13 ifeq ($(Version),0)
14 ifdef RC_ProjectSourceVersion
15 Version = $(RC_ProjectSourceVersion)
16 endif
17 endif
18
19 no_target:
20 @$(MAKE) -f Makefile
21
22 ifndef RC_TARGET_CONFIG
23 export RC_TARGET_CONFIG = MacOSX
24 endif
25 include Platforms/$(RC_TARGET_CONFIG)/Makefile.inc
26
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))
34 USRLIB = /usr/lib
35 ifdef ALTUSRLOCALLIBSYSTEM
36 LIBSYS = $(ALTUSRLOCALLIBSYSTEM)
37 else
38 LIBSYS = $(SDKROOT)/usr/local/lib/system
39 endif
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
52
53 build:: fake libSystem
54 @set -x && \
55 cd $(DSTROOT)/usr/lib && \
56 for i in $(BSD_LIBS); do \
57 ln -sf libSystem.dylib lib$$i.dylib || exit 1; \
58 done
59 find $(DSTROOT) -type l ! -perm 755 | xargs chmod -hv 755
60 install -d $(DSTROOT)$(FPATH)/Versions/$(VersionLetter)/Resources
61 @set -x && \
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
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 && \
81 cc -c $(RC_CFLAGS) fake.c && \
82 ld -r -o fake $(foreach ARCH,$(RC_ARCHS),-arch $(ARCH)) fake.o -lsyscall -L$(LIBSYS)
83
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)'
91
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)'