]> git.saurik.com Git - apple/libsystem.git/blobdiff - Makefile
Libsystem-111.1.3.tar.gz
[apple/libsystem.git] / Makefile
index 401a08f01fd66fad8ab0ee6c5fc41c17f91d39e8..cad8f795a090c40cd2d3fddaea2ede1bba0f8839 100644 (file)
--- a/Makefile
+++ b/Makefile
-#
-# Generated by the Apple Project Builder.
-#
-# NOTE: Do NOT change this file -- Project Builder maintains it.
-#
-# Put all of your customizations in files called Makefile.preamble
-# and Makefile.postamble (both optional), and Makefile will include them.
-#
+NAME0 = libSystem
+NAME = $(NAME0).$(VersionLetter)
 
-NAME = System
+# for now, use the default compiler
+GCC := $(CC)
+GCCLIBS = -lgcc -lgcc_eh
+NARCHS != echo $(RC_ARCHS) | wc -w
+.ifdef ALTUSRLOCALLIBSYSTEM
+LIBSYS = $(ALTUSRLOCALLIBSYSTEM)
+.else
+LIBSYS = $(SDKROOT)/usr/local/lib/system
+.endif
+SLFS_F_PH = $(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
+.ifdef SDKROOT
+SDKROOTCFLAGS = -isysroot '$(SDKROOT)'
+SDKROOTLDFLAGS = -syslibroot '$(SDKROOT)'
+.endif
+.if !empty(FEATURE_ORDER_FILE)
+ORDERFILES = -Wl,-order_file,$(SRCROOT)/SystemInit.order -Wl,-order_file,$(SRCROOT)/System.order
+.endif
+LIBS = -lc -lcommonCrypto -ldyldapis\
+       -linfo -ldns_sd -lm -lmacho\
+       -lnotify -lkeymgr -llaunch \
+       -lcopyfile -lsandbox -lremovefile
+CONDITIONALLIBS = unc quarantine
+.for L in $(CONDITIONALLIBS)
+# the following should be replaced with tconf when 5784037 is complete
+.if exists($(LIBSYS)/lib$(L).a)
+LIBS += -l$(L)
+.endif
+.endfor # CONDITIONALLIBS
 
-PROJECTVERSION = 2.8
-PROJECT_TYPE = Library
+# These variables are to guarantee that the left-hand side of an expression is
+# always a variable
+dynamic = dynamic
 
-OTHERLINKED = SystemMath.s
+all: build
 
-OTHERSRCS = Makefile.preamble Makefile Makefile.postamble System.order\
-            Info.plist
+build: build-debug build-dynamic build-profile
 
-OTHERLINKEDOFILES = SystemMath.o
+# These are the non B&I defaults
+.ifndef RC_ProjectName
+install: installhdrs install-all
 
-MAKEFILEDIR = $(MAKEFILEPATH)/pb_makefiles
-CURRENTLY_ACTIVE_VERSION = YES
-DEPLOY_WITH_VERSION_NAME = B
-CODE_GEN_STYLE = DYNAMIC
-MAKEFILE = library.make
-NEXTSTEP_INSTALLDIR = $(USRLIBDIR)
-WINDOWS_INSTALLDIR = /Library/Frameworks
-PDO_UNIX_INSTALLDIR = /Library/Frameworks
-LIBS = -lc -lcurses -ldyld -linfo -lkvm -lm -lmacho\
-       -lstreams -lunc -lkeymgr
-DEBUG_LIBS = $(LIBS)
-PROF_LIBS = $(LIBS)
+.else # RC_ProjectName
 
+.for F in $(FORMS)
+install: BI-install-$(F)
+.endfor # FORMS
+.endif # RC_ProjectName
 
-LIBRARY_PATHS = -L$(NEXT_ROOT)/usr/local/lib/system
-NEXTSTEP_PB_CFLAGS = -Wall -Werror
-NEXTSTEP_PB_LDFLAGS = -nostdlib -all_load
+.for A in $(RC_ARCHS)
+OBJS-$(A) = $(OBJROOT)/$(A)/SystemMath.o $(OBJROOT)/$(A)/System_vers.o
+.endfor # RC_ARCHS
 
+.for F in $(FORMS)
+.if $(dynamic) == $(F)
+SUFFIX$(F) =
+.else
+SUFFIX$(F) = _$(F)
+.endif
+.if !empty(FEATURE_LIBMATHCOMMON)
+LIBMATHCOMMON$(F) = -L/usr/lib/system -sub_library libmathCommon$(SUFFIX$(F)) -lmathCommon$(SUFFIX$(F))
+.endif
+LIPOARGS$(F) != perl -e 'printf "%s\n", join(" ", map(qq(-arch $$_ \"$(OBJROOT)/$$_/$(F)/$(NAME)$(SUFFIX$(F)).dylib\"), qw($(RC_ARCHS))))'
 
-NEXTSTEP_OBJCPLUS_COMPILER = /usr/bin/cc
-WINDOWS_OBJCPLUS_COMPILER = $(DEVDIR)/gcc
-PDO_UNIX_OBJCPLUS_COMPILER = $(NEXTDEV_BIN)/gcc
-NEXTSTEP_JAVA_COMPILER = /usr/bin/javac
-WINDOWS_JAVA_COMPILER = $(JDKBINDIR)/javac.exe
-PDO_UNIX_JAVA_COMPILER = $(JDKBINDIR)/javac
+.for A in $(RC_ARCHS)
+build-$(F): build-$(A)-$(F)
+.endfor # RC_ARCHS
+build-$(F):
+.if $(NARCHS) == 1
+       cp -p "$(OBJROOT)/$(RC_ARCHS)/$(F)/$(NAME)$(SUFFIX$(F)).dylib" "$(SYMROOT)"
+.else
+       lipo -create $(LIPOARGS$(F)) -output "$(SYMROOT)/$(NAME)$(SUFFIX$(F)).dylib"
+.endif
+       dsymutil "$(SYMROOT)/$(NAME)$(SUFFIX$(F)).dylib"
 
-include $(MAKEFILEDIR)/platform.make
+.for A in $(RC_ARCHS)
+build-$(A)-$(F): $(OBJROOT)/$(A)/$(F) $(OBJROOT)/$(A)/CommPageSymbols.o $(OBJS-$(A))
+       $(GCC) -dynamiclib -arch $(A) -pipe \
+           -o '$(OBJROOT)/$(A)/$(F)/$(NAME)$(SUFFIX$(F)).dylib' \
+           -compatibility_version 1 -current_version $(Version) \
+           -install_name /usr/lib/$(NAME)$(SUFFIX$(F)).dylib \
+           -nodefaultlibs -all_load -multi_module -Wl,-search_paths_first \
+           -segcreate __DATA __commpage $(OBJROOT)/$(A)/CommPageSymbols.o \
+           $(ORDERFILES) $(SKDROOTLDFLAGS) $(OBJS-$(A)) \
+           -L$(DSTROOT)/usr/local/lib/system -L$(LIBSYS) $(LIBMATHCOMMON$(F)) \
+           $(LIBS:C/$/$(SUFFIX$(F))/) $(GCCLIBS)
 
--include Makefile.preamble
+$(OBJROOT)/$(A)/$(F):
+       mkdir -p '$(.TARGET)'
 
-include $(MAKEFILEDIR)/$(MAKEFILE)
+.endfor # RC_ARCHS
+.endfor # FORMS
 
--include Makefile.postamble
+SEG1ADDR_i386 = 0xffff0000
+SEG1ADDR_ppc = 0xffff8000
+SEG1ADDR_ppc64 = 0xffffffffffff8000
+SEG1ADDR_x86_64 = 0x00007fffffe00000
+SEG1ADDR_arm = 0xffff8000
 
--include Makefile.dependencies
+CFLAGS = -g -Os -Wall -Werror -I'$(SLFS_F_PH)' -fno-common $(SDKROOTCFLAGS)
+
+$(OBJROOT)/System_vers.c:
+       vers_string -c System | \
+       sed -e 's/SGS_VERS/SYSTEM_VERS_STRING/' -e 's/VERS_NUM/SYSTEM_VERS_NUM/' > $(.TARGET)
+
+.for A in $(RC_ARCHS)
+$(OBJROOT)/$(A)/CommPageSymbols.o: $(SRCROOT)/CommPageSymbols.st
+       $(GCC) -c -o '$(.TARGET:R)_intermediate.$(.TARGET:E)' -arch $(A) -x assembler-with-cpp $(CFLAGS) '$(.ALLSRC)'
+       ld -arch $(A) -r -seg1addr $(SEG1ADDR_$(A:C/^armv.*$/arm/)) '$(.TARGET:R)_intermediate.$(.TARGET:E)' -o '$(.TARGET)'
+
+$(OBJROOT)/$(A)/SystemMath.o: $(SRCROOT)/SystemMath.s
+       $(GCC) -c -o '$(.TARGET)' -arch $(A) $(CFLAGS) '$(.ALLSRC)'
+
+$(OBJROOT)/$(A)/System_vers.o: $(OBJROOT)/System_vers.c
+       $(GCC) -c -o '$(.TARGET)' -arch $(A) $(CFLAGS) '$(.ALLSRC)'
+
+.endfor # RC_ARCHS
+
+installhdrs:
+
+.for F in $(FORMS)
+BI-install-$(F): build-$(F)
+       mkdir -p "$(DSTROOT)/usr/lib"
+       @echo "===== Installing $(NAME)$(SUFFIX$(F)).dylib ====="
+       install "$(SYMROOT)/$(NAME)$(SUFFIX$(F)).dylib" "$(DSTROOT)/usr/lib"
+       strip -S "$(DSTROOT)/usr/lib/$(NAME)$(SUFFIX$(F)).dylib"
+       chmod a-w "$(DSTROOT)/usr/lib/$(NAME)$(SUFFIX$(F)).dylib"
+       ln -sf "$(NAME)$(SUFFIX$(F)).dylib" "$(DSTROOT)/usr/lib/$(NAME0)$(SUFFIX$(F)).dylib"
+.endfor # FORMS
+
+install-all: build
+.for F in $(FORMS)
+install-all: BI-install-$(F)
+.endfor # FORMS
+
+clean:
+.for A in $(RC_ARCHS)
+       rm -rf $(OBJROOT)/$(A)
+.endfor # RC_ARCHS