xref: /illumos-gate/usr/src/stand/lib/Makefile.com (revision f63f7506be0210195779706f51c58646e568cc40)
1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License (the "License").
6# You may not use this file except in compliance with the License.
7#
8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9# or http://www.opensolaris.org/os/licensing.
10# See the License for the specific language governing permissions
11# and limitations under the License.
12#
13# When distributing Covered Code, include this CDDL HEADER in each
14# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15# If applicable, add the following below this CDDL HEADER, with the
16# fields enclosed by brackets "[]" replaced with your own identifying
17# information: Portions Copyright [yyyy] [name of copyright owner]
18#
19# CDDL HEADER END
20#
21#
22# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# ident	"%Z%%M%	%I%	%E% SMI"
26#
27
28#
29# Common macro definitions and pattern rules for stand libraries.
30# Basically just a trivial wrapper around $(SRC)/lib/Makefile.lib.
31#
32
33include $(SRC)/lib/Makefile.lib
34include $(SRC)/stand/lib/Makefile.$(MACH)
35
36SRCDIR =	.
37LIBS +=		$(LIBRARY) $(LINTLIB)
38CFLAGS +=	$(CCVERBOSE)
39LDFLAGS =	-r
40LDLIBS +=	-lsa -lfakeboot
41$(LINTLIB) :=	SRCS = $(SRCDIR)/$(LINTSRC)
42
43#
44# Reset ROOTLIBDIR to an alternate directory so that we don't clash with
45# $(ROOT)/usr/lib.  The Makefiles over in usr/src/psm expect to find our
46# libraries here.
47#
48ROOTLIBDIR = $(ROOT)/stand/lib
49
50#
51# Paths to a variety of commonly-referenced directories.  Note that we use
52# relative paths so that references to filenames in the source (e.g.,
53# through use of assert()) are not exposed absolutely (for reasons of
54# taste and to help make the binaries end up the same even when built from
55# different workspaces).  Makefiles that are more than one directory level
56# deeper than this Makefile need to set DIRREL appropriately so that the
57# relative paths can still be accessed correctly.
58#
59TOPDIR =	$(DIRREL)../../..
60STANDDIR =	$(DIRREL)../..
61CMNNETDIR =	$(TOPDIR)/common/net
62SYSDIR	=	$(TOPDIR)/uts
63
64#
65# As a courtesy to the numerous standalone libraries which are built from
66# sources living elsewhere, we provide a generic CMNDIR macro which the
67# library's Makefile can set (if need be) to the primary other directory
68# it grabs its sources from.
69#
70CMNDIR =	.
71
72#
73# Configure the appropriate #defines and #include path for building
74# standalone bits.  Note that we turn off access to /usr/include and
75# the proto area since those headers match libc's implementation, and
76# libc is of course not available to standalone binaries.
77#
78CPPDEFS	= 	-D$(KARCH) -D_BOOT -D_KERNEL -D_MACHDEP
79CPPINCS	= 	-YI,$(STANDDIR)/lib/sa -I$(STANDDIR) -I$(SRCDIR) -I$(CMNDIR) \
80		-I$(STANDDIR)/$(MACH) -I$(SYSDIR)/common $(ARCHDIRS) \
81		-I$(SYSDIR)/sun4 -I$(SYSDIR)/$(KARCH)
82
83CPPFLAGS =	$(CPPDEFS) $(CPPINCS)
84AS_CPPFLAGS =	$(CPPDEFS) $(CPPINCS:-YI,%=-I%)
85ASFLAGS =	-P -D__STDC__ -D_ASM
86
87#
88# While things are pretty much 32-bit lint-clean, there are a ton of
89# suspect pointer casts.  Since these may be serious problems (especially
90# on SPARC), this really needs to be investigated thoroughly one day.
91# However, we shouldn't feel too bad: the whole kernel is linted with this
92# turned off as well (along with a dozen other disabled warnings).
93#
94# The other two -erroff's are needed only because lint's -u flag is lame
95# and also turns off "name used but not defined" checks (so we instead
96# just enumerate the errors that -u turns off that we want turned off).
97#
98LINTFLAGS = -nmsF -erroff=E_BAD_PTR_CAST_ALIGN \
99	    -erroff=E_NAME_DECL_NOT_USED_DEF2 -erroff=E_NAME_DEF_NOT_USED2 \
100	    -erroff=E_STATIC_UNUSED
101
102#
103# CPPFLAGS values that *must* be included whenever linking with or
104# building libssl or libcrypto.
105# This overrides the restrictions for the standlone build, some of these
106# may be repeats from OPENSSL_NO_XXX but they are explicit here because
107# we are not just excluding for legal reasons but for size as well.
108#
109OPENSSL_BUILD_CPPFLAGS_sparc = -DB_ENDIAN
110OPENSSL_BUILD_CPPFLAGS = $(OPENSSL_NO_XXX) -DOPENSSL_NO_HW \
111			-DOPENSSL_NO_MD2 -DOPENSSL_NO_MD4 -DOPENSSL_NO_MDC2 \
112			-DOPENSSL_NO_RIPEMD -DOPENSSL_NO_RC3 -DOPENSSL_NO_RC4 \
113			-DOPENSSL_NO_EC -DOPENSSL_NO_RC5 -DOPENSSL_NO_IDEA \
114			-DOPENSSL_NO_CAST -DOPENSSL_NO_AES \
115			-DDEVRANDOM=\"/dev/urandom\" \
116			$(OPENSSL_BUILD_CPPFLAGS_$(MACH)) \
117			-I$(ROOTSFWINCLUDE) \
118			-I$(OPENSSL_SRC) -I$(OPENSSL_SRC)/crypto
119
120#
121# CPPFLAGS values that *must* be included whenever linking the DHCP
122# routines in $SRC/common/net/dhcp.
123#
124DHCPCPPFLAGS = -I$(CMNNETDIR)/dhcp
125
126#
127# CPPFLAGS values that *must* be included whenever linking with or
128# building libsock.
129#
130# The header files for libsock provide alternate definitions for data
131# types that are also defined in <sys/stream.h>.  To make sure we get the
132# right ones, prevent <sys/stream.h>'s contents from being included.  This
133# is shameful.
134#
135SOCKCPPFLAGS = -I$(STANDDIR)/lib/sock -D_SYS_STREAM_H
136
137.KEEP_STATE:
138