]> git.saurik.com Git - apple/libsystem.git/blob - GNUmakefile
Libsystem-88.3.4.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
10 no_target:
11 @$(MAKE) -f Makefile
12
13 ##---------------------------------------------------------------------
14 # For each arch, we setup the independent OBJROOT and DSTROOT, and adjust
15 # the other flags. After all the archs are built, we copy over one on
16 # time (for the non-dylib files), and then call lipo to create fat files
17 # for the three dylibs.
18 ##---------------------------------------------------------------------
19 ALLARCHS = hppa i386 m68k ppc ppc64 sparc x86_64
20 NARCHS = $(words $(RC_ARCHS))
21 USRLIB = /usr/lib
22
23 install: $(RC_ARCHS)
24 ifneq "$(NARCHS)" "1"
25 rsync -aH $(OBJROOT)/$(word 1,$(RC_ARCHS))/dstroot/ $(DSTROOT)
26 rsync -aH $(OBJROOT)/$(word 1,$(RC_ARCHS))/symroot/ $(SYMROOT)
27 @for i in libSystem.B.dylib libSystem.B_debug.dylib libSystem.B_profile.dylib; do \
28 echo rm -f $(DSTROOT)$(USRLIB)/$$i && \
29 rm -f $(DSTROOT)$(USRLIB)/$$i && \
30 echo lipo -create -o $(DSTROOT)$(USRLIB)/$$i $(foreach ARCH,$(RC_ARCHS),$(OBJROOT)/$(ARCH)/dstroot$(USRLIB)/$$i) && \
31 lipo -create -o $(DSTROOT)$(USRLIB)/$$i $(foreach ARCH,$(RC_ARCHS),$(OBJROOT)/$(ARCH)/dstroot$(USRLIB)/$$i) && \
32 echo rm -f $(SYMROOT)/$$i && \
33 rm -f $(SYMROOT)/$$i && \
34 echo lipo -create -o $(SYMROOT)/$$i $(foreach ARCH,$(RC_ARCHS),$(OBJROOT)/$(ARCH)/symroot/$$i) && \
35 lipo -create -o $(SYMROOT)/$$i $(foreach ARCH,$(RC_ARCHS),$(OBJROOT)/$(ARCH)/symroot/$$i); \
36 done
37 endif
38
39 $(ALLARCHS):
40 ifneq "$(NARCHS)" "1"
41 mkdir -p $(OBJROOT)/$@/objroot $(OBJROOT)/$@/dstroot $(OBJROOT)/$@/symroot
42 $(MAKE) -f Makefile install \
43 OBJROOT='$(OBJROOT)/$@/objroot' \
44 DSTROOT='$(OBJROOT)/$@/dstroot' \
45 SYMROOT='$(OBJROOT)/$@/symroot' \
46 RC_CFLAGS='-arch $@ $(RC_NONARCH_CFLAGS)' \
47 RC_ARCHS='$@' \
48 RC_$@=YES $(foreach ARCH,$(filter-out $@,$(ALLARCHS)),RC_$(ARCH)=)
49 else # NARCHS == 1
50 $(MAKE) -f Makefile install
51 endif # NARCHS != 1
52
53 .DEFAULT:
54 @$(MAKE) -f Makefile $@