]> git.saurik.com Git - apple/libsystem.git/blame - GNUmakefile
Libsystem-123.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
699e5813
A
11# Remove any NEXT_ROOT argument
12override MAKEOVERRIDES := $(filter-out NEXT_ROOT=%,$(MAKEOVERRIDES))
13override MAKEFILEPATH := $(subst $(NEXT_ROOT),,$(MAKEFILEPATH))
14unexport NEXT_ROOT
15
c9e8bbd6
A
16include $(MAKEFILEPATH)/CoreOS/ReleaseControl/Common.make
17
18ifeq ($(Version),0)
19ifdef RC_ProjectSourceVersion
20Version = $(RC_ProjectSourceVersion)
21endif
22endif
e29534dc
A
23
24no_target:
25 @$(MAKE) -f Makefile
26
c9e8bbd6
A
27ifndef RC_TARGET_CONFIG
28export RC_TARGET_CONFIG = MacOSX
29endif
699e5813
A
30
31# Default platform order file. The platform Makefile.inc can override.
32PLATFORM_ORDER_FILE = $(SRCROOT)/Platforms/$(RC_TARGET_CONFIG)/System.order
33
c9e8bbd6
A
34include Platforms/$(RC_TARGET_CONFIG)/Makefile.inc
35
e29534dc
A
36##---------------------------------------------------------------------
37# For each arch, we setup the independent OBJROOT and DSTROOT, and adjust
10dba534 38# the other flags. After all the archs are built, we copy over one on
e29534dc
A
39# time (for the non-dylib files), and then call lipo to create fat files
40# for the three dylibs.
41##---------------------------------------------------------------------
e29534dc
A
42NARCHS = $(words $(RC_ARCHS))
43USRLIB = /usr/lib
7a301563
A
44ifdef ALTUSRLOCALLIBSYSTEM
45LIBSYS = $(ALTUSRLOCALLIBSYSTEM)
46else
c9e8bbd6 47LIBSYS = $(SDKROOT)/usr/local/lib/system
7a301563 48endif
c9e8bbd6
A
49FORMS = dynamic
50SUFFIX = ''
51ifdef FEATURE_DEBUG_DYLIB
52FORMS += debug
53SUFFIX += _debug
54endif
55ifdef FEATURE_PROFILE_DYLIB
56FORMS += profile
57SUFFIX += _profile
58endif
59BSD_LIBS = c info m pthread dbm poll dl rpcsvc proc
60FPATH = /System/Library/Frameworks/System.framework
e29534dc 61
c9e8bbd6 62build:: fake libSystem
7a301563 63 @set -x && \
c9e8bbd6
A
64 cd $(DSTROOT)/usr/lib && \
65 for i in $(BSD_LIBS); do \
699e5813 66 $(LN) -sf libSystem.dylib lib$$i.dylib || exit 1; \
e29534dc 67 done
699e5813
A
68 $(FIND) $(DSTROOT) -type l ! -perm 755 | $(XARGS) chmod -hv 755
69 $(INSTALL_DIRECTORY) $(DSTROOT)$(FPATH)/Versions/$(VersionLetter)/Resources
7a301563 70 @set -x && \
c9e8bbd6 71 cd $(DSTROOT)$(FPATH) && \
699e5813
A
72 $(LN) -sf Versions/Current/PrivateHeaders && \
73 $(LN) -sf Versions/Current/Resources && \
c9e8bbd6 74 for S in $(SUFFIX); do \
699e5813 75 $(LN) -sf Versions/Current/System$$S || exit 1; \
c9e8bbd6
A
76 done && \
77 cd Versions && \
699e5813 78 $(LN) -sf $(VersionLetter) Current && \
c9e8bbd6
A
79 cd $(VersionLetter) && \
80 for S in $(SUFFIX); do \
699e5813 81 $(LN) -sf ../../../../../../usr/lib/libSystem.$(VersionLetter)$$S.dylib System$$S || exit 1; \
c9e8bbd6 82 done && \
699e5813 83 $(CP) $(SRCROOT)/Info.plist Resources
7a301563
A
84
85# 4993197: force dependency generation for libsyscall.a
86fake:
87 @set -x && \
88 cd $(OBJROOT) && \
699e5813
A
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)
e29534dc 92
c9e8bbd6 93libc:
699e5813
A
94 $(MKDIR) '$(OBJROOT)/libc'
95 $(BSDMAKE) -C libsys install \
c9e8bbd6
A
96 DSTROOT='$(DSTROOT)' \
97 OBJROOT='$(OBJROOT)/libc' \
98 SRCROOT='$(SRCROOT)' \
99 SYMROOT='$(SYMROOT)'
e29534dc 100
c9e8bbd6 101libSystem: libc
699e5813
A
102 $(MKDIR) '$(OBJROOT)/libSystem'
103 $(BSDMAKE) install \
c9e8bbd6 104 FEATURE_LIBMATHCOMMON=$(FEATURE_LIBMATHCOMMON) \
699e5813 105 PLATFORM_ORDER_FILE=$(PLATFORM_ORDER_FILE) \
c9e8bbd6
A
106 FORMS='$(FORMS)' \
107 Version=$(Version) \
108 VersionLetter=$(VersionLetter) \
109 DSTROOT='$(DSTROOT)' \
110 OBJROOT='$(OBJROOT)/libSystem' \
111 SRCROOT='$(SRCROOT)' \
112 SYMROOT='$(SYMROOT)'