]> git.saurik.com Git - apple/libsystem.git/blobdiff - Makefile
Libsystem-125.2.10.tar.gz
[apple/libsystem.git] / Makefile
index 460558ac426a8ca09ecfa2ff3d7eeaf2699ef6c5..dcfb8f804468051819a9c35f68f7e5e030222c67 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.
-#
-
-NAME = System
-
-PROJECTVERSION = 2.8
-PROJECT_TYPE = Library
-
-OTHERLINKED = SystemMath.s spinlock_stub.s spinlocktry_stub.s spinunlock_stub.s
-
-OTHERSRCS = GNUmakefile Makefile.preamble Makefile Makefile.postamble \
-           System.order Info.plist CommPageSymbols.st
-
-OTHERLINKEDOFILES = SystemMath.o
-
-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
-LIBSYSTEM_LIBS = -lc -ldyld -linfo -lkvm -lm -lmacho\
-       -lnotify -lstreams -lunc -lkeymgr -lpoll -ldl
-#DEBUG_LIBS = $(LIBS)
-#PROF_LIBS = $(LIBS)
-
-ifdef ALTUSRLOCALLIBSYSTEM
+NAME0 = libSystem
+NAME = $(NAME0).$(VersionLetter)
+
+.include <CoreOS/Standard/Commands.mk>
+.include <CoreOS/Standard/Variables.mk>
+
+# for now, use the default compiler
+MYCC := $(CC)
+MYCCLIBS = -lgcc
+RTLIBS = -lcompiler_rt
+NARCHS != $(ECHO) $(RC_ARCHS) | $(WC) -w
+.ifdef ALTUSRLOCALLIBSYSTEM
 LIBSYS = $(ALTUSRLOCALLIBSYSTEM)
-else
-LIBSYS = $(NEXT_ROOT)/usr/local/lib/system
-endif
+.else
+LIBSYS = $(SDKROOT)/usr/local/lib/system
+.endif
+SLFS_F_PH = $(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
+.ifdef SDKROOT
+SDKROOTCFLAGS = -isysroot '$(SDKROOT)'
+SDKROOTLDFLAGS = -Wl,-syslibroot,'$(SDKROOT)'
+.endif
+ORDERFILES = -Wl,-order_file,$(SRCROOT)/SystemInit.order -Wl,-order_file,$(PLATFORM_ORDER_FILE)
+LIBS = -lc -lcommonCrypto -ldyldapis\
+       -linfo -ldns_sd -lm -lmacho\
+       -lnotify -lkeymgr -llaunch \
+       -lcopyfile -lremovefile
+CONDITIONALLIBS = unc sandbox quarantine closure cache dispatch unwind \
+       dnsinfo
+LIBSCONDITIONAL != for L in $(CONDITIONALLIBS); do tconf -q --test usr_local_lib_system_Archive:lib$$L && $(ECHO) -l$$L; done
+
+# These variables are to guarantee that the left-hand side of an expression is
+# always a variable
+dynamic = dynamic
+
+all: build
+
+build: build-debug build-dynamic build-profile
+
+# These are the non B&I defaults
+.ifndef RC_ProjectName
+install: installhdrs install-all
+
+.else # RC_ProjectName
+
+.for F in $(FORMS)
+install: BI-install-$(F)
+.endfor # FORMS
+.endif # RC_ProjectName
+
+.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))))'
+
+.for A in $(RC_ARCHS)
+build-$(F): build-$(A)-$(F)
+.endfor # RC_ARCHS
+build-$(F):
+.if $(NARCHS) == 1
+       $(CP) "$(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"
+
+.for A in $(RC_ARCHS)
+LINKDYLIB-$(F)-$(A) = $(MYCC) -dynamiclib -arch $(A) -pipe $(SDKROOTLDFLAGS) \
+       -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))/) $(LIBSCONDITIONAL:C/$/$(SUFFIX$(F))/)
+
+build-$(A)-$(F): $(OBJROOT)/$(A)/$(F) $(OBJROOT)/$(A)/CommPageSymbols.o $(OBJS-$(A))
+       @$(ECHO) $(LINKDYLIB-$(F)-$(A)) $(RTLIBS) && \
+       if $(LINKDYLIB-$(F)-$(A)) $(RTLIBS); then \
+           $(ECHO) -n; \
+       else \
+           $(ECHO) '*** Failed.  Retrying with -lgcc ***' && \
+           $(ECHO) $(LINKDYLIB-$(F)-$(A)) $(MYCCLIBS) && \
+           $(LINKDYLIB-$(F)-$(A)) $(MYCCLIBS); \
+       fi
+
+$(OBJROOT)/$(A)/$(F):
+       $(MKDIR) '$(.TARGET)'
+
+.endfor # RC_ARCHS
+.endfor # FORMS
+
+SEG1ADDR_i386 = 0xffff0000
+SEG1ADDR_ppc = 0xffff8000
+SEG1ADDR_ppc64 = 0xffffffffffff8000
+SEG1ADDR_x86_64 = 0x00007fffffe00000
+SEG1ADDR_arm = 0xffff8000
+
+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)
 
-LIBRARY_PATHS = -L$(LIBSYS)
-NEXTSTEP_PB_CFLAGS = -Wall -Werror -I$(NEXT_ROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
-NEXTSTEP_PB_LDFLAGS = -nostdlib -all_load -multi_module -Wl,-search_paths_first
+.for A in $(RC_ARCHS)
+$(OBJROOT)/$(A)/CommPageSymbols.o: $(SRCROOT)/CommPageSymbols.st
+       $(MYCC) -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
+       $(MYCC) -c -o '$(.TARGET)' -arch $(A) $(CFLAGS) '$(.ALLSRC)'
 
-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
+$(OBJROOT)/$(A)/System_vers.o: $(OBJROOT)/System_vers.c
+       $(MYCC) -c -o '$(.TARGET)' -arch $(A) $(CFLAGS) '$(.ALLSRC)'
 
-include $(MAKEFILEDIR)/platform.make
+.endfor # RC_ARCHS
 
--include Makefile.preamble
+installhdrs:
 
-include $(MAKEFILEDIR)/$(MAKEFILE)
+.for F in $(FORMS)
+BI-install-$(F): build-$(F)
+       $(MKDIR) "$(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
 
--include Makefile.postamble
+install-all: build
+.for F in $(FORMS)
+install-all: BI-install-$(F)
+.endfor # FORMS
 
--include Makefile.dependencies
+clean:
+.for A in $(RC_ARCHS)
+       $(RMDIR) $(OBJROOT)/$(A)
+.endfor # RC_ARCHS