xref: /titanic_50/usr/src/lib/libm/Makefile.libm.com (revision 0a70879558a701a07771af87e7852a12f3bfd438)
1#
2# This file and its contents are supplied under the terms of the
3# Common Development and Distribution License ("CDDL"), version 1.0.
4# You may only use this file in accordance with the terms of version
5# 1.0 of the CDDL.
6#
7# A full copy of the text of the CDDL should have accompanied this
8# source.  A copy of the CDDL is also available via the Internet at
9# http://www.illumos.org/license/CDDL.
10#
11
12#
13# Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
14#
15
16LIBMDIR		= $(SRC)/lib/libm
17
18LIBMSRC		= $(LIBMDIR)/common
19
20CPP_CMD		= $(CC) -E -Xs
21
22ASSUFFIX_sparc	= S
23ASSUFFIX_i386	= s
24ASSUFFIX	= $(ASSUFFIX_$(MACH))
25
26# C99MODE of neither enabled nor disabled is "no_lib", whereby we expect
27# C99-the-language, but don't modify the behaviour of library routines.  This
28# is VERY IMPORTANT, as -xc99=%all, for instance, would link us with
29# values-xpg6, which would introduce an __xpg6 to our object with the C99
30# flags set, causing us to default C99 libm behaviour on, breaking
31# compatibility.
32C99MODE		=
33
34M4FLAGS		= -D__STDC__ -DELFOBJ -DPIC
35
36LDBLDIR_sparc	= Q
37LDBLDIR_i386	= LD
38LDBLDIR		= $(LDBLDIR_$(MACH))
39
40LM_IL		= $(LIBMDIR)/$(TARGET_ARCH)/src/locallibm.il
41
42CFLAGS		+= $(C_PICFLAGS) -D__INLINE $(XSTRCONST) $(LM_IL)
43CFLAGS64	+= $(C_PICFLAGS) -D__INLINE $(XSTRCONST) $(LM_IL)
44sparc_CFLAGS	+= -Wa,-xarch=v8plus
45
46CPPFLAGS	+= -DELFOBJ \
47		-DLIBM_MT_FEX_SYNC \
48		-I$(LIBMSRC)/C \
49		-I$(LIBMSRC)/$(LDBLDIR) -I$(LIBMDIR)/$(TARGET_ARCH)/src
50
51# GCC needs __C99FEATURES__ such that the implementations of isunordered,
52# isgreaterequal, islessequal, etc, exist.  This is basically equivalent to
53# providing no -xc99 to Studio, in that it gets us the C99 language features,
54# but not values-xpg6, the reason for which is outline with C99MODE.
55CFLAGS		+= -_gcc=-D__C99FEATURES__
56CFLAGS64	+= -_gcc=-D__C99FEATURES__
57
58# libm depends on integer overflow characteristics
59CFLAGS		+= -_gcc=-fno-strict-overflow
60CFLAGS64	+= -_gcc=-fno-strict-overflow
61
62$(DYNLIB) 	:= LDLIBS += -lc
63
64$(LINTLIB) 	:= SRCS = $(LIBMSRC)/$(LINTSRC)
65
66CLEANFILES 	+= pics/*.s pics/*.S
67
68FPDEF_amd64	= -DARCH_amd64
69FPDEF_sparc	= -DCG89 -DARCH_v8plus -DFPADD_TRAPS_INCOMPLETE_ON_NAN
70FPDEF_sparcv9	= -DARCH_v9 -DFPADD_TRAPS_INCOMPLETE_ON_NAN
71FPDEF		= $(FPDEF_$(TARGET_ARCH))
72
73ASFLAGS		= -P -D_ASM $(FPDEF)
74
75XARCH_sparc	= v8plus
76XARCH_sparcv9	= v9
77XARCH_i386	= f80387
78XARCH_amd64	= amd64
79XARCH		= $(XARCH_$(TARGET_ARCH))
80
81ASOPT_sparc	= -xarch=$(XARCH) $(AS_PICFLAGS)
82ASOPT_sparcv9	= -xarch=$(XARCH) $(AS_PICFLAGS)
83ASOPT_i386	=
84ASOPT_amd64	= -xarch=$(XARCH) $(AS_PICFLAGS)
85ASOPT		= $(ASOPT_$(TARGET_ARCH))
86
87ASFLAGS		+= $(ASOPT)
88
89CPPFLAGS_sparc = -DFPADD_TRAPS_INCOMPLETE_ON_NAN \
90	-DFDTOS_TRAPS_INCOMPLETE_IN_FNS_MODE
91
92CPPFLAGS	+= $(CPPFLAGS_$(MACH))
93ASFLAGS		+= $(CPPFLAGS)
94