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