]> git.saurik.com Git - apple/libsystem.git/blame - GNUmakefile
Libsystem-111.1.1.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##---------------------------------------------------------------------
8PROJECT = Libsystem
9
10no_target:
11 @$(MAKE) -f Makefile
12
13##---------------------------------------------------------------------
14# For each arch, we setup the independent OBJROOT and DSTROOT, and adjust
10dba534 15# the other flags. After all the archs are built, we copy over one on
e29534dc
A
16# time (for the non-dylib files), and then call lipo to create fat files
17# for the three dylibs.
18##---------------------------------------------------------------------
8081b39d 19ALLARCHS = hppa i386 m68k ppc ppc64 sparc x86_64
e29534dc
A
20NARCHS = $(words $(RC_ARCHS))
21USRLIB = /usr/lib
7a301563
A
22ifdef ALTUSRLOCALLIBSYSTEM
23LIBSYS = $(ALTUSRLOCALLIBSYSTEM)
24else
25LIBSYS = $(NEXT_ROOT)/usr/local/lib/system
26endif
e29534dc 27
7a301563 28install: fake $(DSTROOT)/usr/local/lib/system/libc.a $(RC_ARCHS)
e29534dc 29ifneq "$(NARCHS)" "1"
10dba534
A
30 rsync -aH $(OBJROOT)/$(word 1,$(RC_ARCHS))/dstroot/ $(DSTROOT)
31 rsync -aH $(OBJROOT)/$(word 1,$(RC_ARCHS))/symroot/ $(SYMROOT)
7a301563
A
32 @set -x && \
33 for i in libSystem.B.dylib libSystem.B_debug.dylib libSystem.B_profile.dylib; do \
10dba534 34 rm -f $(DSTROOT)$(USRLIB)/$$i && \
10dba534 35 lipo -create -o $(DSTROOT)$(USRLIB)/$$i $(foreach ARCH,$(RC_ARCHS),$(OBJROOT)/$(ARCH)/dstroot$(USRLIB)/$$i) && \
10dba534 36 rm -f $(SYMROOT)/$$i && \
7a301563 37 lipo -create -o $(SYMROOT)/$$i $(foreach ARCH,$(RC_ARCHS),$(OBJROOT)/$(ARCH)/symroot/$$i) || exit 1; \
e29534dc
A
38 done
39endif
7a301563
A
40 @set -x && \
41 for i in libSystem.B.dylib libSystem.B_debug.dylib libSystem.B_profile.dylib; do \
42 dsymutil $(SYMROOT)/$$i || exit 1; \
43 done
44
45# 4993197: force dependency generation for libsyscall.a
46fake:
47 @set -x && \
48 cd $(OBJROOT) && \
49 echo 'main() { __getpid(); return 0; }' > fake.c && \
50 cc -c fake.c && \
51 ld -r -o fake fake.o -lsyscall -L$(LIBSYS)
52
53$(DSTROOT)/usr/local/lib/system/libc.a:
54 bsdmake -C libsys install
e29534dc
A
55
56$(ALLARCHS):
10dba534
A
57ifneq "$(NARCHS)" "1"
58 mkdir -p $(OBJROOT)/$@/objroot $(OBJROOT)/$@/dstroot $(OBJROOT)/$@/symroot
e29534dc
A
59 $(MAKE) -f Makefile install \
60 OBJROOT='$(OBJROOT)/$@/objroot' \
7a301563 61 TOPOBJROOT='$(OBJROOT)' \
e29534dc 62 DSTROOT='$(OBJROOT)/$@/dstroot' \
10dba534 63 SYMROOT='$(OBJROOT)/$@/symroot' \
7a301563 64 DESTDIR='$(DSTROOT)' \
e29534dc
A
65 RC_CFLAGS='-arch $@ $(RC_NONARCH_CFLAGS)' \
66 RC_ARCHS='$@' \
67 RC_$@=YES $(foreach ARCH,$(filter-out $@,$(ALLARCHS)),RC_$(ARCH)=)
10dba534 68else # NARCHS == 1
7a301563 69 $(MAKE) -f Makefile install TOPOBJROOT='$(OBJROOT)' DESTDIR='$(DSTROOT)'
10dba534 70endif # NARCHS != 1
e29534dc
A
71
72.DEFAULT:
73 @$(MAKE) -f Makefile $@