-include $(LOCAL_MAKEFILEDIR)/framework.make.postamble-$(PLATFORM_OS)

.PHONY: omnimake_verify_framework_environment omnimake_framework_defnes_h_hack

omnimake_verify_framework_environment:
	$(SILENT) if [ -z "$(OMNIMAKE_FRAMEWORK_BASE_ADDRESS)" ]; then \
		$(ECHO) "**********************************"; \
		$(ECHO) OMNIMAKE_FRAMEWORK_BASE_ADDRESS not set; \
		$(ECHO) You should add an entry to $(OMNIMAKE_ROOT)/utilities/FrameworkAddresses.plist for this framework or bundle.; \
		$(ECHO) "**********************************"; \
	fi

#
# This hack is necessary since no matter what the dependancies of $(OMNIMAKE_FRAMEWORK_DEFINES_H),
# if you add the file to the BEFORE_PREBUILD list, it is always built.  Yuck.
#

omnimake_framework_defines_h_hack:
	$(SILENT) $(MAKE) $(OMNIMAKE_FRAMEWORK_DEFINES_H)

#
#  Export the goop necessary to correctly export data and functions in DLLs.
#  Since the defines will be in the code on either platform, this header must
#  get generated on both platforms.
#

$(OMNIMAKE_FRAMEWORK_DEFINES_H): $(OMNIMAKE_DERIVED_SOURCE_DIR) PB.project Makefile
	$(SILENT) $(ECHO) Creating FrameworkDefines.h from template.
	$(SILENT) sed 's/<FRAMEWORK_NAME>/$(NAME)/g' < $(OMNIMAKE_FRAMEWORK_DEFINES_TEMPLATE) > $(OMNIMAKE_FRAMEWORK_DEFINES_H)

#
#  We don't mark headers as private, so the PrivateHeaders link is invalid.
#  This target should be added to AFTER_BUILD in framework.make.preamble
#

.PHONY : remove_private_headers_link

remove_private_headers_link:
	$(ECHO) Removing unused PrivateHeaders;
	$(CHMOD) -f +w $(OMNIMAKE_FRAMEWORK_DIR)/$(NAME).framework;
	$(CHMOD) -Rf +w $(OMNIMAKE_FRAMEWORK_DIR)/$(NAME).framework/PrivateHeaders;
	$(RM) -rf $(OMNIMAKE_FRAMEWORK_DIR)/$(NAME).framework/PrivateHeaders;

#
# Sets the VM address at which the binary is loaded.  This is an optimization that speeds
# loading and decreases memory usages.  Additionally, on older versions of OpenStep/NT the
# debugger wouldn't work on frameworks that had been dynamically relocated.
#
# Only try setting the base address using OMNIMAKE_FRAMEWORK_BASE_ADDRESS if they haven't
# already set the base address by ld or libtool flags.
#

ifneq ($(findstring -image_base, $(ALL_LIBTOOL_FLAGS)),-image_base)
ifneq ($(findstring -image_base, $(ALL_LD_FLAGS)),-image_base)
ifneq ($(strip $(OMNIMAKE_FRAMEWORK_BASE_ADDRESS)),)
OTHER_LIBTOOL_FLAGS += -image_base $(OMNIMAKE_FRAMEWORK_BASE_ADDRESS)
endif
endif
endif

