xref: /titanic_41/usr/src/lib/libumem/Makefile.com (revision b6805bf78d2bbbeeaea8909a05623587b42d58b3)
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 2008 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25
26#
27# The build process for libumem is sightly different from that used by other
28# libraries, because libumem must be built in two flavors - as a standalone
29# for use by kmdb and as a normal library.  We use $(CURTYPE) to indicate the
30# current flavor being built.
31#
32
33LIBRARY = libumem.a
34STANDLIBRARY = libstandumem.so
35VERS = .1
36
37# By default, we build the shared library.  Construction of the standalone
38# is specifically requested by architecture-specific Makefiles.
39TYPES = library
40CURTYPE = library
41
42# This would be much prettier if a) Makefile.lib didn't reqire both $(SRCS) and
43# $(OBJECTS) to be set or b) make gave us a nice way to do basename in pattern
44# replacement definitions.
45
46# Files specific to the library version of libumem
47OBJECTS_library = \
48	init_lib.o \
49	umem_agent_support.o \
50	umem_fail.o \
51	umem_fork.o \
52	umem_update_thread.o \
53	vmem_mmap.o \
54	vmem_sbrk.o
55
56SRCS_library = $(OBJECTS_library:%.o=../common/%.c)
57
58# Files specific to the standalone version of libumem
59OBJECTS_standalone = \
60	init_stand.o \
61	stub_stand.o \
62	vmem_stand.o
63
64SRCS_standalone = $(OBJECTS_standalone:%.o=../common/%.c)
65
66# Architecture-dependent files common to both versions of libumem
67OBJECTS_common_isadep = \
68	asm_subr.o
69
70SRCS_common_isadep = \
71	$(ISASRCDIR)/asm_subr.s
72
73# Architecture-independent files common to both versions  of libumem
74OBJECTS_common_common = \
75	envvar.o \
76	getpcstack.o \
77	malloc.o \
78	misc.o \
79	vmem_base.o \
80	umem.o \
81	vmem.o
82
83SRCS_common_common = $(OBJECTS_common_common:%.o=../common/%.c)
84
85OBJECTS = \
86	$(OBJECTS_$(CURTYPE)) \
87	$(OBJECTS_common_isadep) \
88	$(OBJECTS_common_common)
89
90include ../../Makefile.lib
91include ../../Makefile.rootfs
92
93SRCS = \
94	$(SRCS_$(CURTYPE)) \
95	$(SRCS_common_isadep) \
96	$(SRCS_common_common)
97
98SRCDIR = ../common
99
100#
101# Used to verify that the standalone doesn't have any unexpected external
102# dependencies.
103#
104LINKTEST_OBJ = objs/linktest_stand.o
105
106CLOBBERFILES_standalone = $(LINKTEST_OBJ)
107CLOBBERFILES += $(CLOBBERFILES_$(CURTYPE))
108
109LIBS_standalone = $(STANDLIBRARY)
110LIBS_library = $(DYNLIB) $(LINTLIB)
111LIBS =	$(LIBS_$(CURTYPE))
112
113MAPFILE_SUPPLEMENTAL_standalone = ../common/stand_mapfile
114MAPFILE_SUPPLEMENTAL = $(MAPFILE_SUPPLEMENTAL_$(CURTYPE))
115
116LDLIBS +=	-lc
117
118LDFLAGS_standalone = $(ZNOVERSION) $(BREDUCE) -M../common/mapfile-vers \
119	-M$(MAPFILE_SUPPLEMENTAL) -dy -r
120LDFLAGS = $(LDFLAGS_$(CURTYPE))
121
122ASFLAGS_standalone = -DUMEM_STANDALONE
123ASFLAGS_library =
124ASFLAGS += -P $(ASFLAGS_$(CURTYPE)) -D_ASM
125
126CERRWARN += -_gcc=-Wno-switch
127CERRWARN += -_gcc=-Wno-uninitialized
128
129$(LINTLIB) := SRCS = ../common/$(LINTSRC)
130
131# We want the thread-specific errno in the library, but we don't want it in
132# the standalone.  $(DTS_ERRNO) is designed to add -D_TS_ERRNO to $(CPPFLAGS),
133# in order to enable this feature.  Conveniently, -D_REENTRANT does the same
134# thing.  As such, we null out $(DTS_ERRNO) to ensure that the standalone
135# doesn't get it.
136DTS_ERRNO=
137
138# We need to rename some standard functions so we can easily implement them
139# in consumers.
140STAND_RENAMED_FUNCS= \
141	atomic_add_64 \
142	atomic_add_32_nv \
143	snprintf \
144	vsnprintf
145
146CPPFLAGS_standalone = -DUMEM_STANDALONE $(STAND_RENAMED_FUNCS:%=-D%=umem_%)
147CPPFLAGS_library = -D_REENTRANT
148CPPFLAGS +=	-I../common -I../../common/inc $(CPPFLAGS_$(CURTYPE))
149
150CFLAGS_standalone = $(STAND_FLAGS_32)
151CFLAGS_common =
152CFLAGS += $(CFLAGS_$(CURTYPE)) $(CFLAGS_common)
153
154CFLAGS64_standalone = $(STAND_FLAGS_64)
155CFLAGS64 += $(CCVERBOSE) $(CFLAGS64_$(CURTYPE)) $(CFLAGS64_common)
156
157INSTALL_DEPS_library =		$(ROOTLINKS) $(ROOTLINT) $(ROOTLIBS)
158
159#
160# turn off ptr-cast warnings, since we do them all the time
161#
162LINTFLAGS +=	-erroff=E_BAD_PTR_CAST_ALIGN
163LINTFLAGS64 +=	-erroff=E_BAD_PTR_CAST_ALIGN
164
165DYNFLAGS +=     $(ZINTERPOSE)
166
167.KEEP_STATE:
168