michael@0: # michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: include $(CORE_DEPTH)/coreconf/UNIX.mk michael@0: michael@0: # Sun's WorkShop defines v8, v8plus and v9 architectures. michael@0: # gcc on Solaris defines v8 and v9 "cpus". michael@0: # gcc's v9 is equivalent to Workshop's v8plus. michael@0: # gcc's -m64 is equivalent to Workshop's v9 michael@0: michael@0: ifeq ($(USE_64), 1) michael@0: ifdef NS_USE_GCC michael@0: ARCHFLAG=-m64 michael@0: else michael@0: ifeq ($(OS_TEST),i86pc) michael@0: ARCHFLAG=-xarch=amd64 michael@0: else michael@0: ARCHFLAG=-xarch=v9 michael@0: endif michael@0: endif michael@0: else michael@0: ifneq ($(OS_TEST),i86pc) michael@0: ifdef NS_USE_GCC michael@0: ARCHFLAG=-mcpu=v9 michael@0: else michael@0: ARCHFLAG=-xarch=v8plus michael@0: endif michael@0: endif michael@0: endif michael@0: michael@0: DEFAULT_COMPILER = cc michael@0: michael@0: ifdef NS_USE_GCC michael@0: CC = gcc michael@0: OS_CFLAGS += -Wall -Wno-format -Werror-implicit-function-declaration -Wno-switch michael@0: CCC = g++ michael@0: CCC += -Wall -Wno-format michael@0: ASFLAGS += -x assembler-with-cpp michael@0: OS_CFLAGS += $(NOMD_OS_CFLAGS) $(ARCHFLAG) michael@0: ifdef USE_MDUPDATE michael@0: OS_CFLAGS += -MDupdate $(DEPENDENCIES) michael@0: endif michael@0: ifdef BUILD_OPT michael@0: OPTIMIZER = -O2 michael@0: # Enable this for accurate dtrace profiling michael@0: # OPTIMIZER += -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer michael@0: endif michael@0: else michael@0: CC = cc michael@0: CCC = CC michael@0: ASFLAGS += -Wa,-P michael@0: OS_CFLAGS += $(NOMD_OS_CFLAGS) $(ARCHFLAG) michael@0: ifndef BUILD_OPT michael@0: OS_CFLAGS += -xs michael@0: else michael@0: OPTIMIZER = -xO4 michael@0: endif michael@0: ifdef USE_TCOV michael@0: CC += -xprofile=tcov michael@0: CCC += -xprofile=tcov michael@0: endif michael@0: endif michael@0: michael@0: RANLIB = echo michael@0: CPU_ARCH = sparc michael@0: OS_DEFINES += -DSVR4 -DSYSV -D__svr4 -D__svr4__ -DSOLARIS -D_REENTRANT michael@0: michael@0: ifeq ($(OS_TEST),i86pc) michael@0: ifeq ($(USE_64),1) michael@0: CPU_ARCH = x86_64 michael@0: else michael@0: CPU_ARCH = x86 michael@0: OS_DEFINES += -Di386 michael@0: endif michael@0: endif michael@0: michael@0: # Purify doesn't like -MDupdate michael@0: NOMD_OS_CFLAGS += $(DSO_CFLAGS) $(OS_DEFINES) $(SOL_CFLAGS) michael@0: michael@0: MKSHLIB = $(CC) $(DSO_LDOPTS) $(RPATH) michael@0: ifdef NS_USE_GCC michael@0: ifeq (GNU,$(findstring GNU,$(shell `$(CC) -print-prog-name=ld` -v 2>&1))) michael@0: GCC_USE_GNU_LD = 1 michael@0: endif michael@0: endif michael@0: ifdef MAPFILE michael@0: ifdef NS_USE_GCC michael@0: ifdef GCC_USE_GNU_LD michael@0: MKSHLIB += -Wl,--version-script,$(MAPFILE) michael@0: else michael@0: MKSHLIB += -Wl,-M,$(MAPFILE) michael@0: endif michael@0: else michael@0: MKSHLIB += -M $(MAPFILE) michael@0: endif michael@0: endif michael@0: PROCESS_MAP_FILE = grep -v ';-' $< | \ michael@0: sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@ michael@0: michael@0: # ld options: michael@0: # -G: produce a shared object michael@0: # -z defs: no unresolved symbols allowed michael@0: ifdef NS_USE_GCC michael@0: ifeq ($(USE_64), 1) michael@0: DSO_LDOPTS += -m64 michael@0: endif michael@0: DSO_LDOPTS += -shared -h $(notdir $@) michael@0: else michael@0: ifeq ($(USE_64), 1) michael@0: ifeq ($(OS_TEST),i86pc) michael@0: DSO_LDOPTS +=-xarch=amd64 michael@0: else michael@0: DSO_LDOPTS +=-xarch=v9 michael@0: endif michael@0: endif michael@0: DSO_LDOPTS += -G -h $(notdir $@) michael@0: endif michael@0: DSO_LDOPTS += -z combreloc -z defs -z ignore michael@0: michael@0: # -KPIC generates position independent code for use in shared libraries. michael@0: # (Similarly for -fPIC in case of gcc.) michael@0: ifdef NS_USE_GCC michael@0: DSO_CFLAGS += -fPIC michael@0: else michael@0: DSO_CFLAGS += -KPIC michael@0: endif michael@0: michael@0: NOSUCHFILE = /solaris-rm-f-sucks michael@0: michael@0: ifeq ($(BUILD_SUN_PKG), 1) michael@0: # The -R '$ORIGIN' linker option instructs this library to search for its michael@0: # dependencies in the same directory where it resides. michael@0: ifeq ($(USE_64), 1) michael@0: RPATH = -R '$$ORIGIN:/usr/lib/mps/secv1/64:/usr/lib/mps/64' michael@0: else michael@0: RPATH = -R '$$ORIGIN:/usr/lib/mps/secv1:/usr/lib/mps' michael@0: endif michael@0: else michael@0: RPATH = -R '$$ORIGIN' michael@0: endif michael@0: michael@0: OS_LIBS += -lthread -lnsl -lsocket -lposix4 -ldl -lc