xpcom/reflect/xptcall/src/md/unix/Makefile.in
author Rafael Ávila de Espíndola <respindola@mozilla.com>
Thu, 01 Sep 2011 12:19:06 -0400
changeset 76404 11247af82311ed6d6fc2bc19782fc978ee0aca48
parent 75996 a80fe3a6586f0b4123b562731dfa5e4afb7d7ba9
child 76425 deec82bfd1788bded6cefd88a74a2dbf8afdb169
permissions -rw-r--r--
Bug 680277 - Debug builds should always be compiled with frame pointers. r=khuey. This patch creates a new MOZ_FRAMEPTR_FLAGS variable that is used only to control the frame pointer flags passed to the compiler. It also computes this flag in a macro so that the toplevel configure and js/src/configure stay in sync.

#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****

DEPTH		= ../../../../../..
topsrcdir	= @top_srcdir@
srcdir		= @srcdir@
VPATH		= @srcdir@
NO_PROFILE_GUIDED_OPTIMIZE = 1

include $(DEPTH)/config/autoconf.mk

MODULE		= xpcom
LIBRARY_NAME	= xptcmd
EXPORT_LIBRARY	= ../..
MOZILLA_INTERNAL_API = 1


#
# The default is this buildable, but non-functioning code.
#
CPPSRCS = $(error XPTCall not implemented on this platform!)

# Force use of PIC
FORCE_USE_PIC	= 1

ifeq ($(OS_ARCH),SunOS)
ifneq (86,$(findstring 86,$(OS_TEST)))
# disable PGO for this directory with Sun Studio on SPARC because
# compiling with xprofile=collect will insert code into nsXPTCStubBase::Stub##n
NO_PROFILE_GUIDED_OPTIMIZE = 1
endif
endif

ifeq (Darwin,$(OS_ARCH))
ifeq (86,$(findstring 86,$(OS_TEST)))
ifneq (x86_64,$(OS_TEST))
# If we compile xptcinvoke_unixish_x86.cpp with -fomit-frame-pointer
# we end up crashing on startup. This is because
# "movl  %5, %%eax\n\t"   /* function index */
# becomes
# mov    0x1c(%esp),%eax
# but we have modified esp.
# NOTE: MOZ_FRAMEPTR_FLAGS must be set before including config.mk
# FIXME: change the file instead of using this hack.
MOZ_FRAMEPTR_FLAGS=-fno-omit-frame-pointer
endif
endif
endif

include $(topsrcdir)/config/config.mk

######################################################################
# i386 and beyond
######################################################################
#
# Lots of Unixish x86 flavors
#

ifeq (Darwin,$(OS_ARCH))
ifeq (86,$(findstring 86,$(OS_TEST)))
ifeq (x86_64,$(OS_TEST))
CPPSRCS		:= xptcinvoke_x86_64_unix.cpp xptcstubs_x86_64_darwin.cpp
else
DEFINES		+= -DKEEP_STACK_16_BYTE_ALIGNED
CPPSRCS		:= xptcinvoke_unixish_x86.cpp xptcstubs_unixish_x86.cpp
endif
endif
endif

ifneq (,$(filter NetBSD OpenBSD BSD_OS GNU,$(OS_ARCH)))
ifeq (86,$(findstring 86,$(OS_TEST)))
CPPSRCS		:= xptcinvoke_unixish_x86.cpp xptcstubs_unixish_x86.cpp
endif
endif
#
# New code for Linux, et. al., with gcc
# Migrate other platforms here after testing
#
ifneq (,$(filter Linux FreeBSD GNU_%,$(OS_ARCH)))
# Linux/x86-64
ifeq (x86_64,$(OS_TEST))
CPPSRCS		:= xptcinvoke_x86_64_unix.cpp xptcstubs_x86_64_linux.cpp
else
ifeq (86,$(findstring 86,$(OS_TEST)))
CPPSRCS		:= xptcinvoke_gcc_x86_unix.cpp xptcstubs_gcc_x86_unix.cpp
endif
endif
endif
# IA64 Linux
ifneq (,$(filter Linux,$(OS_ARCH)))
ifneq (,$(findstring ia64,$(OS_TEST)))
CPPSRCS		:= xptcinvoke_ipf64.cpp xptcstubs_ipf64.cpp
ASFILES		:= xptcstubs_asm_ipf64.s xptcinvoke_asm_ipf64.s
endif
endif
#
# OpenBSD/amd64
#
ifeq ($(OS_ARCH)$(OS_TEST),OpenBSDx86_64)
CPPSRCS		:= xptcinvoke_amd64_openbsd.cpp xptcstubs_amd64_openbsd.cpp
endif
#
# Neutrino/Intel (uses the same unixish_x86 code)
#
ifeq ($(OS_TARGET),NTO)
ifeq ($(OS_TEST),x86)
CPPSRCS		:= xptcinvoke_unixish_x86.cpp xptcstubs_unixish_x86.cpp
endif
ifeq ($(OS_TEST),arm)
CPPSRCS		:= xptcinvoke_nto_arm.cpp xptcstubs_nto_arm.cpp
endif
ifeq ($(OS_TEST),sh)
CPPSRCS		:= xptcinvoke_nto_shle.cpp xptcstubs_nto_shle.cpp
ASFILES		:= xptcstubs_asm_shle.s
endif
endif


######################################################################
# Solaris/Intel
######################################################################
#
# Solaris/Intel
#
ifeq ($(OS_ARCH),SunOS)
ifeq (x86_64,$(OS_TEST))
ifndef GNU_CC
CPPSRCS		:= xptcstubs_x86_64_solaris.cpp xptcinvoke_x86_64_solaris.cpp
ASFILES		:= xptcstubs_asm_x86_64_solaris_SUNW.s
else
CPPSRCS		:= xptcstubs_x86_64_linux.cpp xptcinvoke_x86_64_unix.cpp
endif
else
ifeq (86,$(findstring 86,$(OS_TEST)))
# 28817: if Solaris Intel OS, and native compiler, always build optimised.
ifndef GNU_CC
CPPSRCS		:= xptcinvoke_x86_solaris.cpp xptcstubs_x86_solaris.cpp
ASFILES		:= xptcinvoke_asm_x86_solaris_SUNW.s xptcstubs_asm_x86_solaris_SUNW.s
else
CPPSRCS		:= xptcinvoke_gcc_x86_unix.cpp xptcstubs_gcc_x86_unix.cpp
endif
endif
endif
endif

######################################################################
# Alpha
######################################################################
#
# Tru64/Alpha
#
ifeq ($(OS_ARCH)$(OS_TEST),OSF1alpha)
CPPSRCS		:= xptcinvoke_osf1_alpha.cpp xptcstubs_osf1_alpha.cpp
ASFILES		:= xptcinvoke_asm_osf1_alpha.s xptcstubs_asm_osf1_alpha.s
endif
#
# Linux/Alpha
#
ifneq (,$(filter Linuxalpha FreeBSDalpha NetBSDalpha,$(OS_ARCH)$(OS_TEST)))                           
CPPSRCS		:= xptcinvoke_linux_alpha.cpp xptcstubs_linux_alpha.cpp
endif
#
# OpenBSD/Alpha
#
ifeq ($(OS_ARCH)$(OS_TEST),OpenBSDalpha)
CPPSRCS		:= xptcinvoke_alpha_openbsd.cpp xptcstubs_alpha_openbsd.cpp
endif

######################################################################
# ARM
######################################################################
#
# Linux/ARM
#
ifeq ($(OS_ARCH),Linux)
ifneq (,$(filter arm% sa110,$(OS_TEST)))
CPPSRCS		:= xptcinvoke_arm.cpp xptcstubs_arm.cpp
CXXFLAGS += -O2
endif
endif
#
# NetBSD/ARM
#
ifeq ($(OS_ARCH),NetBSD)
ifneq (,$(filter arm% sa110,$(OS_TEST)))
CPPSRCS		:= xptcinvoke_arm_netbsd.cpp xptcstubs_arm_netbsd.cpp
endif
endif
#
# OpenBSD/ARM
#
ifneq (,$(filter OpenBSDarmish OpenBSDzaurus,$(OS_ARCH)$(OS_TEST)))
CPPSRCS		:= xptcinvoke_arm_openbsd.cpp xptcstubs_arm_openbsd.cpp
endif

######################################################################
# HPPA
######################################################################
#
# HP-UX/PA32
#
# for gas and gcc, check comment in xptcinvoke_asm_pa32.s
ifeq ($(OS_ARCH),HP-UX)
ifneq ($(CC),gcc)
ifneq ($(OS_TEST),ia64)
CPPSRCS		:= xptcinvoke_pa32.cpp xptcstubs_pa32.cpp
ASFILES		:= xptcstubs_asm_pa32.s xptcinvoke_asm_pa32.s
else
CPPSRCS		:= xptcinvoke_ipf32.cpp xptcstubs_ipf32.cpp
ASFILES		:= xptcstubs_asm_ipf32.s xptcinvoke_asm_ipf32.s
endif

# #18875  Building the CPP's (CXX) optimized causes a crash
CXXFLAGS 	:=  $(filter-out $(MOZ_OPTIMIZE_FLAGS), $(CXXFLAGS))
endif
endif

#
# Linux/HPPA/gcc
#
ifeq ($(OS_ARCH),Linux)
ifneq (,$(filter hppa hppa2.0 hppa1.1,$(OS_TEST)))
ifndef GNU_CXX
$(error Unknown C++ compiler, xptcall assembly will probably be incorrect.)
else
CPPSRCS		:= xptcinvoke_pa32.cpp xptcstubs_pa32.cpp
ASFILES		:= xptcstubs_asm_parisc_linux.s xptcinvoke_asm_parisc_linux.s
# #434190 optimized builds crash
CXXFLAGS 	:=  $(filter-out $(MOZ_OPTIMIZE_FLAGS), $(CXXFLAGS))
endif
endif
endif


######################################################################
# M68k
######################################################################
#
# NetBSD/m68k
#
ifeq ($(OS_ARCH),NetBSD)
ifneq (,$(filter amiga atari hp300 mac68k mvme68k next68k sun3 sun3x x68k,$(OS_TEST)))
CPPSRCS		:= xptcinvoke_netbsd_m68k.cpp xptcstubs_netbsd_m68k.cpp
endif
endif

#
# Linux/m68k
#
ifeq ($(OS_ARCH),Linux)
ifeq ($(OS_TEST),m68k)
CPPSRCS		:= xptcinvoke_linux_m68k.cpp xptcstubs_linux_m68k.cpp
endif
endif

ifeq ($(OS_ARCH),Linux)
ifneq (,$(findstring mips, $(OS_TEST)))
ifneq (,$(findstring mips64, $(OS_TEST)))
CPPSRCS		:= xptcinvoke_mips64.cpp xptcstubs_mips64.cpp
ASFILES		:= xptcinvoke_asm_mips64.s xptcstubs_asm_mips64.s
else
CPPSRCS		:= xptcinvoke_mips.cpp xptcstubs_mips.cpp
ASFILES		:= xptcinvoke_asm_mips.s xptcstubs_asm_mips.s
endif
ASFLAGS		+= -I$(DIST)/include -x assembler-with-cpp
endif
endif

######################################################################
# PowerPC
######################################################################
#
# AIX/PPC
#
ifeq ($(OS_ARCH),AIX)
ifdef HAVE_64BIT_OS
CPPSRCS		:= xptcinvoke_ppc_aix64.cpp xptcstubs_ppc_aix64.cpp
ASFILES		:= xptcinvoke_asm_ppc_aix64.s xptcstubs_asm_ppc_aix64.s
else
ifeq ($(AIX_OBJMODEL),ibm)
CPPSRCS		:= xptcinvoke_ppc_aix.cpp xptcstubs_ppc_aix.cpp
ASFILES		:= xptcinvoke_asm_ppc_ibmobj_aix.s xptcstubs_asm_ppc_aix.s
else
CPPSRCS		:= xptcinvoke_ppc_aix.cpp xptcstubs_ppc_aix.cpp
ASFILES		:= xptcinvoke_asm_ppc_aix.s xptcstubs_asm_ppc_aix.s
endif
endif

# #24617  Building the CPP's (CXX) optimized causes a crash
CXXFLAGS 	:=  $(filter-out $(MOZ_OPTIMIZE_FLAGS), $(CXXFLAGS))
endif

#
# Linux/PPC
#
ifeq ($(OS_ARCH)$(OS_TEST),Linuxpowerpc)
CPPSRCS		:= xptcinvoke_ppc_linux.cpp xptcstubs_ppc_linux.cpp
ASFILES		:= xptcinvoke_asm_ppc_linux.s xptcstubs_asm_ppc_linux.s
AS		:= $(CC) -c -x assembler-with-cpp
endif

#
# Linux/PPC64
#
ifeq ($(OS_ARCH)$(OS_TEST),Linuxpowerpc64)
CPPSRCS                := xptcinvoke_ppc64_linux.cpp xptcstubs_ppc64_linux.cpp
ASFILES                := xptcinvoke_asm_ppc64_linux.s xptcstubs_asm_ppc64_linux.s
AS             := $(CC) -c -x assembler-with-cpp
endif

#
# NetBSD/PPC
#
ifneq (,$(filter NetBSDmacppc NetBSDbebox NetBSDofppc NetBSDprep NetBSDamigappc,$(OS_ARCH)$(OS_TEST)))                           
CPPSRCS		:= xptcinvoke_ppc_netbsd.cpp xptcstubs_ppc_netbsd.cpp
ASFILES		:= xptcinvoke_asm_ppc_netbsd.s xptcstubs_asm_ppc_netbsd.s
endif

#
# OpenBSD/PPC
#
ifeq ($(OS_ARCH)$(OS_TEST),OpenBSDpowerpc)
CPPSRCS		:= xptcinvoke_ppc_openbsd.cpp xptcstubs_ppc_openbsd.cpp
ASFILES		:= xptcinvoke_asm_ppc_openbsd.s xptcstubs_asm_ppc_openbsd.s
AS		:= $(CC) -c -x assembler-with-cpp
endif

#
# Darwin/PPC
#
ifeq ($(OS_ARCH),Darwin)
ifeq ($(TARGET_CPU), powerpc)
ASFLAGS		+= -x assembler-with-cpp   # assumes $(AS) == $(CC)
ifdef HAVE_GCC3_ABI
ASFLAGS		+= -DHAVE_GCC3_ABI
endif
CPPSRCS		:= xptcinvoke_ppc_rhapsody.cpp xptcstubs_ppc_rhapsody.cpp
ASFILES		:= xptcinvoke_asm_ppc_rhapsody.s xptcstubs_asm_ppc_darwin.s
endif
endif

######################################################################
# SPARC
######################################################################
#
# BSD_OS/SPARC
#
ifeq ($(OS_ARCH),BSD_OS)
ifneq (,$(findstring sparc,$(OS_TEST)))
CPPSRCS		:= xptcinvoke_sparc_solaris.cpp xptcstubs_sparc_solaris.cpp
ASFILES		:= xptcinvoke_asm_sparc_bsdos.s xptcstubs_asm_sparc_solaris.s
endif
endif
#
# Linux/SPARC
#
ifeq ($(OS_ARCH),Linux)
ifneq (,$(findstring sparc,$(OS_TEST)))
CPPSRCS		:= xptcinvoke_sparc_solaris.cpp xptcstubs_sparc_solaris.cpp
ifdef HAVE_GCC3_ABI
ASFILES		:= xptcinvoke_asm_sparc_linux_GCC3.s xptcstubs_asm_sparc_solaris.s
else
ASFILES		:= xptcinvoke_asm_sparc_linux.s xptcstubs_asm_sparc_solaris.s
endif
endif
endif
#
# NetBSD/SPARC
#
ifeq ($(OS_ARCH)$(OS_TEST),NetBSDsparc)
CPPSRCS		:= xptcinvoke_sparc_netbsd.cpp xptcstubs_sparc_netbsd.cpp
ASFILES		:= xptcinvoke_asm_sparc_netbsd.s xptcstubs_asm_sparc_netbsd.s
endif
#
# OpenBSD/SPARC
#
ifeq ($(OS_ARCH)$(OS_TEST),OpenBSDsparc)
CPPSRCS		:= xptcinvoke_sparc_openbsd.cpp xptcstubs_sparc_openbsd.cpp
ASFILES		:= xptcinvoke_asm_sparc_openbsd.s xptcstubs_asm_sparc_openbsd.s
endif
#
# OpenBSD/SPARC64
#
ifeq ($(OS_ARCH)$(OS_TEST),OpenBSDsparc64)
CPPSRCS		:= xptcinvoke_sparc64_openbsd.cpp xptcstubs_sparc64_openbsd.cpp
ASFILES		:= xptcinvoke_asm_sparc64_openbsd.s xptcstubs_asm_sparc64_openbsd.s
endif
#
# Solaris/SPARC
#
ifeq ($(OS_ARCH),SunOS)
ifneq (86,$(findstring 86,$(OS_TEST)))
ifdef HAVE_64BIT_OS
ASFLAGS		+= -xarch=v9
CPPSRCS		:= xptcinvoke_sparcv9_solaris.cpp xptcstubs_sparcv9_solaris.cpp
else
CPPSRCS		:= xptcinvoke_sparc_solaris.cpp xptcstubs_sparc_solaris.cpp
endif

ifeq ($(GNU_CC),1)
ifdef HAVE_GCC3_ABI
ASFILES		:= xptcinvoke_asm_sparc_solaris_GCC3.s xptcstubs_asm_sparc_solaris.s
else
ASFILES		:= xptcinvoke_asm_sparc_solaris_GCC.s xptcstubs_asm_sparc_solaris.s
endif
else

ifdef HAVE_64BIT_OS
ASFILES		:= xptcinvoke_asm_sparcv9_solaris_SUNW.s xptcstubs_asm_sparcv9_solaris.s
else
ASFILES		:= xptcinvoke_asm_sparc_solaris_SUNW.s xptcstubs_asm_sparc_solaris.s
endif
endif

endif
endif

######################################################################
# S/390
######################################################################
#
# Linux for S/390
#
ifeq ($(OS_ARCH)$(OS_TEST),Linuxs390)
CPPSRCS		:= xptcinvoke_linux_s390.cpp xptcstubs_linux_s390.cpp
CXXFLAGS	+= -fno-strict-aliasing -fno-inline -fomit-frame-pointer -mbackchain
endif

ifeq ($(OS_ARCH)$(OS_TEST),Linuxs390x)
CPPSRCS		:= xptcinvoke_linux_s390x.cpp xptcstubs_linux_s390x.cpp
CXXFLAGS	+= -fno-strict-aliasing -fno-inline -fomit-frame-pointer -mbackchain
endif


# we don't want the shared lib, but we want to force the creation of a static lib.
FORCE_STATIC_LIB = 1

include $(topsrcdir)/config/rules.mk

DEFINES		+= -DEXPORT_XPTC_API -D_IMPL_NS_COM

LOCAL_INCLUDES += \
	-I$(srcdir)/../.. \
	-I$(srcdir)/../../../../xptinfo/src \
	$(NULL)

ifeq ($(OS_ARCH),Linux)
ifneq (,$(findstring mips, $(OS_TEST)))
xptcstubs_asm_mips.o: $(DIST)/include/xptcstubsdef.inc
endif
endif

ifeq ($(OS_ARCH),Darwin)
xptcstubs_asm_ppc_darwin.o: xptcstubs_asm_ppc_darwin.s.m4 $(DIST)/include/xptcstubsdef.inc Makefile
	gm4 $(INCLUDES) $< > ./xptcstubs_asm_ppc_darwin.s && \
	$(AS) -o $@ $(ASFLAGS) $(AS_DASH_C_FLAG) ./xptcstubs_asm_ppc_darwin.s
	$(RM) -f ./xptcstubs_asm_ppc_darwin.s
endif

ifeq ($(OS_ARCH),AIX)
ifdef HAVE_64BIT_OS
xptcstubs_asm_ppc_aix64.o: xptcstubs_asm_ppc_aix64.s.m4 $(DIST)/include/xptcstubsdef.inc Makefile
	m4 -DAIX_OBJMODEL=$(AIX_OBJMODEL) $(INCLUDES) -I. $< > ./xptcstubs_asm_ppc_aix64.s && \
	$(AS) -o $@ $(ASFLAGS) $(AS_DASH_C_FLAG) ./xptcstubs_asm_ppc_aix64.s
	$(RM) ./xptcstubs_asm_ppc_aix64.s
else
xptcstubs_asm_ppc_aix.o: xptcstubs_asm_ppc_aix.s.m4 $(DIST)/include/xptcstubsdef.inc Makefile
	m4 -DAIX_OBJMODEL=$(AIX_OBJMODEL) $(INCLUDES) -I. $< > ./xptcstubs_asm_ppc_aix.s && \
	$(AS) -o $@ $(ASFLAGS) $(AS_DASH_C_FLAG) ./xptcstubs_asm_ppc_aix.s
	$(RM) ./xptcstubs_asm_ppc_aix.s
endif
endif

ifeq ($(OS_ARCH),SunOS)
ifeq (86,$(findstring 86,$(OS_TEST)))
ifndef GNU_CC
ifeq (x86_64,$(OS_TEST))
xptcstubs_asm_x86_64_solaris_SUNW.o: $(DIST)/include/xptcstubsdef.inc $(srcdir)/xptcstubs_asm_x86_64_solaris_SUNW.s
	sed \
	  -e 's/^\(STUB_ENTRY\)(\([0-9]\))/\11\(\2\)/' \
	  -e 's/^\(STUB_ENTRY\)(\([0-9][0-9]\))/\12\(\2\)/' \
	  -e 's/^\(STUB_ENTRY\)(\([0-9][0-9][0-9]\))/\13\(\2\)/' \
	$(DIST)/include/xptcstubsdef.inc > ./xptcstubsdef_asm.solx86
	$(AS) -o $@ -xarch=amd64 $(ASFLAGS) $(AS_DASH_C_FLAG) -I./ $(srcdir)/xptcstubs_asm_x86_64_solaris_SUNW.s
else
xptcstubs_asm_x86_solaris_SUNW.o: $(DIST)/include/xptcstubsdef.inc $(srcdir)/xptcstubs_asm_x86_solaris_SUNW.s
	sed \
	  -e 's/^\(STUB_ENTRY\)(\([0-9]\))/\11\(\2\)/' \
	  -e 's/^\(STUB_ENTRY\)(\([0-9][0-9]\))/\12\(\2\)/' \
	  -e 's/^\(STUB_ENTRY\)(\([0-9][0-9][0-9]\))/\13\(\2\)/' \
	$(DIST)/include/xptcstubsdef.inc > ./xptcstubsdef_asm.solx86
	$(AS) -o $@ $(ASFLAGS) $(AS_DASH_C_FLAG) -I./ $(srcdir)/xptcstubs_asm_x86_solaris_SUNW.s
endif
	@rm -f ./xptcstubsdef_asm.solx86
endif
endif
endif