Makefile.postamble   [plain text]


include $(CoreOSMakefiles)/ProjectBuilder/Makefile.Postamble.Common

CC = $(GCC) # override
# gcc-3.5 doesn't support -precomp-trustfile (3689986), which
# pb_makefiles/flags.make sets, so we overwrite PRECOMP_CFLAGS
PRECOMP_CFLAGS =

ifeq "$(BUILD_TYPE)" "normal"
LIBS += $(GCCLIBS)
else
LIBS = 
endif

LIBS := $(foreach LIB,							\
		  $(filter $(BSD_LIBS), $(subst -l,,$(LIBS))),		\
		  $(LIBSYS)/lib$(LIB).a)	\
	$(filter-out $(addprefix -l, $(BSD_LIBS)), $(LIBS))

# pb_makefiles erroneously omits $(BUILD_TYPE_SUFFIX) from the install name
DYLIB_INSTALL_NAME = $(LIBRARY_PREFIX)$(NAME).$(VERSION_NAME)$(BUILD_TYPE_SUFFIX)$(LIBRARY_EXT)

# The nonversioned suffix link is required by cc -pg, which is a bug in the compiler.
# We can remove those when this is fixed.

override DEBUG_SUFFIX = _debug
PRODUCTS += $(foreach TYPE, DEBUG PROFILE,								\
		$(PRODUCT_DIR)/$(LIBRARY_PREFIX)$(NAME)$($(TYPE)_SUFFIX)$(LIBRARY_EXT)			\
		$(PRODUCT_DIR)/$(LIBRARY_PREFIX)$(NAME).$(VERSION_NAME)$($(TYPE)_SUFFIX)$(LIBRARY_EXT)	\
	     )

SystemFramework = $(NSFRAMEWORKDIR)/System.framework
VersionDir      = Versions/$(VERSION_NAME)

compat-next:
	$(INSTALL_DIRECTORY) "$(DSTROOT)$(SystemFramework)"
	$(INSTALL_DIRECTORY) "$(DSTROOT)$(SystemFramework)/Versions"
	$(INSTALL_DIRECTORY) "$(DSTROOT)$(SystemFramework)/$(VersionDir)"
	$(LN) -fs "$(VERSION_NAME)" "$(DSTROOT)$(SystemFramework)/Versions/Current"
	for suffix in "" $(DEBUG_SUFFIX) $(PROFILE_SUFFIX); do								\
		$(LN) -fs "Versions/Current/$(NAME)$${suffix}" "$(DSTROOT)$(SystemFramework)/$(NAME)$${suffix}" ;	\
		$(LN) -fs "../../../../../..$(INSTALLDIR)/$(LIBRARY_PREFIX)$(NAME).$(VERSION_NAME)$${suffix}$(LIBRARY_EXT)" \
			"$(DSTROOT)$(SystemFramework)/$(VersionDir)/$(NAME)$${suffix}"				;	\
	done
	$(LN) -fs "Versions/Current/PrivateHeaders" "$(DSTROOT)$(SystemFramework)"

compat-bsd:
	for lib in $(BSD_LIBS) ; do		\
	  $(LN) -fs libSystem.dylib "$(DSTROOT)$(INSTALLDIR)/lib$${lib}.dylib";	\
	done

copy_plist:
	$(MKDIR) $(DSTROOT)$(SystemFramework)/$(VersionDir)/Resources
	$(LN) -fs Versions/Current/Resources $(DSTROOT)$(SystemFramework)/Resources
	$(RM) -f $(DSTROOT)$(SystemFramework)/$(VersionDir)/Resources/Info.plist
	$(CP) $(SRCROOT)/Info.plist $(DSTROOT)$(SystemFramework)/$(VersionDir)/Resources
	$(CHMOD) 444 $(DSTROOT)$(SystemFramework)/$(VersionDir)/Resources/Info.plist

.PHONY: comm-page-symbols
comm-page-symbols: spinlock_stub.o spinlocktry_stub.o spinunlock_stub.o CommPageSymbols.o

.SUFFIXES: .st

SEG1ADDR_i386 = 0xffff0000
SEG1ADDR_ppc = 0xffff8000
SEG1ADDR_ppc64 = 0xffffffffffff8000
SLFS_F_PH = /System/Library/Frameworks/System.framework/PrivateHeaders

$(OFILE_DIR)/%.ppc.o %.ppc.o $(OFILE_DIR)/%.ppc64.o %.ppc64.o $(OFILE_DIR)/%.i386.o %.i386.o: %.st
	$(CC) -arch $(CURRENT_ARCH) -x assembler-with-cpp \
	    -I$(SLFS_F_PH)/$(CURRENT_ARCH) \
	    $(ALL_CFLAGS) -c -o $(OFILE_DIR)/commsym.$(CURRENT_ARCH).o $<
	ld -arch $(CURRENT_ARCH) -r -seg1addr $(SEG1ADDR_$(CURRENT_ARCH)) \
	    $(OFILE_DIR)/commsym.$(CURRENT_ARCH).o -o $(OFILE_DIR)/$(notdir $@)

#-------------------------------------------------------------------------

LIBGCC = $(shell $(CC) -arch $(RC_ARCHS) -print-file-name=libgcc.a)