25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# This file and its contents are supplied under the terms of the
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# Common Development and Distribution License ("CDDL"), version 1.0.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# You may only use this file in accordance with the terms of version
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# 1.0 of the CDDL.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# A full copy of the text of the CDDL should have accompanied this
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# source. A copy of the CDDL is also available via the Internet at
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# http://www.illumos.org/license/CDDL.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisLIBMDIR = $(SRC)/lib/libm
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisLIBMSRC = $(LIBMDIR)/common
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisCPP_CMD = $(CC) -E -Xs
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisASSUFFIX_sparc = S
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisASSUFFIX_i386 = s
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisASSUFFIX = $(ASSUFFIX_$(MACH))
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
7f11fd00fc23e2af7ae21cc8837a2b86380dcfa7Richard Lowe# With studio C99MODE of neither enabled nor disabled is "no_lib", whereby we
7f11fd00fc23e2af7ae21cc8837a2b86380dcfa7Richard Lowe# expect C99-the-language, but don't modify the behaviour of library routines.
7f11fd00fc23e2af7ae21cc8837a2b86380dcfa7Richard Lowe# This is VERY IMPORTANT, as -xc99=%all, for instance, would link us with
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# values-xpg6, which would introduce an __xpg6 to our object with the C99
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# flags set, causing us to default C99 libm behaviour on, breaking
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# compatibility.
7f11fd00fc23e2af7ae21cc8837a2b86380dcfa7Richard Lowe#
7f11fd00fc23e2af7ae21cc8837a2b86380dcfa7Richard Lowe# We must then, unfortunately, defeat the GNU compiler _defaulting_ to C99, by
7f11fd00fc23e2af7ae21cc8837a2b86380dcfa7Richard Lowe# in that case setting it back to gnu89, which _also_ accepts C99 syntax as
7f11fd00fc23e2af7ae21cc8837a2b86380dcfa7Richard Lowe# far as is important.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisC99MODE =
7f11fd00fc23e2af7ae21cc8837a2b86380dcfa7Richard LoweCFLAGS += -_gcc=-std=gnu89
7f11fd00fc23e2af7ae21cc8837a2b86380dcfa7Richard LoweCFLAGS64 += -_gcc=-std=gnu89
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
1ec68d336ba97cd53f46053ac10401d16014d075Richard LoweM4FLAGS = -D__STDC__ -DPIC
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisLDBLDIR_sparc = Q
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisLDBLDIR_i386 = LD
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisLDBLDIR = $(LDBLDIR_$(MACH))
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisLM_IL = $(LIBMDIR)/$(TARGET_ARCH)/src/locallibm.il
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
1ec68d336ba97cd53f46053ac10401d16014d075Richard LoweCFLAGS += $(C_PICFLAGS) $(XSTRCONST) $(LM_IL)
1ec68d336ba97cd53f46053ac10401d16014d075Richard LoweCFLAGS64 += $(C_PICFLAGS) $(XSTRCONST) $(LM_IL)
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtissparc_CFLAGS += -Wa,-xarch=v8plus
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
1ec68d336ba97cd53f46053ac10401d16014d075Richard LoweCPPFLAGS += -I$(LIBMSRC)/C \
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis -I$(LIBMSRC)/$(LDBLDIR) -I$(LIBMDIR)/$(TARGET_ARCH)/src
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# GCC needs __C99FEATURES__ such that the implementations of isunordered,
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# isgreaterequal, islessequal, etc, exist. This is basically equivalent to
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# providing no -xc99 to Studio, in that it gets us the C99 language features,
7f11fd00fc23e2af7ae21cc8837a2b86380dcfa7Richard Lowe# but not values-xpg6, the reason for which is outlined with C99MODE.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisCFLAGS += -_gcc=-D__C99FEATURES__
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisCFLAGS64 += -_gcc=-D__C99FEATURES__
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis# libm depends on integer overflow characteristics
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisCFLAGS += -_gcc=-fno-strict-overflow
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisCFLAGS64 += -_gcc=-fno-strict-overflow
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis$(DYNLIB) := LDLIBS += -lc
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis$(LINTLIB) := SRCS = $(LIBMSRC)/$(LINTSRC)
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisCLEANFILES += pics/*.s pics/*.S
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisFPDEF_amd64 = -DARCH_amd64
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisFPDEF_sparc = -DCG89 -DARCH_v8plus -DFPADD_TRAPS_INCOMPLETE_ON_NAN
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisFPDEF_sparcv9 = -DARCH_v9 -DFPADD_TRAPS_INCOMPLETE_ON_NAN
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisFPDEF = $(FPDEF_$(TARGET_ARCH))
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisASFLAGS = -P -D_ASM $(FPDEF)
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisXARCH_sparc = v8plus
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisXARCH_sparcv9 = v9
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisXARCH_i386 = f80387
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisXARCH_amd64 = amd64
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisXARCH = $(XARCH_$(TARGET_ARCH))
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisASOPT_sparc = -xarch=$(XARCH) $(AS_PICFLAGS)
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisASOPT_sparcv9 = -xarch=$(XARCH) $(AS_PICFLAGS)
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisASOPT_i386 =
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisASOPT_amd64 = -xarch=$(XARCH) $(AS_PICFLAGS)
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisASOPT = $(ASOPT_$(TARGET_ARCH))
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisASFLAGS += $(ASOPT)
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisCPPFLAGS_sparc = -DFPADD_TRAPS_INCOMPLETE_ON_NAN \
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis -DFDTOS_TRAPS_INCOMPLETE_IN_FNS_MODE
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisCPPFLAGS += $(CPPFLAGS_$(MACH))
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisASFLAGS += $(CPPFLAGS)