Bug 761077 - Build xptcall on FreeBSD ia64/ppc/ppc64/sparc64. r=bsmedberg
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DEPTH = @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!)
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
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 += -DMOZ_NEED_LEADING_UNDERSCORE
CPPSRCS := xptcinvoke_gcc_x86_unix.cpp xptcstubs_gcc_x86_unix.cpp
endif
endif
endif
ifneq (,$(filter NetBSD OpenBSD BSD_OS GNU,$(OS_ARCH)))
ifeq (86,$(findstring 86,$(OS_TEST)))
CPPSRCS := xptcinvoke_gcc_x86_unix.cpp xptcstubs_gcc_x86_unix.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 FreeBSD,$(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_gcc_x86_unix.cpp xptcstubs_gcc_x86_unix.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
######################################################################
#
# 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
#
ifneq (,$(filter Linuxpowerpc FreeBSDpowerpc,$(OS_ARCH)$(OS_TEST)))
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
#
ifneq (,$(filter Linuxpowerpc64 FreeBSDpowerpc64,$(OS_ARCH)$(OS_TEST)))
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)
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
ASFILES := xptcinvoke_asm_sparc_linux_GCC3.s xptcstubs_asm_sparc_solaris.s
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
#
ifneq (,$(filter OpenBSDsparc64 FreeBSDsparc64,$(OS_ARCH)$(OS_TEST)))
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)
ASFILES := xptcinvoke_asm_sparc_solaris_GCC3.s xptcstubs_asm_sparc_solaris.s
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