]> git.saurik.com Git - apple/libsystem.git/blame - GNUmakefile
Libsystem-111.1.4.tar.gz
[apple/libsystem.git] / GNUmakefile
CommitLineData
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
8Project = Libsystem
9VersionLetter = B
10
11include $(MAKEFILEPATH)/CoreOS/ReleaseControl/Common.make
12
13ifeq ($(Version),0)
14ifdef RC_ProjectSourceVersion
15Version = $(RC_ProjectSourceVersion)
16endif
17endif
e29534dc
A
18
19no_target:
20 @$(MAKE) -f Makefile
21
c9e8bbd6
A
22ifndef RC_TARGET_CONFIG
23export RC_TARGET_CONFIG = MacOSX
24endif
25include 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
33NARCHS = $(words $(RC_ARCHS))
34USRLIB = /usr/lib
7a301563
A
35ifdef ALTUSRLOCALLIBSYSTEM
36LIBSYS = $(ALTUSRLOCALLIBSYSTEM)
37else
c9e8bbd6 38LIBSYS = $(SDKROOT)/usr/local/lib/system
7a301563 39endif
c9e8bbd6
A
40FORMS = dynamic
41SUFFIX = ''
42ifdef FEATURE_DEBUG_DYLIB
43FORMS += debug
44SUFFIX += _debug
45endif
46ifdef FEATURE_PROFILE_DYLIB
47FORMS += profile
48SUFFIX += _profile
49endif
50BSD_LIBS = c info m pthread dbm poll dl rpcsvc proc
51FPATH = /System/Library/Frameworks/System.framework
e29534dc 52
c9e8bbd6 53build:: 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
77fake:
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
84libc:
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
92libSystem: 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)'